Mapping an OSC message to a specific scene

Ask a generic question about the usage of QLC+, not related to a particular operating system
Post Reply
padide
Posts: 5
Joined: Wed Feb 15, 2017 2:06 pm
Real Name:

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
padide
Posts: 5
Joined: Wed Feb 15, 2017 2:06 pm
Real Name:

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...
siegmund
Posts: 703
Joined: Mon Nov 02, 2015 11:03 am
Location: Germany
Real Name: Lukas

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
padide
Posts: 5
Joined: Wed Feb 15, 2017 2:06 pm
Real Name:

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
janosvitok
Posts: 1266
Joined: Mon Apr 13, 2015 7:05 am
Location: Bratislava, Slovakia
Real Name: Jano Svitok
Contact:

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)
kenm
Posts: 10
Joined: Thu Jan 26, 2017 11:47 pm
Location: San Jose, CA, USA
Real Name: Ken Mitchell

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
janosvitok
Posts: 1266
Joined: Mon Apr 13, 2015 7:05 am
Location: Bratislava, Slovakia
Real Name: Jano Svitok
Contact:

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
kenm
Posts: 10
Joined: Thu Jan 26, 2017 11:47 pm
Location: San Jose, CA, USA
Real Name: Ken Mitchell

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
janosvitok
Posts: 1266
Joined: Mon Apr 13, 2015 7:05 am
Location: Bratislava, Slovakia
Real Name: Jano Svitok
Contact:

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
padide
Posts: 5
Joined: Wed Feb 15, 2017 2:06 pm
Real Name:

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 :-)
padide
Posts: 5
Joined: Wed Feb 15, 2017 2:06 pm
Real Name:

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
janosvitok
Posts: 1266
Joined: Mon Apr 13, 2015 7:05 am
Location: Bratislava, Slovakia
Real Name: Jano Svitok
Contact:

Great!

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

Jano
User avatar
mcallegari
Posts: 4462
Joined: Sun Apr 12, 2015 9:09 am
Location: Italy
Real Name: Massimo Callegari
Contact:

I've implemented the channel calculation in the OSC plugin configuration dialog
Post Reply