VGuitar Forums

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Midi class to manage queing of midi messages for devices like GR55  (Read 63 times)

0 Members and 1 Guest are viewing this topic.

philjynx


Hi folks.
Now that I have had the time to see it working reliably it's time to share this code.
Lots of gizmos require a time gap between MIDI messages (like the GR55 for instance).
So, if you're making a controller which will be sending to such devices, you needn't write any code to manage it.

Important to say upfront, your midi sends remain syntactically the same as with normal MIDI, so it is really easy to implement.

eg :
RolandMIDI.sendControlChange(0, 0, RolandChannel);
RolandMIDI.sendControlChange(32, 0, RolandChannel);
RolandMIDI.sendProgramChange(selector, RolandChannel);

The link points to a file which contains two midi classes (Forked from MIDI Version 3.2 which was written by Francois Best.)
I chose version 3.2 because it doesn't use templates - I find templated code impossible to follow.

The two classes are DMIDI and QMIDI.

DMidi waits for the desired interval before sending.

QMidi (Queue Midi), adds your message to its queue leaving your sketch to continue with other things and sends the message when it is due.

So, you use whichever class is most appropriate.

When it is important that your sketch NOT DO ANYTHING ELSE until a message is sent, you'd use DMidi.
When it is ok, or even desirable for you sketch to get on with other things, you'd use QMidi.

If you decide to try it out, I suggest that you create a folder ..arduino\libraries\QMidi and extract the files into there, and NOT install the zip file.
That way, you can #include <QMidi.h> in your sketch. If you then decide it's not for you, all you have to do is not use it and delete that folder.

Caveat: Unlike the regular MIDI class, these two do not default to a serial port, you have to explicitly set the one appropriate to your device.
Note: I have only used it on a teensy 3.2 but I am guessing that it would work with other teensies and probably arduinos too.
Nuther Note: Each QMidi instance has its own queue. You can set the queue size (and therefore memory usage) by changing two constants in qmidi.h. Alas, this queue size applies to all instances of qmidi that you use (you can't set the size on a per instance basis).

https://transcriptbooster.uk/downloads/QMidi-contains_both_QandD_midi_classes.zip


Enjoy!
« Last Edit: May 11, 2017, 01:01:53 PM by philjynx »
Logged
I am playing all the right notes. But not necessarily in the right order.

philjynx

Re: Midi class to manage queing of midi messages for devices like GR55
« Reply #1 on: May 18, 2017, 05:07:01 PM »

So far this class has been downloaded by some folks in Canada, France, Sweden, New Zealand  & the USA.
If any of those have had the chance to try it out, I'd like some feedback, otherwise it's a bit of a pointless exercise in chucking a message in a bottle into the sea.

Cheers.
« Last Edit: May 19, 2017, 07:05:35 AM by philjynx »
Logged
I am playing all the right notes. But not necessarily in the right order.
Pages: [1]   Go Up
 

Blog