Page 1 of 1

OSC Plugin - Sending OSC Path

Posted: Thu Apr 06, 2023 5:44 pm
by sbenejam
I'm testing some OSC controllers like TouchOSC and recently Open Stage Control. I think I discovered a bug in the OSC Plugin - Profile Editor. Tested on Ubuntu 22.04 with QLC+4.12.7-GIT and the QLC+5 Test version.

If an OSC path includes the character '_' in the first elements of the path they are sent correctly, if the final part of the path is for example button_1 which includes the character "_" is sent only /button.

OSC path:
/button_1 /button is received in controller
/tab_1/button_1 is converted to /tab_1/button
/Main_1/tab_1/button_1 is converted to /Main_1/tab_1/button
Renaming /button_1 to /button1 sends /button1

I don't have any problem using for example button1 instead of button_1 but Open Stage Control when you inserts a button or a slider automatically assigns button_1, button_2, fader_1, fader_2.
QLC+ Plugin Profile editor creates the correct path that received from the OSC Controller when creating a profile, but when QLC+ sends the path does not send characters from the '_' character.

Re: OSC Plugin - Sending OSC Path

Posted: Fri Apr 07, 2023 7:25 am
by sbenejam
I found this

Code: Select all

    if (path.length() > 2 && path.at(path.length() - 2) == '_')
in osccontroller.cpp at line 306. I made a quick test changing '_' to ' '. It seems that QLC+ is sending now the correct OSC path for /button_1 or /fader_1. But I don't know if this change can affect others parts of the OSC Plugin, it seems that part of code is for "multiple value paths".

https://github.com/mcallegari/qlcplus/b ... #L305-L341

Code: Select all

    // multiple value path
    if (path.length() > 2 && path.at(path.length() - 2) == '_')
    {
        int valIdx = QString(path.at(path.length() - 1)).toInt();
        path.chop(2);
        if (m_universeMap[universe].multipartCache.contains(path) == false)
        {
            qDebug() << "[OSC] Multi-value path NOT in cache. Allocating default.";
            m_universeMap[universe].multipartCache[path] = QByteArray((int)2, (char)0);
        }


        values = m_universeMap[universe].multipartCache[path];
        if (values.length() <= valIdx)
            values.resize(valIdx + 1);
        values[valIdx] = (char)value;
        m_universeMap[universe].multipartCache[path] = values;


        //qDebug() << "Values to send:" << QString::number((uchar)values.at(0)) <<
        //            QString::number((uchar)values.at(1)) << values.length();
    }
    else
        values.append((char)value); // single value path


    QString pTypes;
    pTypes.fill('f', values.length());


    m_packetizer->setupOSCGeneric(oscPacket, path, pTypes, values);
    qint64 sent = m_outputSocket->writeDatagram(oscPacket.data(), oscPacket.size(),
                                             outAddress, outPort);
    if (sent < 0)
    {
        qDebug() << "[OSC] sendDmx failed. Errno: " << m_outputSocket->error();
        qDebug() << "Errmgs: " << m_outputSocket->errorString();
    }
    else
        m_packetSent++;
}

Re: OSC Plugin - Sending OSC Path

Posted: Fri Apr 07, 2023 9:22 am
by mcallegari
I need to read the code again, but I think some controllers use that syntax to handle mutlple values at once.
In particular I think that was TouchOSC XY pad

Re: OSC Plugin - Sending OSC Path

Posted: Fri Apr 07, 2023 12:54 pm
by mcallegari

Re: OSC Plugin - Sending OSC Path

Posted: Fri Apr 07, 2023 2:46 pm
by sbenejam
You are right. I just tested an XY pad with TouchOSC Mk2 and seems that XY pad is using 2 parameters. For my tests with Open Stage Control I can rename the widgets no problem. I have to test XY widgets in Open Stage Control, the buttons, faders and other widgets seems to work very similar as TouchOSC.