I found a problem with multi instances sending the same named OSC Messages.
The workaround I used may be of some use to others.
My code is a mixture of my own ideas and excellent posts by others in this forum.
I’m hoping at some point the prefix could be built into the OSC messages as an option on the osc setup and all this front end code would be redundant.
In my case each Instance sends to the same client and i’m using pager controls to page through guitar vocals keys effects etc.
Each instance listens on a different port on the same Macmini M1. eg 4500, 45100,45200 etc.
i’m sending all the songs everytime a song changes as I’m only holding 10 songs per setlist as everything is being controlled by a softstep2.
I’ve done this with a different const for each instance, naturally the GP instance needs to be in setlist mode for this to work.
GLOBAL RACKSPACE
const myInst : string = “Guitar_”
//------------- songlist and song ------------
var
sCnt : integer = 0
sIdx :integer = 0
var myMessage :String
On Song(oldSongIndex : Integer, newSongIndex : Integer)
//-- send songnames -----
sCnt = GetSongCount()
// send current songCount
myMessage = “/” + myInst + “SongCount”
OSC_SendInteger(myMessage ,sCnt)
// send Start of list
myMessage = “/” + myInst + “SongListStart”
OSC_SendString(myMessage ,“Start”)
// send songlist
For sIdx = 0; sIdx < sCnt;sIdx = sIdx + 1 Do
// send current songno
myMessage = “/” + myInst + “Song” + sIdx
OSC_SendString(myMessage ,GetSongName(sIdx))
End
// send current songname
myMessage = “/” + myInst + “SongName”
OSC_SendString(myMessage ,GetSongName(newSongIndex))
// send current songno
myMessage = “/” + myInst + “SongNo”
OSC_SendInteger(myMessage ,newSongIndex)
// send Start of list
myMessage = “/” + myInst + “SongListEnd”
OSC_SendString(myMessage ,“Done”)
End
on the touch OSC Scripts Ive done the following
– note this code is stored in the document root
– the osc SongList will be sent
– each time a song changes
– from the GP globalscript with Guitar_ Vocal_ Keys_
sCnt = 0 – song count
sNo = 0 – Current song number
gNames = {} – aray to hold names
vCnt = 0 – vocals count
vNo = 0 – vocals song no
vNames = {} – vocals songnames
kCnt = 0 – Keys count
kNo = 0 – Keys song no
kNames = {} – Keys songnames
function onReceiveOSC(message, connections)
local path = message[1]
local arguments = message[2]
– Guitar clear names table
if path == ‘/Guitar_SongListStart’ then
for i=1, 10,1 do
gNames[i] = “----”
i=i+1
end
end
– Guitar store and display number of songs in setlist
if path == ‘/Guitar_SongCount’ then
sCnt = tonumber(arguments[1].value)
– Store the song count in a label
self.children[‘lblSongCount’].values.text = tostring(sCnt)
end --endif
– Guitar Store and Display Curr song number
if path == ‘/Guitar_SongNo’ then
sNo = arguments[1].value
self.children[‘lblCurrSongNo’].values.text = tostring(sNo)
end
– if songlist name store
if string.find(path, ‘/Guitar_Song%d+’) then
local sNumber = tonumber(string.match(path, ‘%d+’))
gNames[sNumber] = arguments[1].value
end
– send names to labels in songs
if path == ‘/Guitar_SongListEnd’ then
– send current name to Guitar Pager
print(‘sno at sng end is now=’,sNo)
self.children.pager1.children.GT.children.grpSongList.children[‘lblCurrentSongName’].values.text = gNames[sNo]
self.children.pager1.children.GT.children.grpSongList.children[‘lblSongNo’].values.text = sNo
self.children.pager1.children.GT.children.grpSongList.children[‘lblSongCount’].values.text = sCnt
for i=0, 9,1 do
– need to set names in Songs group
print (‘sNumber’,i,’ sName’,gNames[i])
self.children.pager1.children.GT.children.grpSongList.children.Songs.children[‘SongName’.. tostring(i)].values.text = gNames[i]
i=i+1
end
end
– %%%%%%%%%%%%%%%% Vocal%%%%%%%%%%%%%%%%%%%%%–
– vocals names clear
if path == ‘/Vocal_SongListStart’ then
for i=1, 10,1 do
vNames[i] = “----”
i=i+1
end
end
– Vocal store and display number of songs in setlist
if path == ‘/Vocal_SongCount’ then
vCnt = tonumber(arguments[1].value)
– Store the song count in a label
self.children[‘lblVSongCount’].values.text = tostring(vCnt)
end --endif
– Vocal Store and Display Curr song number
if path == ‘/Vocal_SongNo’ then
vNo = arguments[1].value
self.children[‘lblVCurrSongNo’].values.text = tostring(vNo)
end
– if vocal songlist name store
if string.find(path, ‘/Vocal_Song%d+’) then
local sNumber = tonumber(string.match(path, ‘%d+’))
vNames[sNumber] = arguments[1].value
end
– vocal send names to labels in songs
if path == ‘/Vocal_SongListEnd’ then
– send current name to Guitar Pager
self.children.pager1.children.VOC.children.grpSongList.children[‘lblvCurrentSongName’].values.text = vNames[vNo]
self.children.pager1.children.VOC.children.grpSongList.children[‘lblvSongNo’].values.text = vNo
self.children.pager1.children.VOC.children.grpSongList.children[‘lblvSongCount’].values.text = vCnt
for i=0, 9,1 do
– need to set names in Songs group
self.children.pager1.children.VOC.children.grpSongList.children.Songs.children[‘SongName’.. tostring(i)].values.text = vNames[i]
i=i+1
end
end
end – end of function