midiKeyboardState question

I’m wondering why midiKeyboardStates need to be either SharedResourcePointer<>'s or class members and can’t be scoped pointers.

If I do the following in my constructor, NoteOn’s from a midi controller won’t cause the midiKeyboardComponent instance to light up at all:

class MK: public Component, public MidiKeyboardStateListener {
  ScopedPointer<MidiKeyboardState> state;
  ScopedPointer<MidiKeyboardComponent> keyboard;

      state = new MidiKeyboardState();
      keyboard = new MidiKeyboardComponent( *state, MidiKeyboardComponent::horizontalLayout );

however, if I make state a SharedResourcePointer<MidiKeyboardState> state; or just a MidiKeyboardState state; and keep the keyboard as a ScopedPointer, it works fine.

Why is that?

That’s not true. Sounds like you’ve made a mistake somewhere else, and are misunderstanding why it seems to go away when you change the pointer type. But the class itself obviously doesn’t care or know what kind of pointer you’re using.

Interesting. I’ll dig into my code some more and figure out what’s causing it.