Hello!
In my switch widget's onValue, please help me understand why testObj2 works when declared literally, but testObj1 (created from an osc /message) doesn't.
Since some midi messages require more than one parameter, I'm unable to just use the switch's value and need more data for the midi messages that will be sent below depending on how the keyswitches are setup in Logic Pro. (The commented out send statements are unfinished 'code sketches'. I'll flesh those out later.)
Thanks!
var oscMsg = get('switchesObjectArray')
//console.log(oscMsg)
var data = JSON.stringify(oscMsg)
//console.log(data)
var testObj1 = JSON.parse(data)
//console.log(testObj1)
var testObj2 = {1002:["Note On",0,10],1001:["Note Off",127,20],1003:["Poly Aftertouch",0,30],1004:["Controller",32,40],1005:["Program",null,50],1006:["Aftertouch",null,60],1007:["Pitch Bend",null,70],1008:["Velocity",null,80],1009:["Note On",0,90]}
//console.log(testObj2)
var typeData = testObj2[value][0]
console.log(typeData)
var g_channel = get('g_midiCh')
//console.log(g_channel)
//if typeData value is "Note On"
//send('midi:OSC-Midi', '/note', g_channel, selector, 127)
//send('midi:OSC-Midi', '/note', g_channel, selector, 0)
//if typeData value is "Note Off"
//send('midi:OSC-Midi', '/note_off', g_channel, selector, 0)
//if typeData value is "Controller"
//send('midi:OSC-Midi', '/control', g_channel, selector, valueStart)
//if typeData value is "Program"
//send('midi:OSC-Midi', '/program', g_channel, valueStart)
//if typeData value is "Pitch Bend"
//send('midi:OSC-Midi', '/pitch', g_channel, valueStart)
//if typeData value is "Aftertouch"
//send('midi:OSC-Midi', '/channel_pressure', g_channel, valueStart)
//if typeData value is "Poly Aftertouch"
//send('midi:OSC-Midi', '/key_pressure', g_channel, selector, valueStart)