Updating KeyboardState using incoming MIDI data

Hi everyone,

I’m building an audio application that features a MainComponent (inheriting from Component) class as well as an instance of a custom AudioAndMIDI class (inheriting from AudioAppComponent) - which is intended to solely handle all the audio and MIDI processing. The MainWindow class passes an instance of the AudioAndMIDI class to the MainComponent.

I’ve got a custom AudioSource object within the AudioAndMIDI class that plays sampler synthesiser sounds in response to MIDI notes. The AudioAndMIDI class responds to audio device changes and incoming MIDI data (callback) however I’m unable to set the keyboard state of the sampler synthesiser. The keyboardState however does update - as the MainComponent class that receives a reference to this keyboardState does update the keyboardComponent UI.

I’m attaching the .cpp files for my Sampler and AudioAndMIDI classes - AudioAndMIDI.cpp (3.0 KB) HarmoniumAudioSource.cpp (2.3 KB)

I would really appreciate it if anyone could give me some pointers as to why my sampler is not sounding upon receiving MIDI data - despite feeding the midi events to the keystate.

Thanks in advance and Happy Holidays!