Plugin to Host

How can the juce host receive a start/stop command from a plugin, like Vienna Ensemble Pro?

AFAIK plugin formats don’t provide any way of sending transport control messages.

(The only exception I can think of is the ARA extension, but that’s only supported by a couple of hosts and a handful of plugins)

I don’t know about Vienna Ensemble Pro, but if it’s a midi plugin, especially a midi instrument, it could emit some MidiMachineControlCommands, although I might suspect these are primarily used by external, physical, midi instruments.

Cubase, ProTools, etc. all start and stop playback when the Start/Stop button is pressed in any of the Vienna plugins. So the plugin has to be sending something. I can’t figure out what.

If the plugin was sending MidiMachineControlCommands how would the demo host receive them?

I found this is the Vienna forum:
Transport Play/Stop button, which is transmitted to the master host as well (Space key). Now you can start and stop your playback from within Vienna Ensemble PRO!

So it sounds to me like they are saying the plugin is sending a Space Bar key press. Does this make sense?

1 Like

OK, so I suppose it’s just a hack where the plugin sends a fake space bar keyboard message into the host application’s message queue? That probably would require some direct win32/Cocoa API use in a JUCE context…(I mean if you are trying to code a plugin which should implement this, but are you actually asking about hosting plugins…?)

I have tracked it down and sure enough the plugin sends a key press (space bar) to the operating system. Problem is I am getting two of them, one for key down and one for key up, I assume. It is easy enough to trap this, so thank you for your input.

Was this something you were able to do? Trying to do this myself right now. Thanks!

I trapped the key press in main window like this:

if (key == KeyPress::spaceKey) //This is here because Vienna sends two space bars that start and stop immediately
{											//so we allow a 100msec in between to make sure.
	static int64 lastKeyPressTime = 0;

	if ( Time::getCurrentTime().toMilliseconds() > lastKeyPressTime + 100 )
		pControlBar->DoCommand (CMD_PLAY);
		lastKeyPressTime = Time::getCurrentTime().toMilliseconds();
		return true;

Hope this helps.


Thank you!! I am certain it will but I’m not quite there yet.

I’m just not sure how to simulate this keypress. I’d like to send ‘space’ on a button click.

I’d imagine something like…

    button.onClick = [this]
        postCommandMessage('spaceKey'); //...basically


I am still learning, sorry if this is obvious :slight_smile: