Message type stuff... for MIDI


#1

hey there,

today i was considering building a messaging system for MIDI messages, based on the message classes. it would be similar to action/change listener/broadcaster stuff, but it would send and recieve midi messages. this would let me have various controls that can generate their own specific types of message, and all be able to send them smoothly to the same place. I’ve been thinking of doing this for a while, and i think today would be the time for it. I was just wondering if anyone thought it would be a bad idea.

The main thing i can think of is that it would take away any ‘time critical’ aspect that may be required for certain midi messages, what with messages being plonked into a queue system and whatnot. But i’m sure any delays would be negligible, right? It would be a more thread-safe approach i’m sure, especially if such a broadcast were made from an audio-rate-critical function.

any opinions?


#2

Not sure I totally see the point… how would it be better than just having a bunch of separate objects each calling MidiOutput::sendMessageNow() ?


#3

because, for instance, the messages may not be wanted to get sent straight to the port. A control could be a midi broadcaster, which could send messages on changes, which could then be picked up by some kind of translation object before being sent by that. Or, the control could be slipped into a vst object, where sending to a midioutput port would not be appropriate; the code in the listener would determine what to do with the midi message (send it to a port, add it to a message output queue, translate it to something else, compare it to a particular message etc… ), whilst the code in the midi-generating object itself could stay fixed and reusable in many situations.


#4

Oh, I see. Not a bad idea, but probably best to make the calls synchronous rather asynchronous like listeners tend to be, as you can’t predict the time the message loop might take to deliver a message.


#5

all done, and it works really nicely :slight_smile: thanks for your tips mr jules.

i’ll probably post the code i made for it once i’ve used it for a little while, it’ll make it really simple to create reusable midi generating components that will slot nicely into any type of program (be it a plugin or a standalone app). It separates the creation of the midi data from the handling in a nice and elegant manner.

as ever, more respect for your wonderful library!


#6