Fix incorrect m_lastSoloed after moving/deleting an FX channel

Original code by @gi0e5b06.
This commit is contained in:
Kevin Zander
2019-11-15 19:46:09 -06:00
committed by Hyunjin Song
parent 33b36ffc5e
commit 256ae6dad6

View File

@@ -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;
@@ -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();