Ejemplo n.º 1
0
void RGBMatrix::preRun(MasterTimer* timer)
{
    Q_UNUSED(timer);

    {
        QMutexLocker algorithmLocker(&m_algorithmMutex);

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

        if (m_algorithm != NULL)
        {
            Q_ASSERT(m_fader == NULL);
            m_fader = new GenericFader(doc());
            m_fader->adjustIntensity(getAttributeValue(Intensity));
            m_fader->setBlendMode(blendMode());

            // Copy direction from parent class direction
            m_direction = direction();

            if (m_direction == Forward)
            {
                m_step = 0;
                m_stepColor = m_startColor.rgb();
            }
            else
            {
                m_step = m_algorithm->rgbMapStepCount(m_group->size()) - 1;
                if (m_endColor.isValid())
                {
                    m_stepColor = m_endColor.rgb();
                }
                else
                {
                    m_stepColor = m_startColor.rgb();
                }
            }
            calculateColorDelta();
            if (m_algorithm->type() == RGBAlgorithm::Script)
            {
                RGBScript *script = static_cast<RGBScript*> (m_algorithm);
                QHashIterator<QString, QString> it(m_properties);
                while(it.hasNext())
                {
                    it.next();
                    script->setProperty(it.key(), it.value());
                }
            }
        }
    }

    m_roundTime->start();

    Function::preRun(timer);
}
Ejemplo n.º 2
0
void RGBMatrix::preRun(MasterTimer* timer)
{
    Q_UNUSED(timer);

    FixtureGroup* grp = doc()->fixtureGroup(fixtureGroup());
    {
        QMutexLocker algorithmLocker(&m_algorithmMutex);
        if (grp != NULL && m_algorithm != NULL)
        {
            m_direction = direction();

            Q_ASSERT(m_fader == NULL);
            m_fader = new GenericFader(doc());
            m_fader->adjustIntensity(getAttributeValue(Intensity));

            if (m_direction == Forward)
            {
                m_step = 0;
                m_stepColor = m_startColor.rgb();
            }
            else
            {
                m_step = m_algorithm->rgbMapStepCount(grp->size()) - 1;
                if (m_endColor.isValid())
                {
                    m_stepColor = m_endColor.rgb();
                }
                else
                {
                    m_stepColor = m_startColor.rgb();
                }
            }
            calculateColorDelta();
        }
    }

    m_roundTime->start();

    Function::preRun(timer);
}