Skip to content

Commit

Permalink
Merge pull request #1659 from mcallegari/crossuniverse
Browse files Browse the repository at this point in the history
RGBPanel: implement cross universe and 16bit profiles
  • Loading branch information
mcallegari authored Jan 8, 2025
2 parents c05a47f + bab6d1d commit 08fa7d4
Show file tree
Hide file tree
Showing 18 changed files with 441 additions and 218 deletions.
22 changes: 16 additions & 6 deletions engine/src/doc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ quint32 Doc::createFixtureId()
return m_latestFixtureId;
}

bool Doc::addFixture(Fixture* fixture, quint32 id)
bool Doc::addFixture(Fixture* fixture, quint32 id, bool crossUniverse)
{
Q_ASSERT(fixture != NULL);

Expand Down Expand Up @@ -444,6 +444,9 @@ bool Doc::addFixture(Fixture* fixture, quint32 id)
m_addresses[i] = id;
}

if (crossUniverse)
uni = floor((fixture->universeAddress() + fixture->channels()) / 512);

if (uni >= inputOutputMap()->universesCount())
{
for (i = inputOutputMap()->universesCount(); i <= uni; i++)
Expand All @@ -461,21 +464,28 @@ bool Doc::addFixture(Fixture* fixture, quint32 id)
for (i = 0; i < fixture->channels(); i++)
{
const QLCChannel *channel(fixture->channel(i));
quint32 addr = fxAddress + i;

if (crossUniverse)
{
uni = floor((fixture->universeAddress() + i) / 512);
addr = (fixture->universeAddress() + i) - (uni * 512);
}

// Inform Universe of any HTP/LTP forcing
if (forcedHTP.contains(int(i)))
universes.at(uni)->setChannelCapability(fxAddress + i, channel->group(), Universe::HTP);
universes.at(uni)->setChannelCapability(addr, channel->group(), Universe::HTP);
else if (forcedLTP.contains(int(i)))
universes.at(uni)->setChannelCapability(fxAddress + i, channel->group(), Universe::LTP);
universes.at(uni)->setChannelCapability(addr, channel->group(), Universe::LTP);
else
universes.at(uni)->setChannelCapability(fxAddress + i, channel->group());
universes.at(uni)->setChannelCapability(addr, channel->group());

// Apply the default value BEFORE modifiers
universes.at(uni)->setChannelDefaultValue(fxAddress + i, channel->defaultValue());
universes.at(uni)->setChannelDefaultValue(addr, channel->defaultValue());

// Apply a channel modifier, if defined
ChannelModifier *mod = fixture->channelModifier(i);
universes.at(uni)->setChannelModifier(fxAddress + i, mod);
universes.at(uni)->setChannelModifier(addr, mod);
}
inputOutputMap()->releaseUniverses(true);

Expand Down
2 changes: 1 addition & 1 deletion engine/src/doc.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ class Doc : public QObject
* @return true if the fixture was successfully added to doc,
* otherwise false.
*/
bool addFixture(Fixture* fixture, quint32 id = Fixture::invalidId());
bool addFixture(Fixture* fixture, quint32 id = Fixture::invalidId(), bool crossUniverse = false);

/**
* Delete the given fixture instance from Doc
Expand Down
Loading

0 comments on commit 08fa7d4

Please sign in to comment.