Cmd+Z is intercepted by plugin host


#1

I want my audio plugin to respond to Cmd(Ctrl)+Z and Cmd(Ctrl)+Y for controlling the Undo manager.

But it seems the hosts I’m testing this in (Reason and Garageband) both intercept those key combinations before even reaching my keyPressed() callback.
I can read Z or Shift+Z just fine, so it seems that I’ve managed to register the KeyListener correctly. It’s the Cmd+Z combination that won’t reach my key listener.

First I was considering that it’s not possible to get around this at all, but it turns out that there are other plugins (for example MicroTonic) that manage to receive this key combination in the same hosts. So there must be a way!

Does anyone know how they do this?
(Hoping that it’s not a matter of the hosts hardcoding this support for certain plugins…)


#2

It’s more that the plugin is not intercepting the key press. I just did a bit of experimentation, implementing IPlugView::onKeyDown to always return kResultTrue in a VST3 (instead of the default which returns kResultFalse), and Cmd-Z was intercepted.
I imagine that there is no simple cross-plugin option for doing this, else I’m sure it would have been done already.


#3

Thanks! So you mean it’s a limitation in the JUCE plugin wrapper?


#4

I suppose that’s the only way of framing it. I don’t know the intricacies of how key input is handled, so not best placed to comment on that really. I would imagine there is a good reason why it’s the way it is though.


#5

I think it’s a little bit weird that it behaves this way, because I can’t imagine that my situation is that unique:

I have some parameters in my AudioParameterValueTree that are non-automatable (step values in a sequencer).

If I create the instance of my plugin, and then immediately change one of the non-automatable parameters (for example click on some of the sequencer buttons), the host will not be aware that anything changed, so hitting Ctrl+Z will redo the creation of the instance.

Now if I try to redo the operation in the host, I get the plugin instance back, but the changes I made in the plugin’s sequencer are gone, because the host didn’t know that it had to save the state of the plugin first…

So what’s the normal “JUCE way” to handle this use case?
If I can’t override Ctrl+Z, then I imagine the best way is to somehow let the host know that the plugin’s state has changed, even though it’s not visible via automation.

So how would I go about doing that?


#6

That’s normally achieved using updateHostDisplay().