jean-emmanuel / open-stage-control

Libre and modular OSC / MIDI controller
https://openstagecontrol.ammd.net
GNU General Public License v3.0
702 stars 88 forks source link

OSC{} color receive not entering in widget #623

Closed RBasile closed 4 years ago

RBasile commented 4 years ago

Open stage control is receving the color corectly as shown in the debug but not the in the widget image

version 0.49.12 and version 1.0.0-alpha16 windows 10 built-in client

Maybe I done something wrong with the OSC{}

jean-emmanuel commented 4 years ago

Hi, Open Stage Control receives osc color arguments as objects ({r: 168, g: 40, b: 40, a: 0 }) but the widgets are not expecting data formatted this way, for instance the led widget expects an array ([168, 40, 40, 0]) or a string ("#a02828") (see reference). Sending the color formatted either way will do the trick, but you can also convert the object manually in Open Stage Control:

JS{{
var color = OSC{/r}
return [color.r, color.g, color.b, color.a] // skip color.a to ignore alpha
}}

Note that if you choose to send the data as something the widget can read directly, you don't need the OSC{} syntax at all and can use its own osc address.

RBasile commented 4 years ago

I get this error when trying to get the argument of var color.

rgbled_1.value: JS{{}} error:
TypeError: Cannot read property 'r' of undefined at line 1

If I made a OR like var color = OSC{/r} || { r: 255, g: 255, b: 255, a: 1 }; the OSC{/r} seem to always be undefined

jean-emmanuel commented 4 years ago

It seems to work with v1, can you paste the value property's content here ? Also note that the widget's preArgs must be matched to feed the osc listener unless the appropriatie flag is set (https://openstagecontrol.ammd.net/docs/widgets/advanced-syntaxes/#osc-listeners-oscaddress-default-usepreargs)

RBasile commented 4 years ago

It's the same with the v1 for me Here my content of the "value property"

JS{{
var color = OSC{/r} || { r: 255, g: 255, b: 255, a: 1 };
return [color.r, color.g, color.b, color.a] // skip color.a to ignore alpha
}}

I don't have any prearg

If i use this:

JS{{
var color = OSC{/r} || { r: 255, g: 255, b: 255, a: 1 };
console.log("hello");
console.log(color);
return [color.r, color.g, color.b, color.a] // skip color.a to ignore alpha
}}

and sent some integer I have the "hello" and the number in the console but when receiving color I don't

My test file Color.json.txt

jean-emmanuel commented 4 years ago

It should be fixed in sources now.

jean-emmanuel commented 4 years ago

Included in alpha 18, osc color arguments are now properly received by osc listeners.

RBasile commented 4 years ago

Thanks it's working for me