예제 #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);
}
예제 #2
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);
        }
    }
}