本文整理汇总了C++中FadeChannel类的典型用法代码示例。如果您正苦于以下问题:C++ FadeChannel类的具体用法?C++ FadeChannel怎么用?C++ FadeChannel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FadeChannel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ready
void FadeChannel_Test::ready()
{
FadeChannel ch;
QVERIFY(ch.isReady() == false);
ch.setReady(true);
QVERIFY(ch.isReady() == true);
}
示例2: qHash
uint qHash(const FadeChannel& key)
{
uint hash = key.fixture() << 16;
hash = hash | (key.channel() & 0xFFFF);
hash = hash & (~0U);
return hash;
}
示例3: fadeTime
void FadeChannel_Test::fadeTime()
{
FadeChannel ch;
QVERIFY(ch.fadeTime() == 0);
ch.setFadeTime(50);
QVERIFY(ch.fadeTime() == 50);
}
示例4: setFadeChannel
/*****************************************************************************
* Helper Function
*****************************************************************************/
void EFXFixture::setFadeChannel(quint32 nChannel, uchar val)
{
FadeChannel fc;
fc.setFixture(doc(), head().fxi);
fc.setChannel(nChannel);
fc.setTarget(val);
m_parent->m_fader->forceAdd(fc);
}
示例5: Universe
void CueStack_Test::write()
{
QList<Universe*> ua;
ua.append(new Universe(0, new GrandMaster()));
CueStack cs(m_doc);
Cue cue("One");
cue.setValue(0, 255);
cue.setFadeInSpeed(100);
cue.setFadeOutSpeed(200);
cue.setDuration(300);
cs.appendCue(cue);
cue = Cue("Two");
cue.setValue(1, 255);
cue.setFadeInSpeed(100);
cue.setFadeOutSpeed(200);
cue.setDuration(300);
cs.appendCue(cue);
cs.preRun();
QVERIFY(cs.m_fader != NULL);
cs.write(ua);
QCOMPARE(cs.currentIndex(), -1);
cs.start();
cs.write(ua);
QCOMPARE(cs.currentIndex(), -1);
cs.nextCue();
QCOMPARE(cs.currentIndex(), -1);
cs.write(ua);
QCOMPARE(cs.currentIndex(), 0);
QCOMPARE(cs.m_fader->channels().size(), 1);
FadeChannel fc;
fc.setChannel(0);
QCOMPARE(cs.m_fader->channels()[fc].channel(), uint(0));
QCOMPARE(cs.m_fader->channels()[fc].target(), uchar(255));
cs.previousCue();
QCOMPARE(cs.currentIndex(), 0);
cs.write(ua);
QCOMPARE(cs.currentIndex(), 1);
fc.setChannel(0);
QCOMPARE(cs.m_fader->channels()[fc].channel(), uint(0));
QCOMPARE(cs.m_fader->channels()[fc].target(), uchar(0));
fc.setChannel(1);
QCOMPARE(cs.m_fader->channels()[fc].channel(), uint(1));
QCOMPARE(cs.m_fader->channels()[fc].target(), uchar(255));
MasterTimer mt(m_doc);
cs.postRun(&mt);
}
示例6: Q_UNUSED
void EFXFixture::start(MasterTimer* timer, QList<Universe *> universes)
{
Q_UNUSED(universes);
Q_UNUSED(timer);
if (fadeIntensity() > 0 && m_started == false)
{
Fixture* fxi = doc()->fixture(head().fxi);
Q_ASSERT(fxi != NULL);
if (fxi->masterIntensityChannel(head().head) != QLCChannel::invalid())
{
FadeChannel fc;
fc.setFixture(doc(), head().fxi);
fc.setChannel(fxi->masterIntensityChannel(head().head));
if (m_parent->overrideFadeInSpeed() != Function::defaultSpeed())
fc.setFadeTime(m_parent->overrideFadeInSpeed());
else
fc.setFadeTime(m_parent->fadeInSpeed());
fc.setStart(0);
fc.setCurrent(fc.start());
// Don't use intensity() multiplier because EFX's GenericFader takes care of that
fc.setTarget(fadeIntensity());
// Fade channel up with EFX's own GenericFader to allow manual intensity control
m_parent->m_fader->add(fc);
}
}
m_started = true;
}
示例7: target
void FadeChannel_Test::target()
{
FadeChannel fch;
QCOMPARE(fch.target(), uchar(0));
for (uint i = 0; i <= 255; i++)
{
fch.setTarget(i);
QCOMPARE(fch.target(), uchar(i));
}
}
示例8: 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)));
}
}
示例9: qDebug
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();
}
示例10: Universe
void EFXFixture_Test::stop()
{
QList<Universe*> ua;
ua.append(new Universe(0, new GrandMaster()));
MasterTimerStub mts(m_doc, ua);
EFX e(m_doc);
e.setFadeInSpeed(1000);
e.setFadeOutSpeed(2000);
EFXFixture* ef = new EFXFixture(&e);
ef->setHead(GroupHead(0,0));
e.addFixture(ef);
Fixture* fxi = m_doc->fixture(0);
QVERIFY(fxi != NULL);
e.preRun(&mts);
// Not started yet
ef->stop(&mts, ua);
QCOMPARE(e.m_fader->m_channels.size(), 0);
QCOMPARE(mts.fader()->m_channels.size(), 0);
// Start
ef->start(&mts, ua);
QCOMPARE(e.m_fader->m_channels.size(), 1);
FadeChannel fc;
fc.setFixture(m_doc, fxi->id());
fc.setChannel(fxi->masterIntensityChannel());
QVERIFY(e.m_fader->m_channels.contains(fc) == true);
// Then stop
ef->stop(&mts, ua);
QCOMPARE(e.m_fader->m_channels.size(), 0);
// FadeChannels are handed over to MasterTimer's GenericFader
QCOMPARE(mts.fader()->m_channels.size(), 1);
QVERIFY(e.m_fader->m_channels.contains(fc) == false);
QVERIFY(mts.m_fader->m_channels.contains(fc) == true);
QCOMPARE(mts.m_fader->m_channels[fc].fadeTime(), uint(2000));
e.postRun(&mts, ua);
}
示例11: Q_UNUSED
void GenericDMXSource::writeDMX(MasterTimer* timer, QList<Universe *> ua)
{
Q_UNUSED(timer);
m_mutex.lock();
QMutableMapIterator <QPair<quint32,quint32>,uchar> it(m_values);
while (it.hasNext() == true && m_outputEnabled == true)
{
it.next();
FadeChannel fc;
fc.setFixture(m_doc, it.key().first);
fc.setChannel(it.key().second);
QLCChannel::Group grp = fc.group(m_doc);
quint32 address = fc.address();
quint32 universe = fc.universe();
if (address != QLCChannel::invalid())
ua[universe]->write(address, it.value());
if (grp != QLCChannel::Intensity)
it.remove();
}
m_mutex.unlock();
}
示例12: ua
void GenericFader_Test::writeLoop()
{
UniverseArray ua(512);
GenericFader fader(m_doc);
FadeChannel fc;
fc.setFixture(0);
fc.setChannel(5);
fc.setStart(0);
fc.setTarget(250);
fc.setFadeTime(1000);
fader.add(fc);
QCOMPARE(ua.preGMValues()[15], (char) 0);
int expected = 0;
for (int i = MasterTimer::tick(); i <= 1000; i += MasterTimer::tick())
{
ua.zeroIntensityChannels();
fader.write(&ua);
int actual = uchar(ua.preGMValues()[15]);
expected += 5;
QCOMPARE(actual, expected);
}
}
示例13: 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);
}
}
示例14: array
void EFXFixture_Test::start()
{
UniverseArray array(512 * 4);
MasterTimerStub mts(m_doc, array);
EFX e(m_doc);
e.setFadeInSpeed(1000);
e.setFadeOutSpeed(2000);
EFXFixture* ef = new EFXFixture(&e);
ef->setFixture(0);
e.addFixture(ef);
Fixture* fxi = m_doc->fixture(0);
QVERIFY(fxi != NULL);
e.preRun(&mts);
// Fade intensity == 0, no need to do fade-in
ef->setFadeIntensity(0);
ef->start(&mts, &array);
QCOMPARE(e.m_fader->m_channels.size(), 0);
ef->m_started = false;
// Fade intensity > 0, need to do fade-in
ef->setFadeIntensity(1);
ef->start(&mts, &array);
QCOMPARE(e.m_fader->m_channels.size(), 1);
FadeChannel fc;
fc.setFixture(fxi->id());
fc.setChannel(fxi->masterIntensityChannel());
QVERIFY(e.m_fader->m_channels.contains(fc) == true);
QCOMPARE(e.m_fader->m_channels[fc].fadeTime(), uint(1000));
e.postRun(&mts, &array);
}
示例15: doc
void FadeChannel_Test::address()
{
Doc doc(this);
Fixture* fxi = new Fixture(&doc);
fxi->setAddress(400);
fxi->setChannels(5);
doc.addFixture(fxi);
FadeChannel fc;
fc.setChannel(2);
QCOMPARE(fc.address(), quint32(2));
fc.setFixture(&doc, fxi->id());
QCOMPARE(fc.address(), quint32(402));
fc.setFixture(&doc, 12345);
QCOMPARE(fc.address(), QLCChannel::invalid());
}