New version of TouchOSC with scripting apparently

I tried to replicate what I did in Open Stage Control. TouchOSC doesn’t have anywhere near the formatting options that Open Stage Control has, but I was able to get the core template replicated.
One thing was that I don’t think TouchOSC can have a scrollable page, so a long song list would have to be split between different pages/tabs.

GP-Setlist.tosc.zip (5.3 KB)

For the scripters, below is an example of the global script I used to manage things like calculating the song counts and song part counts.

-- Callback when an OSC message is received
function onReceiveOSC(message, connections)
  
  -- Parse the OSC message
  local path = message[1]
  local arguments = message[2]
  
  -- If the setlist changes in GP, request the new song list
  if path == '/SetListChanged' then
    sendOSC('/SetList/GetSongList')
  end
  
  -- Use LUA string functions to extract the song number
  -- from the GP SongName message e.g. /SongName9
  -- The last message received will provide the total song count
  if string.find(path, '/SongName') then
    local songCount = tonumber(string.match(path, '%d+')) + 1
    
    -- Store the song count in a label
    self.children['SongCount'].values.text = tostring(songCount)
  end
  
  -- Get the currently selected song number and store in a label
  if path == '/CurrentSongIndex' then
    local song =  arguments[1].value + 1
    
    -- Rather than set the label directly, you can also trigger
    -- a callback for the label and pass it the song count.
    -- There is a small script in the CurrentSong label to handle this.
    self.notify(self.children['CurrentSong'], tostring(song))
  end
  
  -- Once the last song name has been received (and total count 
  -- is calculated), hide any song labels that aren't required.
  if path == '/SongListEnd' then
    local songCount = tonumber(self.children['SongCount'].values.text)
    
    -- Iterate through all the song labels in the 'songs' group
    -- and set the visibility property. Adding similar controls
    -- to a 'Group' gives them an index, which is useful for processing.
    for i = 1, #self.children['songs'].children do
      self.children['songs'].children[i].visible = (i <= songCount)
    end
  end
  
  -- Similar to the song count, use LUA string functions to extract
  -- the song part number and store in a hidden label.
  if string.find(path, '/SongPart%d+') then
    local partCount = tonumber(string.match(path, '%d+')) + 1
    self.children['SongPartCount'].values.text = tostring(partCount)
  end
  
  -- Once the last song part message is received (and total song part
  -- is calculated), hide any song part labels that aren't required.
  if path == '/SongPartsEnd' then
    local partCount = tonumber(self.children['SongPartCount'].values.text)
    
    -- Iterate through all the song part labels in the 'SongParts' group
    -- and set the visibility property.
    for i = 1, #self.children['SongParts'].children do
      self.children['SongParts'].children[i].visible = (i <= partCount)
    end
  end
end

Oh, and @pianopaul I noticed that they’ve now added Gig Performer to their list of apps :slight_smile:

4 Likes