本文整理汇总了C++中FadeChannel::current方法的典型用法代码示例。如果您正苦于以下问题:C++ FadeChannel::current方法的具体用法?C++ FadeChannel::current怎么用?C++ FadeChannel::current使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FadeChannel
的用法示例。
在下文中一共展示了FadeChannel::current方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
}
示例2: 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());
}
示例3: current
void FadeChannel_Test::current()
{
FadeChannel fch;
QCOMPARE(fch.current(), uchar(0));
for (uint i = 0; i <= 255; i++)
{
fch.setCurrent(i);
QCOMPARE(fch.current(), uchar(i));
QCOMPARE(fch.current(0.4), uchar(floor((qreal(i) * 0.4) + 0.5)));
}
}
示例4: insertStartValue
void CueStack_Test::insertStartValue()
{
QList<Universe*> ua;
ua.append(new Universe(0, new GrandMaster()));
ua.at(0)->setChannelCapability(0, QLCChannel::Pan);
CueStack cs(m_doc);
cs.preRun();
FadeChannel fc;
fc.setChannel(0);
fc.setStart(0);
fc.setTarget(255);
fc.setCurrent(127);
cs.m_fader->add(fc);
fc.setTarget(64);
cs.insertStartValue(fc, ua);
QCOMPARE(fc.start(), uchar(127));
QCOMPARE(fc.current(), uchar(127));
cs.m_fader->remove(fc);
// HTP channel in universes
ua[0]->write(0, 192);
cs.insertStartValue(fc, ua);
QCOMPARE(fc.start(), uchar(0));
QCOMPARE(fc.current(), uchar(0));
QLCFixtureDef* def = m_doc->fixtureDefCache()->fixtureDef("Futurelight", "DJScan250");
QVERIFY(def != NULL);
QLCFixtureMode* mode = def->modes().first();
QVERIFY(mode != NULL);
Fixture* fxi = new Fixture(m_doc);
fxi->setFixtureDefinition(def, mode);
fxi->setName("Test Scanner");
fxi->setAddress(0);
fxi->setUniverse(0);
m_doc->addFixture(fxi);
// LTP channel (Pan) in universes
ua[0]->write(0, 192);
cs.insertStartValue(fc, ua);
QCOMPARE(fc.start(), uchar(192));
QCOMPARE(fc.current(), uchar(192));
MasterTimer mt(m_doc);
cs.postRun(&mt);
}
示例5: 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);
}
示例6: insertStartValue
void CueStack::insertStartValue(FadeChannel& fc, const QList<Universe *> ua)
{
qDebug() << Q_FUNC_INFO;
const QHash <FadeChannel,FadeChannel>& channels(m_fader->channels());
if (channels.contains(fc) == true)
{
// GenericFader contains the channel so grab its current
// value as the new starting value to get a smoother fade
FadeChannel existing = channels[fc];
fc.setStart(existing.current());
fc.setCurrent(fc.start());
}
else
{
// GenericFader didn't have the channel. Grab the starting value from UniverseArray.
quint32 uni = fc.universe();
if (uni != Universe::invalid() && uni < (quint32)ua.count())
{
if (fc.group(doc()) != QLCChannel::Intensity)
fc.setStart(ua[uni]->preGMValues()[fc.address()]);
else
fc.setStart(0); // HTP channels must start at zero
}
fc.setCurrent(fc.start());
}
}
示例7: 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();
}
示例8: add
void GenericFader::add(const FadeChannel& ch)
{
QHash<FadeChannel,FadeChannel>::iterator channelIterator = m_channels.find(ch);
if (channelIterator != m_channels.end())
{
// perform a HTP check
if (channelIterator.value().current() <= ch.current())
channelIterator.value() = ch;
}
else
{
m_channels.insert(ch, ch);
}
}