Example #1
0
bool FadeChannel::canFade(const Doc* doc) const
{
    bool cFade = true;

    if (fixture() != Fixture::invalidId())
    {
        Fixture* fxi = doc->fixture(fixture());
        if (fxi != NULL)
            cFade = fxi->channelCanFade(channel());
    }
    return cFade;
}
Example #2
0
void RGBMatrix::postRun(MasterTimer* timer, QList<Universe *> universes)
{
    if (m_fader != NULL)
    {
        QHashIterator <FadeChannel,FadeChannel> it(m_fader->channels());
        while (it.hasNext() == true)
        {
            it.next();
            FadeChannel fc = it.value();
            // fade out only intensity channels
            if (fc.group(doc()) != QLCChannel::Intensity)
                continue;

            bool canFade = true;
            Fixture *fixture = doc()->fixture(fc.fixture());
            if (fixture != NULL)
                canFade = fixture->channelCanFade(fc.channel());
            fc.setStart(fc.current(getAttributeValue(Intensity)));
            fc.setCurrent(fc.current(getAttributeValue(Intensity)));

            fc.setElapsed(0);
            fc.setReady(false);
            if (canFade == false)
            {
                fc.setFadeTime(0);
                fc.setTarget(fc.current(getAttributeValue(Intensity)));
            }
            else
            {
                if (overrideFadeOutSpeed() == defaultSpeed())
                    fc.setFadeTime(fadeOutSpeed());
                else
                    fc.setFadeTime(overrideFadeOutSpeed());
                fc.setTarget(0);
            }
            timer->faderAdd(fc);
        }

        delete m_fader;
        m_fader = NULL;
    }

    {
        QMutexLocker algorithmLocker(&m_algorithmMutex);
        if (m_algorithm != NULL)
            m_algorithm->postRun();
    }

    Function::postRun(timer, universes);
}
Example #3
0
void MasterTimer::fadeAndStopAll(int timeout)
{
    if (timeout == 0)
        return;

    Doc* doc = qobject_cast<Doc*> (parent());
    Q_ASSERT(doc != NULL);

    QList<FadeChannel> fcList;

    QList<Universe *> universes = doc->inputOutputMap()->claimUniverses();
    for (int i = 0; i < universes.count(); i++)
    {
        QHashIterator <int,uchar> it(universes[i]->intensityChannels());
        while (it.hasNext() == true)
        {
            it.next();

            Fixture* fxi = doc->fixture(doc->fixtureForAddress(it.key()));
            if (fxi != NULL)
            {
                uint ch = it.key() - fxi->universeAddress();
                if (fxi->channelCanFade(ch))
                {
                    FadeChannel fc(doc, fxi->id(), ch);
                    fc.setStart(it.value());
                    fc.setTarget(0);
                    fc.setFadeTime(timeout);
                    fcList.append(fc);
                }
            }
        }
    }
    doc->inputOutputMap()->releaseUniverses();

    // Stop all functions first
    stopAllFunctions();

    // Instruct mastertimer to do a fade out of all
    // the intensity channels that can fade
    QMutexLocker faderLocker(&m_faderMutex);
    foreach(FadeChannel fade, fcList)
        fader()->add(fade);
}