Is there a “SongPart” version of the GetVariationNameForRackspaceAtIndex and also GetVariationCountForRackspaceAtIndex?
I’m writing a script that gets called on Gig load or on Setlist load. It loops through all songs and gets all Song names along with all Song Part names. It sends this as MIDI SysEx messages to my custom midi controller pedalboard to setup my button screens.
Right now it seems the only way to collect all this data is actually set the active song and then get current song part names. Is there a way to do this without forcing Gig Performer to set each song as the current song in the loop? My Songs are rather CPU intense so it takes a lot of CPU power to loop through all songs quickly to gather this information!
function SendAllDataToPedalboard()
Var // Local variables for SendAllDataToPedalboard
originalGPSongIndex : integer;
originalGPSongPartIndex : integer;
gpSongCount : integer;
pedalboardSongIndex : integer;
gpSongPartCountForCurrentIteratedSong : integer;
i_song : integer;
i_part : integer;
songName : string;
partName : string;
switchSuccess : boolean; // Dummy variable to "consume" the return value
// End Var
// Begin
Print("GP: Starting SendAllDataToPedalboard...")
originalGPSongIndex = GetCurrentSongIndex()
originalGPSongPartIndex = GetCurrentSongPartIndex()
gpSongCount = GetSongCount()
For i_song = 0; i_song < gpSongCount; i_song = i_song + 1 Do
if i_song < 25 then
pedalboardSongIndex = i_song
Print("GP: Switching to song index " + IntToString(i_song) + " to get its data...")
// Assign the result of SwitchToSongByIndex to the dummy variable
switchSuccess = SwitchToSongByIndex(i_song, 0)
// You could optionally check switchSuccess here if needed, e.g.:
// If not switchSuccess then Print("Warning: Failed to switch to song " + IntToString(i_song)) End
Sleep(1000)
songName = GetSongName(i_song)
If songName <> "" Then
SendTextAsSysex(ToPedalBoard, CMD_SET_SONG_NAME_HEX, pedalboardSongIndex, 0, songName)
Else
SendTextAsSysex(ToPedalBoard, CMD_SET_SONG_NAME_HEX, pedalboardSongIndex, 0, "Song " + IntToString(pedalboardSongIndex + 1) )
End
gpSongPartCountForCurrentIteratedSong = GetSongPartCount()
For i_part = 0; i_part < 6; i_part = i_part + 1 Do
if i_part < gpSongPartCountForCurrentIteratedSong then
partName = GetSongPartName(i_part)
If partName <> "" Then
SendTextAsSysex(ToPedalBoard, CMD_SET_BUTTON_NAME_HEX, pedalboardSongIndex, i_part, partName)
Else
SendTextAsSysex(ToPedalBoard, CMD_SET_BUTTON_NAME_HEX, pedalboardSongIndex, i_part, " ")
End
else
SendTextAsSysex(ToPedalBoard, CMD_SET_BUTTON_NAME_HEX, pedalboardSongIndex, i_part, " ")
End
End
else
//break
End
End
Print("GP: Restoring original song index " + IntToString(originalGPSongIndex) + ", part " + IntToString(originalGPSongPartIndex))
if originalGPSongIndex >= 0 then
// Assign the result of SwitchToSongByIndex to the dummy variable here too
switchSuccess = SwitchToSongByIndex(originalGPSongIndex, originalGPSongPartIndex)
Sleep(50)
End
Print("GP: Finished SendAllDataToPedalboard.")
End
// --- System Event Callbacks (remain the same) ---
On SystemEvent Matching GigLoaded
Print("GP: GigLoaded event triggered.")
SendAllDataToPedalboard()
End
On SystemEvent Matching SetlistChanged
Print("GP: SetlistChanged event triggered. New setlist index: ")
SendAllDataToPedalboard()
End