Page 1 of 1

Mapping an OSC message to a specific scene

Posted: Wed Feb 15, 2017 2:44 pm
by padide
Hi all, I want to control QLC+ from a custom app that I'm coding.

My need is to map an incoming OSC message to a specific scene. Eg. /play/S23 would play the scene named S23 (including time in & time out)
I really don't know if it's possible with QLC+ (seems not)

I've already created my own OSC profile and tried different things in the virtual console (chasers), but nothing seems to be available to achieve what I want.

Is it possible ? Is QLC+ javascript scriptable for that matter of things ?

Thanks

Re: Mapping an OSC message to a specific scene

Posted: Wed Feb 15, 2017 3:23 pm
by padide
I answer my self
- edit profile channels to include all the possible osc messages (use wizard only, manually selected channels numbers won't work in my case)
- in virtual console, create one button for each scene, link each button to the according scene
- for each button, map the external input to one of the osc messages defined in step 1

Run and enjoy...

Re: Mapping an OSC message to a specific scene

Posted: Wed Feb 15, 2017 3:35 pm
by siegmund
Welcome to the forum!

The easiest way would be to place a button in the virtual console and assign your scene to it. Then assign the desired OSC message as external input for the button.

Regards,
siegmund

Re: Mapping an OSC message to a specific scene

Posted: Wed Feb 15, 2017 5:08 pm
by padide
Thanks for your answer sigmund found the same solution than the one you provided to me ;-)

Are you aware of any possibility to typein the osc messages in profile channels instead of using the wizard ? So far I didn't succeed without the wizard which is bit tedious because I have to manually send the messages from my app, one by one...

I tried, used self decided channels numbers but that does not works

Re: Mapping an OSC message to a specific scene

Posted: Wed Feb 15, 2017 5:39 pm
by janosvitok
You can open the profile in a text editor, and create the channels yourself.
The number is CRC of the path in utf8 computed by http://doc.qt.io/qt-5/qbytearray.html#qChecksum (the source code of the function is here: http://code.qt.io/cgit/qt/qtbase.git/tr ... y.cpp#n550)

Re: Mapping an OSC message to a specific scene

Posted: Wed Feb 15, 2017 6:09 pm
by kenm
Hi,

If you have access to and are familiar with python you can install pythonosc and use the osc-msg.py sample script to quickly send all of your required messages to the input profile wizard. For buttons you can just send a single message with any value but if you want the wizard to define the input as a slider you have to send three or more messages with ascending or descending values. I just generated an input profile with almost 500 messages and it took about 20 minutes.

Hope this helps,
Ken

Re: Mapping an OSC message to a specific scene

Posted: Wed Feb 15, 2017 9:41 pm
by janosvitok
If you can use python, I am sure you can tweak some crc function to produce correct results, and create the input profile XML directly -- it will be much faster.
Nevertheless, your method is more robust.

Jano

Re: Mapping an OSC message to a specific scene

Posted: Thu Feb 16, 2017 5:15 pm
by kenm
Hi Jano,

While that is true I would not recommend that method unless the XML format of the input profile is published and version checked. I've not seen a published file spec for QLC+'s files even though they are in XML format. Generating configuration files using an external tool and thus bypassing the actual QLC+ generation code could result in invalid, or worse, misinterpreted data and strange program behavior that may be difficult to diagnose.

I did notice a fixture definition validator on the website front page that I think is a good idea. I wonder what it would take to create an input profile validator?

--Ken

Re: Mapping an OSC message to a specific scene

Posted: Thu Feb 16, 2017 6:25 pm
by janosvitok
I've created XML schemas for the profiles, that you can use for a simple validator. It is not too detailed, though.
I update them from time to time. They are not versioned.

See https://github.com/mcallegari/qlcplus/t ... es/schemas
There is even a script to check all input profiles (https://github.com/mcallegari/qlcplus/b ... iles/check), although partly I use it to verify whether the schema is still valid... :)

I agree that creating directly from QLC+ is preferred method. Nevertheless, when you create 500 channels, you may let QLC+ create let's say 10, and then the rest generate by a script, using those first 10 as a template.
I'm not sure what's faster... :)

Jano

Re: Mapping an OSC message to a specific scene

Posted: Fri Feb 17, 2017 10:08 am
by padide
Finally, the easiest solution was to add 10 lines of code in my app to send all the current osc messages to QLC+ while in wizard mode
Then when new scenes will be added to my app, I just have to redo the same process. Easy :-)

Re: Mapping an OSC message to a specific scene

Posted: Fri Mar 10, 2017 5:13 pm
by padide
And yet I've changed my mind, editing the XML profile directly is really easier.

So, I used Ruby for this, it was as simple as

Code: Select all

gem install digest-crc
and a 8 lines script

Code: Select all

require 'digest/crc16_qt'
dig = Digest::CRC16QT.new
dig << ARGV[0]
crc = dig.checksum
puts %[ <Channel Number="#{crc}">]
puts %[  <Name>#{ARGV[0]}</Name>]
puts %[  <Type>Button</Type>]
puts " </Channel>"
usable as ruby ./crc.rb /myoscmessage

Re: Mapping an OSC message to a specific scene

Posted: Fri Mar 10, 2017 9:18 pm
by janosvitok
Great!

I've added your code to the online documentation (https://github.com/mcallegari/qlcplus/c ... 2de0cb8e03).

Jano

Re: Mapping an OSC message to a specific scene

Posted: Sat Mar 11, 2017 9:30 am
by mcallegari
I've implemented the channel calculation in the OSC plugin configuration dialog