void InputOutputMap::setBlackout(bool blackout) { /* Don't do blackout twice */ if (m_blackout == blackout) return; m_blackout = blackout; if (blackout == true) { QByteArray zeros(512, 0); for (quint32 i = 0; i < universes(); i++) { Universe *universe = m_universeArray.at(i); if (universe->outputPatch() != NULL) universe->outputPatch()->dump(universe->id(), zeros); } } else { /* Force writing of values back to the plugins */ m_universeChanged = true; } emit blackoutChanged(m_blackout); }
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); }
bool InputOutputMap::removeUniverse(int index) { QMutexLocker locker(&m_universeMutex); if (index < 0 || index >= m_universeArray.count()) return false; Universe *delUni = m_universeArray.takeAt(index); quint32 id = delUni->id(); delete delUni; if (m_universeArray.count() == 0) m_latestUniverseId = invalidUniverse(); locker.unlock(); emit universeRemoved(id); return true; }