MIDI SysEx messages... Is it correct?

Hello, people,

I’m trying to send a MIDI tuning SysEx message and I’m getting an access violation in juce_Win32_midi.cpp at line 617. My code looks like this:

uint8 midiNote = 69;
const uint8 rawSysEx[10] = {0x7F, 0x7F, 0x08, 0x02, 0x00, 0x01, midiNote, midiNote, 0x00, 0x00};
MidiMessage mySysEx = MidiMessage::createSysExMessage(rawSysEx,10);

What could be wrong? I’m trying to send a test MIDI tuning change message for a single key, according to the site http://www.midi.org/about-midi/tuning.shtml

Looks fine to me - can you find out more about exactly what’s crashing? Does the data look ok just before it calls midiOutLongMsg()?

I think I have found the problem. I was sending (after the sysex message) another midi message to the channel zero (invalid channel). This may have caused a crash. I had to clean/rebuild the application and change from zero to channel one to make it work.

No, the problem did not stop yet. Sometimes when I start debugging, my app breaks on the following line:

void MidiOutput::sendMessageNow (const MidiMessage& message)
    const MidiOutHandle* const handle = (const MidiOutHandle*) internal;

What does this line mean?


This text may give some answers:
Managing MIDI Ports

I prevented the app to start the MidiOut automatically, so the user must explicitly click a button to start MidiOut. Now, apparently that bug was solved.