Permalink
Browse files

engine: fix wrong channel offset on autodetection

  • Loading branch information...
mcallegari committed Dec 24, 2018
1 parent 37cfb16 commit 58b168499b5ff78028d1614e833b34683a1f01e0
Showing with 8 additions and 1 deletion.
  1. +1 −0 debian/changelog
  2. +7 −1 engine/src/fadechannel.cpp
@@ -2,6 +2,7 @@ qlcplus (4.12.1) stable; urgency=low

* engine/RGBMatrix: fix crash when a fixture group has out of bounds heads
* engine/EFX: fix crash when previewing a cloned EFX
* Simple Desk: fix wrong channel offset
* Virtual Console/Slider: fix Click & Go not applied to channels
* Virtual Console/Frame: fix geometry after move in collapsed state
* New fixture: American DJ FREQ Matrix Quad (thanks to Rasmus Ahlberg)
@@ -102,14 +102,18 @@ void FadeChannel::unsetTypeFlag(int flag)

void FadeChannel::autoDetect(const Doc *doc)
{
bool fixtureWasInvalid = false;
// reset before autodetecting
setType(0);

/* on invalid fixture, channel number is most likely
* absolute (SimpleDesk/CueStack do it this way), so attempt
* a reverse lookup to try and find the Fixture ID */
if (m_fixture == Fixture::invalidId())
{
fixtureWasInvalid = true;
m_fixture = doc->fixtureForAddress(channel());
}

Fixture *fixture = doc->fixture(m_fixture);
if (fixture == NULL)
@@ -123,7 +127,9 @@ void FadeChannel::autoDetect(const Doc *doc)
m_universe = fixture->universe();
m_address = fixture->address();

if (m_channel >= fixture->channels())
// if the fixture was invalid at the beginning of this method
// it means channel was an absolute address, so, fix it
if (fixtureWasInvalid)
m_channel -= fixture->address();

const QLCChannel *channel = fixture->channel(m_channel);

0 comments on commit 58b1684

Please sign in to comment.