Adding OS2L BPM as an input
Posted: Sat Dec 09, 2023 3:31 pm
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:
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).
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;
}
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).