Exemple #1
0
void InputOutputMap::setBlackout(bool blackout)
{
    /* Don't do blackout twice */
    if (m_blackout == blackout)
        return;

    QMutexLocker locker(&m_universeMutex);
    m_blackout = blackout;

    QByteArray zeros(512, 0);
    for (quint32 i = 0; i < universesCount(); i++)
    {
        Universe *universe = m_universeArray.at(i);
        if (universe->outputPatch() != NULL)
        {
            if (blackout == true)
                universe->outputPatch()->dump(universe->id(), zeros);
            // notify the universe listeners that some channels have changed
        }
        locker.unlock();
        if (blackout == true)
            emit universesWritten(i, zeros);
        else
        {
            const QByteArray postGM = universe->postGMValues()->mid(0, universe->usedChannels());
            emit universesWritten(i, postGM);
        }
        locker.relock();
    }

    emit blackoutChanged(m_blackout);
}
Exemple #2
0
void OutputMap::dumpUniverses()
{
    QByteArray ba;

    m_universeMutex.lock();
    if (m_universeChanged == true && m_blackout == false)
    {
        const QByteArray* postGM = m_universeArray->postGMValues();
        for (quint32 i = 0; i < m_universes; i++)
            m_patch[i]->dump(postGM->mid(i * 512, 512));

        // Grab a copy of universe values to prevent timer thread blocking
        ba = *postGM;

        m_universeChanged = false;
    }
    m_universeMutex.unlock();

    // Emit new values
    if (ba.isEmpty() == false)
        emit universesWritten(ba);
}
Exemple #3
0
void InputOutputMap::dumpUniverses()
{
    QMutexLocker locker(&m_universeMutex);
    if (m_blackout == false)
    {
        for (int i = 0; i < m_universeArray.count(); i++)
        {
            Universe *universe = m_universeArray.at(i);
            const QByteArray postGM = universe->postGMValues()->mid(0, universe->usedChannels());

            // notify the universe listeners that some channels have changed
            if (universe->hasChanged())
            {
                locker.unlock();
                emit universesWritten(i, postGM);
                locker.relock();
            }

            // this is where QLC+ sends data to the output plugins
            universe->dumpOutput(postGM);
        }
    }
}