From 256ae6dad6d03cbad2c72a14939faf2aaea20549 Mon Sep 17 00:00:00 2001 From: Kevin Zander Date: Fri, 15 Nov 2019 19:46:09 -0600 Subject: [PATCH] Fix incorrect m_lastSoloed after moving/deleting an FX channel Original code by @gi0e5b06. --- src/core/FxMixer.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/core/FxMixer.cpp b/src/core/FxMixer.cpp index 032090bf1..f04435e05 100644 --- a/src/core/FxMixer.cpp +++ b/src/core/FxMixer.cpp @@ -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 songTrackList = Engine::getSong()->tracks(); QVector bbTrackList = Engine::getBBTrackContainer()->tracks();