Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / September 2003

Tip: Looking for answers? Try searching our database.

MIDI in -NET

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lars Lundstedt - 26 Aug 2003 17:30 GMT
Has anyone tried using the Win32 low level MIDI functions in .NET/C#?

What I'm trying to do is send and receive sysex-messages but I just can't
figure out how to declare and use the
midi* APIs.

I've successfully declared and used the APIs for getting device caps and
opening and sending short midi messages (note on, note off, etc...) but I'm
totally lost when it comes to getting the input to work what with callbacks,
handles and all...:-)

Btw, I found the very nice MIDI for .NET library on Gotdotnet but
unfortunately it doesn't seem to contain the functions for what I need to
do.
Mattias Sj?gren - 26 Aug 2003 21:47 GMT
Lars,

>I've successfully declared and used the APIs for getting device caps and
>opening and sending short midi messages (note on, note off, etc...) but I'm
>totally lost when it comes to getting the input to work what with callbacks,
>handles and all...:-)

Can you name one or a few of the functions you have problems with?

Mattias

Signature

Mattias Sjögren [MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.

Lars Lundstedt - 28 Aug 2003 11:24 GMT
Hej Mattias!

Well, these are the APIs I'm having problems with:

Structures:
MIDIHDR

Callbacks:
MidiInProc

Functions:
midiInOpen (the callback part)
midiInAddBuffer
midiInPrepareHeader
midiInUnprepareHeader
midiOutPrepareHeader
midiOutUnprepareHeader
midiOutLongMsg

I guess my main problem is that I still don't really understand
interop...:-)
I can't figure out how to declare and use the callbacks and making sure that
handles aren't
garbage collected when they shoudln't be and all that stuff...

I'd appreciate any help you can give me...

/Lasse

> Lars,
>
[quoted text clipped - 11 lines]
> http://www.msjogren.net/dotnet/
> Please reply only to the newsgroup.
Mattias Sj?gren - 03 Sep 2003 23:05 GMT
Hej Lars,

>I guess my main problem is that I still don't really understand
>interop...:-)

There are a couple of good books and articles available if you want to
learn more about it.

>Structures:
>MIDIHDR

struct MIDIHDR
{
 public IntPtr lpData;
 public uint dwBufferLength,
             dwBytesRecorded;
 public IntPtr dwUser;
 public uint dwFlags;
 private IntPtr lpNext,
                reserved;
 public uint dwOffset;
 [MarshalAs(UnmanagedType.ByValArray, SizeConst=4)]
 private IntPtr[] dwReserved;
}


>Callbacks:
>MidiInProc

delegate void MidiInProc(IntPtr hMidiIn, uint wMsg, IntPtr dwInstance,
uint dwParam1,  uint dwParam2);

>Functions:
>midiInOpen (the callback part)

[DllImport("winmm.dll")]
static extern uint midiInOpen(out IntPtr lphMidiIn, IntPtr uDeviceID,
MidiInProc dwCallback, IntPtr dwCallbackInstance, uint dwFlags);

If you still have problems with the other function, feel free to
follow up.

Mattias

Signature

Mattias Sjögren [MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.

Lars Lundstedt - 08 Sep 2003 21:08 GMT
Tack Mattias!

> Hej Lars,
>
[quoted text clipped - 43 lines]
> http://www.msjogren.net/dotnet/
> Please reply only to the newsgroup.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.