Forwarding the playhead like that is the way to go, yes.
Have you set the pluginEditorRequiresKeys plugin characteristic in the Projucer/CMake for your project? If you have, then I think keypresses should just work.
If not, please can you provide more details about the failure? Do keypresses work in the ‘outer’ plugin editor, but not the ‘inner’ editor, or do they not work for either? To track down the problem, it would also be useful to know what operating system you’re running, and the host that you’re using for testing (some hosts intercept keypresses before they reach the plugin, and some such hosts also have an option to customise this behaviour).
I enabled ‘Plugin Editor Requeires Keyboard Focus’ in the Projucer. However I am still not able to react properly on key presses. It works only randomly in Reaper. Other DAWs like FLStudio, Ableton and Savihost fail.
class MyKeyListener : public juce::KeyListener
{
public:
bool keyPressed(const juce::KeyPress& key, juce::Component* orginatingComponent) override
{
MessBox(“”, “Key has been pressed”);
return false;
}
};
class WrapperProcessor: public juce::AudioProcessor, public juce::AudioProcessorListener
In REAPER, does enabling the “send all keyboard input to plugin” option help? (It’s in the “+” menu that can be opened from the plugin window’s top bar.)
Do keypresses work in the ‘outer’ plugin editor, but not the ‘inner’ editor, or do they not work for either? To track down the problem, it would also be useful to know what operating system you’re running.
I see. I assume that your KeyListener doesn’t get any callbacks. Does keyboard input work on the wrapped plugin at all? That is, assuming the inner plugin has text fields or something similar, do those controls respond to the keyboard correctly?
The text fields in the inner plugin do receive keyboard input.
The wrapped VST2.4 plugin does not receive anything on “bool onKeyDown (VstKeyCode &keyCode)”.
It appears as if this function is not supported by the interface of JUCE when a plugin is wrapped with createPluginInstance
Yes, it sounds like keyboard handling is working as expected. JUCE cannot intercept keyboard events on the hosted plugin instance, and it sounds like the wrapped plugin is receiving keyboard input correctly.