Page 1 of 1

Adding OS2L BPM as an input

Posted: Sat Dec 09, 2023 3:31 pm
by juski
Hi everyone.
This isn't a feature request (I promise) - I'm playing with the QLC+ source & trying to get OS2L BPM emitted so I can use that as an input to a speed dial.

In os2lplugin.cpp I changed things from around line 256 to this:

Code: Select all

 else if (event == "beat")
    {
       qDebug() << "Got beat message" << message;
       //emit valueChanged(m_inputUniverse, 0, 8341, 255, "beat");
	   QJsonValue jBpm = jsonObj.value("bpm");
	   int tempoMs = (60000 / jBpm.toDouble());
	   emit valueChanged(m_inputUniverse, 0, 15901, tempoMs );
	   qDebug() << "bpm " << jBpm << " ms " << tempoMs;
    }
    
The debug is outputting the correct ms value for the BPM sent via OS2L but when I try to use this as a speed dial input it's really messing up the value. 500ms is ending up at a value that has nothing to do with the number 500.

There's a side issue too that I had to comment out the first emit valueChanged or the tempoMs emit wasn't happening but I can handle that later. If we can only have one emit valueChanged I'll have to code it to be a setting (so we can have either OS2L 'beat' or 'bpm' working).

So my question is: what format does the channel value have to be to work in this context?

Edit: I've looked up the definition of the VCSpeedDial::slotInputValueChanged void & the value is a uchar? As in unsigned char - basically a byte.. (0-255).. ugh so I guess this isn't gonna be a thing then. Well not without extending the functionality to accept a wider range input (eg one channel for MSB & another for LSB).

Re: Adding OS2L BPM as an input

Posted: Sat Dec 09, 2023 4:36 pm
by juski
Hmmm I *could* patch everything else to use an int or other type instead, but I don't want this that badly. Using 'beat' on a tap button works fine anyway!

Re: Adding OS2L BPM as an input

Posted: Mon Dec 11, 2023 9:37 am
by Wazzledi
I did not work with OS2L particularly, but I accomplished to get the BPM in the speed dial by osc. I had the same problem with getting ms values into it. Even if there exists the ms precision checkbox, it seems that this does not have any effect.
I had to send the bpm value as seconds. So instead of dividing 60000 by the bpm. Just divide 60 by the bpm to get seconds.
Finally, i rounded the value to 3 decimal places.

Maybe this will work for you too. Good luck!