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

**URL:** <https://forum.juce.com/t/x-iscontroller-returns-false-after-x-controllerevent/7296>\
**Category:** General JUCE discussion\
**Created:** [August 13, 2011, 5:32am UTC](https://forum.juce.com/t/x-iscontroller-returns-false-after-x-controllerevent/7296 "2011-08-13T05:32:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Owen](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/owen/32/305_2.png) [@Owen](https://forum.juce.com/u/Owen)\
**Post date:** [August 13, 2011, 5:32am UTC](https://forum.juce.com/t/x-iscontroller-returns-false-after-x-controllerevent/7296/1 "2011-08-13T05:32:06Z")

</div>

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.

```auto
MidivsttestAudioProcessor::MidivsttestAudioProcessor() :
lastMidiMessage(0xf4),
stepSize(96.0)
{
    lastMidiMessage.controllerEvent(1, 14, 127);
    if(lastMidiMessage.isController()) {
        DBG("win!");
    } else {
        DBG("fail :(");

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

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [August 13, 2011, 8:32am UTC](https://forum.juce.com/t/x-iscontroller-returns-false-after-x-controllerevent/7296/2 "2011-08-13T08:32:22Z")

</div>

controllerEvent is a _static_ method!

---

<div class="post-metadata">

**Author:** ![Owen](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/owen/32/305_2.png) [@Owen](https://forum.juce.com/u/Owen)\
**Post date:** [August 13, 2011, 9:05am UTC](https://forum.juce.com/t/x-iscontroller-returns-false-after-x-controllerevent/7296/3 "2011-08-13T09:05:18Z")

</div>

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)
{
}`
