Permalink
Browse files

engine/ui: apply a different logic to LTP channel fading

LTP crossfading is still not working
  • Loading branch information...
mcallegari committed Dec 9, 2018
1 parent b40078c commit c2860df2d235bd9d7ce5ae1f82b2162e1cbed705
Showing with 14 additions and 6 deletions.
  1. +8 −4 engine/src/genericfader.cpp
  2. +4 −1 engine/src/scene.cpp
  3. +2 −1 ui/src/virtualconsole/vccuelist.cpp
@@ -152,6 +152,7 @@ void GenericFader::write(Universe *universe)
int channelType = fc.type();
int address = int(fc.addressInUniverse());
uchar value;
Universe::BlendMode blendMode = m_blendMode;

// Calculate the next step
if (m_paused)
@@ -163,17 +164,21 @@ void GenericFader::write(Universe *universe)
if ((channelType & FadeChannel::Intensity) && fc.canFade())
value = fc.current(intensity());

// LTP non intensity channels must use normal blending
if ((channelType & FadeChannel::LTP) && (channelType & FadeChannel::Intensity) == 0)
blendMode = Universe::NormalBlend;

//qDebug() << "[GenericFader] >>> uni:" << universe->id() << ", address:" << address << ", value:" << value;
if (channelType & FadeChannel::Override)
universe->write(address, value, true);
else if (channelType & FadeChannel::Relative)
universe->writeRelative(address, value);
else
universe->writeBlended(address, value, m_blendMode);
universe->writeBlended(address, value, blendMode);

if (((channelType & FadeChannel::Intensity) &&
(channelType & FadeChannel::HTP) &&
m_blendMode == Universe::NormalBlend) || m_fadeOut)
blendMode == Universe::NormalBlend) || m_fadeOut)
{
// Remove all channels that reach their target _zero_ value.
// They have no effect either way so removing them saves a bit of CPU.
@@ -234,9 +239,8 @@ void GenericFader::setFadeOut(bool enable, uint fadeTime)
while (it.hasNext() == true)
{
FadeChannel& fc(it.next().value());
int channelType = fc.type();

if ((channelType & FadeChannel::Intensity) == 0)
if ((fc.type() & FadeChannel::Intensity) == 0)
continue;

fc.setStart(fc.current());
@@ -660,7 +660,10 @@ void Scene::write(MasterTimer *timer, QList<Universe*> ua)

FadeChannel *fc = fader->getChannelFader(doc(), ua[universe], scv.fxi, scv.channel);

if (blendMode() != Universe::NormalBlend)
// when blend mode is not normal (e.g. additive) perform a full
// from-0 fade only on intensity channels and let LTP channels
// fade from the current universe value to their target
if (blendMode() != Universe::NormalBlend && (fc->type() & FadeChannel::Intensity))
fc->setCurrent(0);

qDebug() << "Scene" << name() << "add channel" << scv.channel << "from" << fc->current() << "to" << scv.value;
@@ -1020,7 +1020,8 @@ int VCCueList::getFadeMode()
qreal primary = qreal(((m_primaryLeft ? m_slider1 : m_slider2)->value())) / 100;
qreal secondary = qreal(((m_primaryLeft ? m_slider2 : m_slider1)->value())) / 100;

if (primary != 1.0 && secondary != 0.0)
if ( (primary != 1.0 && secondary != 0.0) ||
((primary != 1.0 || secondary != 0.0) && m_linkCheck->isChecked()))
return m_blendCheck->isChecked() ? Chaser::BlendedCrossfade : Chaser::Crossfade;

return m_blendCheck->isChecked() ? Chaser::Blended : Chaser::FromFunction;

0 comments on commit c2860df

Please sign in to comment.