Exemplo n.º 1
0
void EFX::write(MasterTimer* timer, QList<Universe*> universes)
{
    Q_UNUSED(timer);

    int ready = 0;

    if (isPaused())
        return;

    QListIterator <EFXFixture*> it(m_fixtures);
    while (it.hasNext() == true)
    {
        EFXFixture* ef = it.next();
        if (ef->isReady() == false)
            ef->nextStep(timer, universes);
        else
            ready++;
    }

    incrementElapsed();

    /* Check for stop condition */
    if (ready == m_fixtures.count())
        stop(FunctionParent::master());
    m_fader->write(universes);
}
Exemplo n.º 2
0
void Script::write(MasterTimer* timer, QList<Universe *> universes)
{
    incrementElapsed();

    if (stopped() == false)
    {
        if (waiting() == false)
        {
            // Not currently waiting for anything. Free to proceed to next command.
            while (m_currentCommand < m_lines.size() && stopped() == false)
            {
                bool continueLoop = executeCommand(m_currentCommand, timer, universes);
                m_currentCommand++;
                if (continueLoop == false)
                    break; // Executed command told to skip to the next cycle
            }

            // In case wait() is the last command, don't stop the script prematurely
            if (m_currentCommand >= m_lines.size() && m_waitCount == 0)
                stop();
        }

        // Handle GenericFader tasks (setltp/sethtp/setfixture)
        if (m_fader != NULL)
            m_fader->write(universes);
    }
}
Exemplo n.º 3
0
void Function_Stub::write(MasterTimer* timer, UniverseArray* universes)
{
    Q_UNUSED(timer);
    Q_UNUSED(universes);

    incrementElapsed();
    m_writeCalls++;
}
Exemplo n.º 4
0
void Chaser::write(MasterTimer* timer, UniverseArray* universes)
{
    Q_ASSERT(m_runner != NULL);

    if (m_runner->write(timer, universes) == false)
        stop();

    incrementElapsed();
}
Exemplo n.º 5
0
void Chaser::write(MasterTimer* timer, QList<Universe *> universes)
{
    if (m_useInternalRunner)
    {
        Q_ASSERT(m_runner != NULL);

        if (m_runner->write(timer, universes) == false)
            stop();
    }

    incrementElapsed();
}
Exemplo n.º 6
0
void Video::write(MasterTimer* timer, QList<Universe *> universes)
{
    Q_UNUSED(timer)
    Q_UNUSED(universes)

    incrementElapsed();
/*
    if (fadeOutSpeed() != 0)
    {
        if (getDuration() - elapsed() <= fadeOutSpeed())
            m_audio_out->setFadeOut(fadeOutSpeed());
    }
*/
}
Exemplo n.º 7
0
void RGBMatrix::write(MasterTimer* timer, QList<Universe *> universes)
{
    Q_UNUSED(timer);
    Q_UNUSED(universes);

    FixtureGroup* grp = doc()->fixtureGroup(fixtureGroup());
    if (grp == NULL)
    {
        // No fixture group to control
        stop();
        return;
    }

    // No time to do anything.
    if (duration() == 0)
        return;

    // Invalid/nonexistent script
    {
        QMutexLocker algorithmLocker(&m_algorithmMutex);
        if (m_algorithm == NULL || m_algorithm->apiVersion() == 0)
            return;

        // Get new map every time when elapsed is reset to zero
        if (elapsed() == 0)
        {
            qDebug() << "RGBMatrix stepColor:" << QString::number(m_stepColor.rgb(), 16);
            RGBMap map = m_algorithm->rgbMap(grp->size(), m_stepColor.rgb(), m_step);
            updateMapChannels(map, grp);
        }
    }

    // Run the generic fader that takes care of fading in/out individual channels
    m_fader->write(universes);

    // Increment elapsed time
    incrementElapsed();

    // Check if we need to change direction, stop completely or go to next step
    if (elapsed() >= duration())
        roundCheck(grp->size());
}
Exemplo n.º 8
0
void Collection::write(MasterTimer* timer, QList<Universe *> universes)
{
    Q_UNUSED(universes);

    if (elapsed() == 0)
    {
        Doc* doc = qobject_cast <Doc*> (parent());
        Q_ASSERT(doc != NULL);

        QMutexLocker locker(&m_functionListMutex);
        QListIterator <quint32> it(m_functions);
        while (it.hasNext() == true)
        {
            Function* function = doc->function(it.next());
            Q_ASSERT(function != NULL);

            // Append the IDs of all functions started by this collection
            // to a set so that we can track which of them are still controlled
            // by this collection which are not.
            m_runningChildren << function->id();

            // Listen to the children's stopped signals so that this collection
            // can give up its rights to stop the function later.
            connect(function, SIGNAL(stopped(quint32)),
                    this, SLOT(slotChildStopped(quint32)));

            function->adjustAttribute(getAttributeValue(Function::Intensity), Function::Intensity);
            function->start(timer, true, 0, overrideFadeInSpeed(), overrideFadeOutSpeed(), overrideDuration());
        }
    }

    incrementElapsed();

    {
        QMutexLocker locker(&m_functionListMutex);
        if (m_runningChildren.size() > 0)
          return;
    }

    stop();
}
Exemplo n.º 9
0
void EFX::write(MasterTimer* timer, QByteArray* universes)
{
	int ready = 0;

	Q_UNUSED(timer);

	QListIterator <EFXFixture*> it(m_fixtures);
	while (it.hasNext() == true)
	{
		EFXFixture* ef = it.next();
		if (ef->isReady() == false)
			ef->nextStep(universes);
		else
			ready++;
	}

	incrementElapsed();

	/* Check for stop condition */
	if (ready == m_fixtures.count())
		stop();
}
Exemplo n.º 10
0
void RGBMatrix::write(MasterTimer* timer, QList<Universe *> universes)
{
    Q_UNUSED(timer);

    {
        QMutexLocker algorithmLocker(&m_algorithmMutex);
        if (m_group == NULL)
        {
            // No fixture group to control
            stop(FunctionParent::master());
            return;
        }

        // No time to do anything.
        if (duration() == 0)
            return;

        // Invalid/nonexistent script
        if (m_algorithm == NULL || m_algorithm->apiVersion() == 0)
            return;

        if (isPaused() == false)
        {
            // Get a new map every time elapsed is reset to zero
            if (elapsed() < MasterTimer::tick())
            {
                if (tempoType() == Beats)
                    m_stepBeatDuration = beatsToTime(duration(), timer->beatTimeDuration());

                //qDebug() << "RGBMatrix step" << m_stepHandler->currentStepIndex() << ", color:" << QString::number(m_stepHandler->stepColor().rgb(), 16);
                RGBMap map = m_algorithm->rgbMap(m_group->size(), m_stepHandler->stepColor().rgb(), m_stepHandler->currentStepIndex());
                updateMapChannels(map, m_group);
            }
        }
    }

    // Run the generic fader that takes care of fading in/out individual channels
    m_fader->write(universes, isPaused());

    if (isPaused() == false)
    {
        // Increment the ms elapsed time
        incrementElapsed();

        /* Check if we need to change direction, stop completely or go to next step
         * The cases are:
         * 1- time tempo type: act normally, on ms elapsed time
         * 2- beat tempo type, beat occurred: check if the elapsed beats is a multiple of
         *    the step beat duration. If so, proceed to the next step
         * 3- beat tempo type, not beat: if the ms elapsed time reached the step beat
         *    duration in ms, and the ms time to the next beat is not less than 1/16 of
         *    the step beat duration in ms, then proceed to the next step. If the ms time to the
         *    next beat is less than 1/16 of the step beat duration in ms, then defer the step
         *    change to case #2, to resync the matrix to the next beat
         */
        if (tempoType() == Time && elapsed() >= duration())
        {
            roundCheck();
        }
        else if (tempoType() == Beats)
        {
            if (timer->isBeat())
            {
                incrementElapsedBeats();
                qDebug() << "Elapsed beats:" << elapsedBeats() << ", time elapsed:" << elapsed() << ", step time:" << m_stepBeatDuration;
                if (elapsedBeats() % duration() == 0)
                {
                    roundCheck();
                    resetElapsed();
                }
            }
            else if (elapsed() >= m_stepBeatDuration && (uint)timer->timeToNextBeat() > m_stepBeatDuration / 16)
            {
                qDebug() << "Elapsed exceeded";
                roundCheck();
            }
        }
    }
}