Over the past week I have really gotten to dig in with GPScript and I am loving it. One of the things that I wanted to be able to do was to control the metronome volume using a knob, and turn it off and on using a button. GPScript gives the needed access to the metronome and the playhead.
Enabling the metronome starts the playhead at the same time so that the beat starts when I hit the button – useful when the band gets off the click and you need to reset it.
// Declare global variables
var dialMetro : Widget // Assumes there is a widget with a script name of dialMetro
buttonMetro : widget // Assumes there is a widget with a script name of buttonMetro
// Set the metronome volume according to the initial widget value
// Respond any time the metronome volume widget changes
On WidgetValueChanged(newValue : double) from dialMetro
// Respond any time the metronome enable button is changed
On WidgetValueChanged(newValue : double) from buttonMetro
var boolEnable : boolean
boolEnable = newValue != 0.0
PS - My script lost its whitespace / indentation in the translation to HTML! If anyone knows how to post with indentation please let me know!