MidiMessage failing to send


#1

I am currently working on porting an app I have built with Juce to the Mac.

Everything seems to work correctly up until I try to send Midi Messages to a USB device. In one case it sends the first sysex message, but in another area of the code it never sends the message correctly. My code for the working and not working sections is below. Any help would be greatly appreciated.

Working:
midiInput->start();
if(midiOutput) midiOutput->sendMessageNow(MidiMessage(gDSPPrepareFlash, sizeof(gDSPPrepareFlash)));

where gDSPPrepareFlash is a in memory array of type char.

Not working:
msg[0] = 0xF9;
midiInput->start();
if(midiOutput) midiOutput->sendMessageNow(MidiMessage(msg, 1));

Any ideas why seemingling identical code would behave so differently?


#2

When you say it works sometimes, could there be a threading issue - e.g. it works from one thread but not another?


#3

It looks like it is a threading issue. I did some shuffling of where threads are started and killed and got one of the instances to complete a full transaction correctly.

It looks like it will just take some fine tuning to get the other instance running as expected.

Thanks.