Skip to content

Commit

Permalink
Fix incorrect m_lastSoloed after moving/deleting an FX channel
Browse files Browse the repository at this point in the history
Original code by @gi0e5b06.
  • Loading branch information
Veratil authored and PhysSong committed Nov 16, 2019
1 parent a831b2d commit 0e51e79
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/core/FxMixer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,11 @@ void FxMixer::deleteChannel( int index )
deleteChannelSend( ch->m_receives.first() );
}

// if m_lastSoloed was our index, reset it
if (m_lastSoloed == index) { m_lastSoloed = -1; }
// if m_lastSoloed is > delete index, it will move left
else if (m_lastSoloed > index) { --m_lastSoloed; }

// actually delete the channel
m_fxChannels.remove(index);
delete ch;
Expand Down Expand Up @@ -373,6 +378,10 @@ void FxMixer::moveChannelLeft( int index )
// channels to swap
int a = index - 1, b = index;

// check if m_lastSoloed is one of our swaps
if (m_lastSoloed == a) { m_lastSoloed = b; }
else if (m_lastSoloed == b) { m_lastSoloed = a; }

// go through every instrument and adjust for the channel index change
QVector<Track *> songTrackList = Engine::getSong()->tracks();
QVector<Track *> bbTrackList = Engine::getBBTrackContainer()->tracks();
Expand Down

0 comments on commit 0e51e79

Please sign in to comment.