Skip to content

Commit

Permalink
Add support for solo-ing groups
Browse files Browse the repository at this point in the history
  • Loading branch information
gvnnz committed Jul 27, 2024
1 parent d63dd37 commit d02fe87
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/core/rendering/reactor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,30 @@ void Reactor::toggleSolo(ID channelId)

ch.setSolo(newSolo);

if (ch.type == ChannelType::GROUP)
{
/* Toggling a solo on a group will toggle solo on all its children too. */
for (const ID childId : ch.groupChannel->getChildren())
m_model.get().channels.get(childId).setSolo(newSolo);
}
else if (ch.isGrouped())
{
const auto noChildrenSoloed = [this](const std::vector<ID>& childrenIds)
{
for (const ID childId : childrenIds)
if (m_model.get().channels.get(childId).isSoloed())
return false;
return true;
};
/* Turn parent solo on if one of the children has been soloed. Turn parent solo off
if no children are soloed instead. */
Channel& parent = m_model.get().channels.get(ch.parentId);
if (newSolo)
parent.setSolo(true);
else if (noChildrenSoloed(parent.groupChannel->getChildren()))
parent.setSolo(false);
}

m_model.swap(model::SwapType::SOFT);

if (ch.midiLightning.enabled)
Expand Down

0 comments on commit d02fe87

Please sign in to comment.