Hello,
I use midi output to send out sysex of 4872 bytes.
But when I use scoped pointer it does not work anymore but truncate the sysex to 3840 bytes.
Let me explain :
It’s as if the midi output need time to open/close the device, and that if set the opening device / ‘delete’ the pointer in the same function of my sendMessageNow(message); it does not work (which is also what does scopedPointer if I understand).
But if I delete the pointer a little ‘later’ (outside the loop) manually, then it works.
Example :
MidiOutput * currentMidiOutput = nullptr;
switch (which)
{
case 1:
{
currentMidiOutput = MidiOutput::openDevice(midiOutputsList.indexOf(midiOut));
if (currentMidiOutput != nullptr && sysexDataSize!=0)
currentMidiOutput->sendMessageNow(message);
if (currentMidiOutput !=nullptr)
delete currentMidiOutput;
break;
}
default:
{
}
This FAIL, while JUST moving the deletion of the pointer ‘later’ WORK
MidiOutput * currentMidiOutput = nullptr;
switch (which)
{
case 1:
{
currentMidiOutput = MidiOutput::openDevice(midiOutputsList.indexOf(midiOut));
if (currentMidiOutput != nullptr && sysexDataSize!=0)
currentMidiOutput->sendMessageNow(message);
break;
}
default:
{
}
if (currentMidiOutput !=nullptr)
delete currentMidiOutput;
The problem, I’m worried about reliability now… Maybe on some fast computers this will work and fail on slower ?
Or is there any reason behind this ? Jules ?
Salvator