So I have this project where I need to be able to use the spacebar to press play in the DAW, but there is not a keyboard available. I am trying to do this with a button, but I don’t know how to link the spaceKey with the button. Any advice would be appreciated.
You’d need to do some platform-level hackery to inject keypresses. I’m assuming this is something you’re building to work with only a very specific DAW setup though, because not all of them will respond to the space key in the way you expect. And of course if it’s already playing then this would stop it. And if the user is editing a text field, it’ll insert a space… and I’m sure there are lots of other reasons why this is a dodgy hack!
Well this is just a start, as this will be used for a console to be able to play the track on Pro Tools. If the spacebar is pressed then the track will play or pause. I think what I need to do is to interject this into the operating systems key stack if that makes sense.
I think rather than completely disabling the key, its just for when this button is pressed.
I’ve been thinking about this, my way would have been to create a virtual MIDI output and hook it into pro tools MMC, so you can send start and stop commands using MidiMessage::MidiMachineControlCommand
But I got to realise, that this workflow will probably not get any lovers, so I abandoned the idea completely.