本文整理汇总了C++中FadeChannel::setReady方法的典型用法代码示例。如果您正苦于以下问题:C++ FadeChannel::setReady方法的具体用法?C++ FadeChannel::setReady怎么用?C++ FadeChannel::setReady使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FadeChannel
的用法示例。
在下文中一共展示了FadeChannel::setReady方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switchCue
void CueStack::switchCue(int from, int to, const QList<Universe *> ua)
{
qDebug() << Q_FUNC_INFO;
Cue newCue;
Cue oldCue;
m_mutex.lock();
if (to >= 0 && to < m_cues.size())
newCue = m_cues[to];
if (from >= 0 && from < m_cues.size())
oldCue = m_cues[from];
m_mutex.unlock();
// Fade out the HTP channels of the previous cue
QHashIterator <uint,uchar> oldit(oldCue.values());
while (oldit.hasNext() == true)
{
oldit.next();
FadeChannel fc;
fc.setFixture(doc(), Fixture::invalidId());
fc.setChannel(oldit.key());
if (fc.group(doc()) == QLCChannel::Intensity)
{
fc.setElapsed(0);
fc.setReady(false);
fc.setTarget(0);
fc.setFadeTime(oldCue.fadeOutSpeed());
insertStartValue(fc, ua);
m_fader->add(fc);
}
}
// Fade in all channels of the new cue
QHashIterator <uint,uchar> newit(newCue.values());
while (newit.hasNext() == true)
{
newit.next();
FadeChannel fc;
fc.setFixture(doc(), Fixture::invalidId());
fc.setChannel(newit.key());
fc.setTarget(newit.value());
fc.setElapsed(0);
fc.setReady(false);
fc.setFadeTime(newCue.fadeInSpeed());
insertStartValue(fc, ua);
m_fader->add(fc);
}
}
示例2: postRun
void CueStack::postRun(MasterTimer* timer)
{
qDebug() << Q_FUNC_INFO;
Q_ASSERT(timer != NULL);
Q_ASSERT(m_fader != NULL);
// Bounce all intensity channels to MasterTimer's fader for zeroing
QHashIterator <FadeChannel,FadeChannel> it(m_fader->channels());
while (it.hasNext() == true)
{
it.next();
FadeChannel fc = it.value();
if (fc.group(doc()) == QLCChannel::Intensity)
{
fc.setStart(fc.current(intensity()));
fc.setTarget(0);
fc.setElapsed(0);
fc.setReady(false);
fc.setFadeTime(fadeOutSpeed());
timer->fader()->add(fc);
}
}
m_currentIndex = -1;
delete m_fader;
m_fader = NULL;
emit currentCueChanged(m_currentIndex);
emit stopped();
}
示例3: ready
void FadeChannel_Test::ready()
{
FadeChannel ch;
QVERIFY(ch.isReady() == false);
ch.setReady(true);
QVERIFY(ch.isReady() == true);
}
示例4: insertStartValues
void RGBMatrix::insertStartValues(FadeChannel& fc, uint fadeTime) const
{
Q_ASSERT(m_fader != NULL);
// To create a nice and smooth fade, get the starting value from
// m_fader's existing FadeChannel (if any). Otherwise just assume
// we're starting from zero.
QHash <FadeChannel,FadeChannel>::const_iterator oldChannelIterator = m_fader->channels().find(fc);
if (oldChannelIterator != m_fader->channels().end())
{
FadeChannel old = oldChannelIterator.value();
fc.setCurrent(old.current());
fc.setStart(old.current());
}
else
{
fc.setCurrent(0);
fc.setStart(0);
}
// The channel is not ready yet
fc.setReady(false);
// Fade in speed is used for all non-zero targets
if (fc.target() == 0)
fc.setFadeTime(fadeOutSpeed());
else
{
fc.setFadeTime(fadeTime);
}
}
示例5: insertStartValues
void RGBMatrix::insertStartValues(FadeChannel& fc) const
{
Q_ASSERT(m_fader != NULL);
// To create a nice and smooth fade, get the starting value from
// m_fader's existing FadeChannel (if any). Otherwise just assume
// we're starting from zero.
if (m_fader->channels().contains(fc) == true)
{
FadeChannel old = m_fader->channels()[fc];
fc.setCurrent(old.current());
fc.setStart(old.current());
}
else
{
fc.setCurrent(0);
fc.setStart(0);
}
// The channel is not ready yet
fc.setReady(false);
// Fade in speed is used for all non-zero targets
if (fc.target() == 0)
fc.setFadeTime(fadeOutSpeed());
else
fc.setFadeTime(fadeInSpeed());
}
示例6: postRun
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);
}
示例7: nextStep
void FadeChannel_Test::nextStep()
{
FadeChannel fc;
fc.setStart(0);
fc.setTarget(250);
fc.setFadeTime(1000);
for (int i = 5; i < 250; i += 5)
{
int value = fc.nextStep(MasterTimer::tick());
QCOMPARE(value, i);
}
fc.setCurrent(0);
fc.setReady(false);
fc.setFadeTime(0);
fc.setElapsed(0);
QCOMPARE(fc.nextStep(MasterTimer::tick()), uchar(250));
fc.setCurrent(0);
fc.setReady(false);
fc.setFadeTime(MasterTimer::tick() / 5);
fc.setElapsed(0);
QCOMPARE(fc.nextStep(MasterTimer::tick()), uchar(250));
fc.setCurrent(0);
fc.setReady(false);
fc.setFadeTime(1 * MasterTimer::tick());
fc.setElapsed(0);
QCOMPARE(fc.nextStep(MasterTimer::tick()), uchar(250));
fc.setCurrent(0);
fc.setReady(false);
fc.setFadeTime(2 * MasterTimer::tick());
fc.setElapsed(0);
QCOMPARE(fc.nextStep(MasterTimer::tick()), uchar(125));
QCOMPARE(fc.nextStep(MasterTimer::tick()), uchar(250));
fc.setCurrent(0);
fc.setReady(false);
fc.setFadeTime(5 * MasterTimer::tick());
fc.setElapsed(0);
QCOMPARE(fc.nextStep(MasterTimer::tick()), uchar(50));
QCOMPARE(fc.nextStep(MasterTimer::tick()), uchar(100));
QCOMPARE(fc.nextStep(MasterTimer::tick()), uchar(150));
QCOMPARE(fc.nextStep(MasterTimer::tick()), uchar(200));
QCOMPARE(fc.nextStep(MasterTimer::tick()), uchar(250));
// Maximum elapsed() reached
fc.setCurrent(0);
fc.setTarget(255);
fc.setReady(false);
fc.setElapsed(UINT_MAX);
fc.setFadeTime(5 * MasterTimer::tick());
QCOMPARE(fc.nextStep(MasterTimer::tick()), uchar(255));
QCOMPARE(fc.elapsed(), UINT_MAX);
QCOMPARE(fc.nextStep(MasterTimer::tick()), uchar(255));
QCOMPARE(fc.elapsed(), UINT_MAX);
QCOMPARE(fc.nextStep(MasterTimer::tick()), uchar(255));
QCOMPARE(fc.elapsed(), UINT_MAX);
QCOMPARE(fc.nextStep(MasterTimer::tick()), uchar(255));
QCOMPARE(fc.elapsed(), UINT_MAX);
QCOMPARE(fc.nextStep(MasterTimer::tick()), uchar(255));
QCOMPARE(fc.elapsed(), UINT_MAX);
// Channel marked as ready
fc.setReady(true);
fc.setElapsed(0);
QCOMPARE(fc.nextStep(MasterTimer::tick()), uchar(255));
QCOMPARE(fc.elapsed(), MasterTimer::tick() * 1);
QCOMPARE(fc.nextStep(MasterTimer::tick()), uchar(255));
QCOMPARE(fc.elapsed(), MasterTimer::tick() * 2);
QCOMPARE(fc.nextStep(MasterTimer::tick()), uchar(255));
QCOMPARE(fc.elapsed(), MasterTimer::tick() * 3);
}