For General, Startup options I am not using the options “Reload the last gig on Startup”, “and open to the last active rackspace”.
For my gig the 49th rackspace is being selected after loading the gig and I don’t know why. Is there a setting to select a specific rackspace after the gig loads? Or does the gig itself have a setting to open to the last active rackspace?
I selected the first rackspace and re-saved the gig, but upon re-load it still selected the 49th rackspace.
I do have a global rackspace script that selects the rackspace based on widgets associated with controller buttons but I don’t think these widgets should be “firing” during the loading of the gig.
It’s not the last rackspace in the gig, and, there are only 16 buttons so I’m not sure why the 49th is selected. I will have to open up the global MIDI window and see if something is happening during the load operation.
The odd thing is that I’ve found is that, while a particular rackspace is initially loaded, the widget that is assigned to the rackspace is not the one that is ‘on’.
Here’s a small example, with 3 rackspaces, and 3 radio button widgets. When the gig loads, the radio button that loads as On is not the one associated with the rackspace that is loaded. The radio widget status is recalled from the previous save, but not the rackspace it is associated with due to some other loading procedure.
Probably because the widget doesn’t change value from loading.
Maybe update the script to set an environment variable on exit and then load it when starting your gig to say where to start. Once a widget value changes, then it should work.
I think what is happening here is in the global rackspace script I’m looking for the OnWidgetValueChanged event and during the load operation Gig Performer is setting the initial value of all the widget buttons. However, the act of setting these values is triggering my script to perform patch change operations and I don’t want that. I need to have an implementation - a global flag perhaps - that ignores the OnWidgetValueChanged events that occur during the loading of the gig.
I need advice on how best to have my script ignore the OnWidgetValueChanged events if these are happening on the initial load of the gig.
Perhaps this?
On SystemEvent Matching GigLoaded
// Callback code here
End
Unfortunately, “OnSystemEvent Matching GigLoaded” cannot be used in the global rackspace. If I define it in the gig script the gig script cannot see a variable I define in the global rackspace.
On changing rackspaces, I save the current rackspace number to a text file.
When opening the gig file, I load it from the text file and switch rackspaces.
Also, if you switch rackspaces with the left navigation pane, the widgets will also get updated. These scripts are in the individual rackspaces. Since the global rackspace widget is updated, the text file is also updated.
The file is saved in the same folder as the gig file.
Var
aa : Widget
bb : Widget
cc : Widget
stat: boolean
filename: String = "racks.txt"
rs: String
initialization
rs = LoadStringFromTextFile(filename)
Print("rackspace number=" + rs)
SwitchToRackspace(StringToInt(rs),1)
End
On WidgetValueChanged(newValue : double) from aa
//Print ("Widget value aa changed. Newvalue is " + newValue)
if newValue==1 then
SwitchToRackspace(2, 1)
stat = SaveStringToTextFile(filename,"2")
End
End
On WidgetValueChanged(newValue : double) from bb
//Print ("Widget value bb changed. Newvalue is " + newValue)
if newValue==1 then
SwitchToRackspace(1, 1)
stat =SaveStringToTextFile(filename,"1")
End
End
On WidgetValueChanged(newValue : double) from cc
//Print ("Widget value cc changed. Newvalue is " + newValue)
if newValue==1 then
SwitchToRackspace(0, 1)
stat =SaveStringToTextFile(filename,"0")
End
End
Beware, these functions are experimental according to the documentation.
Gig Performer 4. Have not upgraded yet. Was going to after the last gig in November.
Until I upgrade I think your idea of an environment variable will work. I can use the SystemEvent for GigLoaded in the gig script to set the variable and then reference that variable in the global rackspace. I can try that approach tomorrow.
Until I upgrade to Gig Performer 5 the solution that works is to set an environment variable that the global rackspace can check before allowing the code in On WidgetValueChanged to execute. Put “OnSystemEvent Matching GigLoaded” in the gig script and set the environment variable in that script.
This is working and the rackspace selection no longer moves to the 49th position after the gig is loaded.
There is a notation on environment variables may not be persistent which is why I used a text file. I was reluctant to use the environment variable due to that notation in the document. I know a 1 character text file may not be the most efficient way to store the last rackspace number but I didn’t see anything else that called out any form of persistent storage. Maybe that can be added to the list of future features. Maybe a standard variable storage file (per gig) that stores any values that you want persistent.
Right but it doesn’t need to be persistent. The gigscript gets executed first and sets the environment (aka global) variable which can then be read by other scripts.
Yes — environment variables are essentially “global” to the entire system. Note that you can also define environment variables outside Gig Performer and then reference them from GP Script