MidikeyboardState initialise

How do you initialise the MidikeyboardState
Eg I have an instance

MidikeyboardState& keyboardState;

In pluginEditor.h

This is actually not an instance but a reference.
The MidiKeyboardState needs to live in the processor, because it is used with or without the existence of the GUI (for keeping track of currently down notes).

You need to initialise the reference in the initialiser list from an argument to your GUI:

MyPluginProcessorEditor (MyPluginProcessor& p) 
  : juce::AudioProcessorEditor (p),
    processor (p),
    keyboardState (p.getKeyboardState())
// ...

Where your MyPluginProcessor has a method to return a reference to the state.