Click here to Skip to main content
15,885,979 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: The mystery of the disappearing socks Pin
Sander Rossel29-Jun-20 11:34
professionalSander Rossel29-Jun-20 11:34 
GeneralRe: The mystery of the disappearing socks Pin
RickZeeland29-Jun-20 8:37
mveRickZeeland29-Jun-20 8:37 
GeneralRe: The mystery of the disappearing socks Pin
OriginalGriff29-Jun-20 9:43
mveOriginalGriff29-Jun-20 9:43 
GeneralRe: The mystery of the disappearing socks Pin
CodeWraith29-Jun-20 10:07
CodeWraith29-Jun-20 10:07 
GeneralRe: The mystery of the disappearing socks Pin
charlieg30-Jun-20 17:28
charlieg30-Jun-20 17:28 
GeneralRe: The mystery of the disappearing socks Pin
TheGreatAndPowerfulOz29-Jun-20 9:59
TheGreatAndPowerfulOz29-Jun-20 9:59 
GeneralRe: The mystery of the disappearing socks Pin
dandy7229-Jun-20 10:36
dandy7229-Jun-20 10:36 
GeneralThe most complicated P/Invoke call I've ever had to make from C# and it's a doozy Pin
honey the codewitch29-Jun-20 5:57
mvahoney the codewitch29-Jun-20 5:57 
So in terms of prep, communication with drivers is always fun. The MIDI API under windows gives you close to the metal access to the underlying driver, but dealing with it is tricky

Basically the trick of it is you have these MIDIEVENT structs in C and they can be *variable length*!!!

The variable part comes at the end of the core struct and must be multiples of 4 bytes long. You must pack these MIDIEVENT structs end to end in a single vector in memory before sending it to midiStreamOut

The .NET P/Invoke marshaller thing simply cannot deal with variable length structs meaning you wind up using Marshal.StructureToPtr(), Marshal.Copy() and/or Marshal.WriteByte(), etc yourself to construct your data.
Real programmers use butterflies

GeneralRe: The most complicated P/Invoke call I've ever had to make from C# and it's a doozy Pin
Richard MacCutchan29-Jun-20 6:24
mveRichard MacCutchan29-Jun-20 6:24 
GeneralRe: The most complicated P/Invoke call I've ever had to make from C# and it's a doozy Pin
Sander Rossel29-Jun-20 8:25
professionalSander Rossel29-Jun-20 8:25 
GeneralRe: The most complicated P/Invoke call I've ever had to make from C# and it's a doozy Pin
Richard MacCutchan29-Jun-20 9:23
mveRichard MacCutchan29-Jun-20 9:23 
GeneralRe: The most complicated P/Invoke call I've ever had to make from C# and it's a doozy Pin
David O'Neil29-Jun-20 10:06
professionalDavid O'Neil29-Jun-20 10:06 
GeneralRe: The most complicated P/Invoke call I've ever had to make from C# and it's a doozy Pin
Greg Utas29-Jun-20 14:08
professionalGreg Utas29-Jun-20 14:08 
GeneralRe: The most complicated P/Invoke call I've ever had to make from C# and it's a doozy Pin
David O'Neil29-Jun-20 15:30
professionalDavid O'Neil29-Jun-20 15:30 
GeneralRe: The most complicated P/Invoke call I've ever had to make from C# and it's a doozy Pin
Greg Utas29-Jun-20 23:41
professionalGreg Utas29-Jun-20 23:41 
GeneralRe: The most complicated P/Invoke call I've ever had to make from C# and it's a doozy Pin
kalberts30-Jun-20 1:34
kalberts30-Jun-20 1:34 
GeneralRe: The most complicated P/Invoke call I've ever had to make from C# and it's a doozy Pin
Greg Utas30-Jun-20 1:56
professionalGreg Utas30-Jun-20 1:56 
GeneralRe: The most complicated P/Invoke call I've ever had to make from C# and it's a doozy Pin
kalberts30-Jun-20 3:02
kalberts30-Jun-20 3:02 
GeneralRe: The most complicated P/Invoke call I've ever had to make from C# and it's a doozy Pin
David O'Neil30-Jun-20 3:28
professionalDavid O'Neil30-Jun-20 3:28 
GeneralRe: The most complicated P/Invoke call I've ever had to make from C# and it's a doozy Pin
David O'Neil30-Jun-20 4:27
professionalDavid O'Neil30-Jun-20 4:27 
GeneralRe: The most complicated P/Invoke call I've ever had to make from C# and it's a doozy Pin
Greg Utas30-Jun-20 7:23
professionalGreg Utas30-Jun-20 7:23 
GeneralRe: The most complicated P/Invoke call I've ever had to make from C# and it's a doozy Pin
David O'Neil30-Jun-20 7:55
professionalDavid O'Neil30-Jun-20 7:55 
GeneralRe: The most complicated P/Invoke call I've ever had to make from C# and it's a doozy Pin
Greg Utas30-Jun-20 8:15
professionalGreg Utas30-Jun-20 8:15 
GeneralRe: The most complicated P/Invoke call I've ever had to make from C# and it's a doozy Pin
David O'Neil30-Jun-20 9:06
professionalDavid O'Neil30-Jun-20 9:06 
GeneralRe: The most complicated P/Invoke call I've ever had to make from C# and it's a doozy Pin
kalberts30-Jun-20 10:18
kalberts30-Jun-20 10:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.