@tsempire I'll give the solution to those who need it.
Copy this code:// Get a reference to the MIDI processor as MIDI player
const MIDIplayer = Synth.getMidiProcessor("MIDI Player1").asMidiPlayer();
// Get a reference to the transport buttons
const grpTranportBtn = [Content.getComponent("btnPlay"),
Content.getComponent("btnStop")];
for(b in grpTranportBtn)
{
// Make sure the buttons are not saved with the presets
b.set("saveInPreset", false);
}
// Also set the STOP button to be momentary
grpTranportBtn[1].set("isMomentary", true);
inline function onTransportBtnControl(component, value)
{
// get which button triggered the callback
local index = grpTranportBtn.indexOf(component);
};
// on compilation, reset the playhead position to the beginning
// comment it out if not needed
MIDIplayer.setPlaybackPosition(0.0);
btnPlay
btnStop