Script
var nbar = get('i1')
var obar = get('this')
var diff = Math.abs(nbar-obar)
if (diff<6 && nbar<obar){
send('midi:SessionKiano','/note', 7, 44, 1) // FAIL. If this is here, I get an error in the launcher console.
console.log(diff + " \(nbar smaller\)") // prints the expected value
}
When the above script runs, I get this error in the launcher console:
(ERROR) A JavaScript error occurred in the main process:
TypeError: Cannot read property '0' of undefined
at Object.send (/Applications/open-stage-control.app/Contents/Resources/app/server/src/server/osc/index.js:227:1)
... followed by these two pop-up messages:
- The connection to the server has been interrupted.
- The connection to the server has been restored.
Screenshots
What could be the problem?
Thank you!
What's the content of that widget's typeTags
property ?
No typeTags property in the inspector.
My script sits in a text
widget.
Screenshot
That's the problem, initially the widget was not intended to send any message. I'll add the missing property in next release, meanwhile you can use another widget to send the message.
1 Like
I didn't add the property but allowed widgets without typeTags to send.
1 Like
This is a really nice feature, because the text
widgets displaying the played bar number (in my json session, namely) will be able to send MIDI messages every time they receive a different value. Good job!
I wonder if this would also be possible (see screenshot below):
(i.e. to have different MIDI ports in the same text
widget)
Inspector screenshot (osc and scripting properties)
If not, please, please, please, make it possible!
It is, or maybe am I not fully understanding use case ?
1 Like
In O-S-C v1.10.3
, every time my text
widget gets a new value (through SKiano-C
port), the script execution should send a MIDI message to SessionKiano
(which doesn't happen). But I guess that by saying "it is", you meant: it's possible with other widgets..
Oh, no it's not possible and it's by design, widgets never send any messages in response to incoming messages. You need to use a custom module if you want to do that.
https://openstagecontrol.ammd.net/docs/custom-module/examples/#reply
1 Like
Everytime I ask for help I'm doing it with the hope that I won't be needing a custom module...
Now I'll have the "you need a custom module" nightmare