X.isController() returns false after x.controllerEvent()


I’m trying to create a MidiMessage.controllerEvent(), and then use it to hold older CC events that are coming through. The problem is that when I create an empty MIDI event, and then try to create the CC message, its not testing as a CC message using isController(). Any thoughts? here is my dirty little test code, it prints fail every time.

MidivsttestAudioProcessor::MidivsttestAudioProcessor() :
    lastMidiMessage.controllerEvent(1, 14, 127);
    if(lastMidiMessage.isController()) {
    } else {
        DBG("fail :(");

        unsigned char *data;
        data = lastMidiMessage.getRawData();
        unsigned char byte1 = *data;
        unsigned char byte2 = *data;
        unsigned char byte3 = *data;
        DBG("HEX: " + String(byte1) + " " + String(byte2)  + " " + String(byte3));


controllerEvent is a static method!


Sweet! I didn’t fully understand the “static” thing yet, but that makes a lot of sense now. I fixed it below with this code

MidivsttestAudioProcessor::MidivsttestAudioProcessor() : lastMidiMessage(MidiMessage::controllerEvent(1, 14, 127)), stepSize(96.0) { }