MIDI input events

Are you developing an External using the LiveCode Externals SDK?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
pderocco
Posts: 44
Joined: Fri May 16, 2008 1:26 am

MIDI input events

Post by pderocco » Fri May 16, 2008 10:00 am

It's easy enough to see how to use an external to generate MIDI, since it's just a synchronous call to some OS API. But for input, at least in Windows, MIDI is handled by the device driver sending each received MIDI message to the application as an event, and I assume the Mac is more or less the same. In Windows, the events are MM_MIM_DATA and MM_MIM_LONGDATA. Since there is no built-in Revolution equivalent to these, what happens to these messages? Do they just disappear into the bit bucket? Or is there some Revolution event that gets invoked for unclassified Windows events that don't have some specific name in Revolution? Or is there a way to add to the table that translates Windows events into Revolution events? Or is there a way to replace the low-level Windows event handler (the WindProc) with one that can check for the MIDI messages, and pass others on to the built-in handler?

Beyond that, is there a similar way to do this for the Mac?
Ciao,
Paul

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Post by mwieder » Sat May 17, 2008 1:48 am

Paul-

You have to code an event loop in your external dll. I've had to do this exactly once in making externals and it was the weirdest dll I've ever made. Normally you don't expect to put a whole event loop into a dll, but that's the way you catch these messages. From that point it's a pretty simple matter to hand the message contents back to rev and handle them there.

JeffT
Posts: 3
Joined: Fri Jun 27, 2008 7:10 pm
Location: USA

a simple matter? I don't get it.

Post by JeffT » Fri Jun 27, 2008 11:29 pm

But what if the messages you catch are MIDI System Exclusive messages? Revolution's core loop just ignores these, as far as I can tell. So how do you "hand the message contents back to rev and handle them there"?

TIA

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Post by mwieder » Sun Jul 13, 2008 3:36 am

Not sure what you're getting at here... sysex messages are *very* dependent on the equipment you're talking to. If you're trying to handle sysex messages yourself, you'd want to start collecting data from the start of the sysex stream (byte: F0 followed by byte: mfg id) until the EOX message (byte F7). Everything within is specified as being freeform and will vary by manufacturer and model. How you interpret the data is up to you. If I were doing this, I'd buffer the data, then pass the stream intact back to the calling script to parse and deal with.

MouseUp
Posts: 41
Joined: Sun Feb 14, 2010 3:41 pm

Re: MIDI input events

Post by MouseUp » Wed May 01, 2013 4:31 am

Was this Midi Input project ever developed further? I would love to be able to receive Midi Sysex data into LiveCode to process it!
Thanks,

MouseUp

Post Reply

Return to “Building Externals”