Giter Club home page Giter Club logo

Comments (4)

GoogleCodeExporter avatar GoogleCodeExporter commented on July 17, 2024
Device handles should be declared as IntPtr, not Int32
(see in HMIDIOUT and HMIDIIN)

Note: structs HMIDIOUT and HMIDIIN are not really needed, could be replaced 
with IntPtr in pinvoke calls (eg midiOutOpen)

Original comment by [email protected] on 23 Dec 2013 at 7:44

from midi-dot-net.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 17, 2024
I would be very interested in finally seeing a mutually agreed 64bit compatible 
wrapper for these "winmm.dll" functions.  

For example:
// Notes here:
// 
http://msdn.microsoft.com/en-us/library/windows/desktop/dd798453%28v=vs.85%29.as
px
[DllImport("winmm.dll")]
private static extern int midiInGetDevCaps(
   int deviceID,     // UINT_PTR - can also be a properly cast device handle
   ref MidiInCaps caps,        // LPMIDIDINCAPS - I have seen OUT parameter used
   int sizeOfMidiInCaps);      // UINT

The simplest approach is to understand what symbols to use in place of the C++ 
definitions, for each platform separately.  So, on a 64bit system, UINT = ?? 
and DWORD = ??.   But on a 32bit system, UINT = ?? and DWORD = ??.  No harm in 
using a different wrapper depending on the width of UINTPTR in bytes.

Secondly, we need to differentiate where the casting between 32 and 64 bit 
types occurs.  Yes, we can return an INT - but is it better to return an UINT16 
from the wrapper to clarify?  Just because we can cast without an explicit 
statement does not make it right to do so - in fact with dll wrapping it is 
better to spell it out.  Hiding the width makes passing the value to another 
function more difficult.  So I propose the bit width limits are explicit in the 
return types in the wrappers.

Can we not create an open source group to write these wrappers as a reference 
for the community?



Original comment by [email protected] on 17 Jul 2014 at 8:57

from midi-dot-net.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 17, 2024
NOTE - My reference to UINT16 and INT above are fictional, simply to illustrate 
a point.

Original comment by [email protected] on 17 Jul 2014 at 9:12

from midi-dot-net.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 17, 2024
The workaround is to compile your .net application in 32bit mode only (Project 
properties > Build > Platform target > x86)

Original comment by [email protected] on 22 Oct 2014 at 1:26

from midi-dot-net.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.