Controlling Plaback Through a PlugIn
I would like to be able to do the following through a plugin:
1) Start playback
2) Stop and pause playback
3) Set the Start and end notes (or measure) for playback
4) Set loop start and end notes and set loop mode on for playback
Are these things possible? If so, some pointers as to where to start (or even sample code) would be appreciated.
Barry
Comments
As far as I can tell this is not possible.
I think, something could be done, but probably needs some "hacks".
There is a comand
cmd("play")
, which does same, as click play button in UI. (play and stop)(List of available commands is here https://github.com/calculuswhiz/musescore-utils/blob/master/ValidComman… )
To start from specific note, you need to select it first. (It should be possible by plugin API)
To stop on specific position, you need to "read" actual position. Not sure, if this is possible, i guess, it is not.
May be with some combinantion with cursor input state mode "INPUT_STATE_SYNC_WITH_SCORE" it could be possible? I dont know.
In reply to I think, something could be… by sammik
Hmm, yes, that is what I was looking for, must have missed this.
cmd("play"
would be a toggle, same as the corresponding button in the toolbar and shortcut "space"In reply to Hmm, yes, that is what I was… by Jojo-Schmitz
Thanks, the cmd("play") is exactly what I needed to start. I will post my code here when I have something to show - maybe a week of two away.
In reply to I think, something could be… by sammik
Attached is a basic plugin file that will perform a play back action on the selected region of the current score by copying the selection into a specially created Temp score and then playing that score. It assumes that the Temp score contents are shorter than or equal to the pasted contents (if the Temp score has already been created it is reused for subsequent playbacks)
The code will 'increment' the selection in the originating score after the copy has been done.