I believe that I have a strategy to implement this, but I’m struggling to get my GPScript to compile. The plan is to use an If/Else statement to assign different actions to the widget depending on the state of the songpart index. If the song index is 1-4, then the widget will add 4 to the index. If the song index is 5-8, then the widget will subtract 4 from the index.
Can anyone please assist? The script is in the gig script of the .gig below.
//Get Song Part
var FXSwitch : Widget
var SongPartNumber : Integer
On Songpart(oldSongpartIndex : Integer, newSongpartIndex : Integer)
SongPartNumber = GetCurrentSongPart()
End
//Find Manual's FX Part
On WidgetValueChanged(newValue : double) from FXSwitch
If SongPartNumber <= 4 Then
SetSongPart(index: SongPartNumber + 4)
Elsif SongPartNumber >= 5 Then
SetSongPart(index: SongPartNumber - 4)
End
My error message is:
Gig (GigScript) - - Syntax Error in “Main”: Line 14, Col 1: Unexpected or unrecognized token: ‘If’
Mismatched input ‘If’ expecting End
Thanks for your guidance! I tidied up the script and spent time with the manual getting to know objects available in a Rackspace/Gig Script setting.
However, I’m still struggling to setup a callback that can be triggered via midi/widget in the Gig Script. I see many available in a Rackspace Script, but I can’t migrate because it is unable to use song functions such as:
On Songpart(oldSongpartIndex : Integer, newSongpartIndex : Integer)
SongPartNumber = GetCurrentSongPart()
Any direction on solving this dilemma? Here is the current script:
//Patch Control <---> FX Control
var SongPartNumber : Integer
SomeMidiInBlock : MidiInDevice
On Songpart(oldSongpartIndex : Integer, newSongpartIndex : Integer)
SongPartNumber = GetCurrentSongPart()
End
On ControlChangeEvent (c : ControlChangeMessage) From SomeMidiInBlock
If SongPartNumber <= 4 Then
SetSongPart(SongPartNumber + 4)
Elsif SongPartNumber >= 5 Then
SetSongPart(SongPartNumber - 4)
End
End
The reason you cannot access widgets directly from a gigscript is because there is no way to guarantee that a specific widget that you reference from a gig script will actually be available.
However, if you want to trigger a callback in a gigscript from a rackspace (say), then you can use OSC messages.
Brilliant! I changed my callback trigger to OSC instead of MIDI and corrected the “break point” (0-3, 4-7 vs 1-4, 5-8) and now the patch is working perfectly. Here’s the script and .gig:
//Patch Control <---> FX Control
var SongPartNumber : Integer
On Songpart(oldSongpartIndex : Integer, newSongpartIndex : Integer)
SongPartNumber = GetCurrentSongPart()
End
On OSCMessageReceived(message : OSCMessage) Matching "/GigScript/FXSwitch"
If SongPartNumber <= 3 Then
SetSongPart(SongPartNumber + 4)
Elsif SongPartNumber >= 4 Then
SetSongPart(SongPartNumber - 4)
End
End