I can't send a midi message to a hardware device, what am I doing wrong?


#1

I want to make a midi editor for a hardware synthesizer.

The host application crashes immediately with MidiOutput::sendMessageNow().

class ExampleAudioProcessor : public AudioProcessor{
    
    public:

        MidiOutput *midiOutput;   
}

ExampleAudioProcessor::ExampleAudioProcessor(){ // constructor

    midiOutput -> openDevice(0); // Roland USB MIDI Interface UM-ONE
}

void ExampleAudioProcessorEditor::sliderValueChanged(Slider *slider){

    MidiMessage message = MidiMessage::controllerEvent(1, 1, midiSlider.getValue());
    processor.midiOutput -> sendMessageNow(message); // host crashes here
}

#2

add some breakpoints and debug.
Chances are your MidiOutput is a nullptr. Post your full code too.


#3

Opening a device should be:

midiOutput = MidiOutput::openDevice(0);

#4

Thanks, I got it to work.