How to preselect songs while playing (TouchOSC)

There are a couple of guys here who shared how to use TouchOSC to display the setlist on an external device. Especially the ideas by @NanoMalefico and @rank13 discussed here are a good start for advanced TouchOSC templates.

My personal problem: it happens so often that we decide to skip some songs or prepone a song that was scheduled to be played later. A fast transition between songs is very important to us that’s why I had the idea to

Preselect a song and later activate it with the press of a button
While I’m playing a song, I want to preselect the desired song by tapping on its name. As soon as I press the „next song“ button (or if I tap the song for a second time) it is immediately activated.

Here’s what it looks like:

The concept behind it: The list in TouchOSC can display 100 song names. It is overlayed with 100 transparent buttons that send an index corresponding to the displayed song name.
A script checks if the received index is the same as the one already stored. In this case the song is directly activated. If not, the index is stored and the preselected song is displayed (top right).
The preselected song is then activated with the button „Song +“.

The script looks like this and is divided into three section:

  1. To deal with the received preselection indexes
  2. To deal with the received “go to next song” command
  3. To update the song indexes and names when songs are switched
var
    PreselSongIndex : Integer                                              // To store the song index received from TouchOSC
    SongSwitch : boolean = false

// 1
On OSCMessageReceived(m : OSCMessage) Matching "/SongSelect"               // When a preselection is received
    If InSetlistMode() then
        If OSC_GetArgAsInteger(m, 0) == PreselSongIndex then               // If the same song has already been preselected
            SongSwitch = SwitchToSongByIndex(PreselSongIndex,0)            // Directly switch to that song
        Else                                                               // If the song has not been preselected yet
            PreselSongIndex = OSC_GetArgAsInteger(m, 0)                    // Store the index of the preselected song
            OSC_SendString("/NextSngName/", GetSongName(PreselSongIndex))  // Send out the name the preselected Song
        End
    End
End

// 2
On OSCMessageReceived(index : Integer, m : OSCMessage) Matching "/PrevS", "/NextS", "/NextNextS"
    If OSC_GetArgAsInteger(m,0) == 1 then
        If InSetlistMode() then
            SongSwitch = SwitchToSongByIndex(PreselSongIndex,0)            // Activate the preselected Song. If no song has been preselected, the next song in the setlist is activated
        End
    End
End

// 3
On Song(oldSongIndex : integer, newSongIndex : integer)
    PreselSongIndex = newSongIndex+1                              // The next song in the setlist is automatically preselected
    OSC_SendString("/NextSngName/", GetSongName(PreselSongIndex))          // Send out the name the preselected song
    OSC_SendString("/CurSngName/", GetCurrentSongName())                   // Send out the name the current song
End

By the way: If you are looking for easy templates (but much much funcationality) look here into this blog: The Lemur and TouchOSC Templates - Gig Performer®

2 Likes

I’ve noticed that I couldn’t easily find how to make Gig Performer send out the song names of the setlist so I’ll summarize it here:

Built-in way
If you’re fine with the port and IP address defined in the global settings this script is the easiest (learned from @pianopaul some time ago. Put it into your desired callback, for example when the setlist or song changes):

    OSC_SendStringSpecific("/SetList/GetSongList","","127.0.0.1",OSC_GetGPListeningPort())

It uses the integrated OSC functions listed here: https://gigperformer.com/docs/GP4UserManual/osc-messages.html

Custom way
If you need more control over the ports, addresses, strings and so on, you can read and send the songs names this way (inside a callback) and also clear the remaining slots:

    var i : index = integer
        For i = 0; i < GetSongCount(); i = i+1 do // Sends out the song names with their index attached
            OSC_SendStringSpecific("/SongName"+i,GetSongName(i),DestinationIP, DestinationPort)
        End
        For i = GetSongCount(); i < 80; i = i+1 do // clears the empty ones at the end of up to 80 slots for example
            OSC_SendStringSpecific("/SongName"+I,"",DestinationIP, DestinationPort)
        End

Please replace “DestinationIP” and “DestinationPort” with your individual settings.

For TouchOSC see also New version of TouchOSC with scripting apparently

1 Like