From 5b480dd89824c6cf56fbb0f3b60ff8c7c746d559 Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Tue, 14 Jan 2014 18:04:51 +0100 Subject: [PATCH] FxMixer: rewrote loop for adjusting FX channel models in deleteChannel() --- src/core/FxMixer.cpp | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/src/core/FxMixer.cpp b/src/core/FxMixer.cpp index d41276d17..982620c98 100644 --- a/src/core/FxMixer.cpp +++ b/src/core/FxMixer.cpp @@ -171,31 +171,26 @@ void FxMixer::deleteChannel(int index) m_fxChannels[index]->m_lock.lock(); // go through every instrument and adjust for the channel index change - QVector songTrackList = engine::getSong()->tracks(); - QVector bbTrackList = engine::getBBTrackContainer()->tracks(); + TrackContainer::TrackList tracks; + tracks += engine::getSong()->tracks(); + tracks += engine::getBBTrackContainer()->tracks(); - QVector trackLists[] = {songTrackList, bbTrackList}; - for(int tl=0; tl<2; ++tl) + foreach( track* t, tracks ) { - QVector trackList = trackLists[tl]; - for(int i=0; itype() == track::InstrumentTrack ) { - if( trackList[i]->type() == track::InstrumentTrack ) + InstrumentTrack* inst = dynamic_cast( t ); + int val = inst->effectChannelModel()->value(0); + if( val == index ) { - InstrumentTrack * inst = (InstrumentTrack *) trackList[i]; - int val = inst->effectChannelModel()->value(0); - if( val == index ) - { - // we are deleting this track's fx send - // send to master - inst->effectChannelModel()->setValue(0); - } - else if( val > index ) - { - // subtract 1 to make up for the missing channel - inst->effectChannelModel()->setValue(val-1); - } - + // we are deleting this track's fx send + // send to master + inst->effectChannelModel()->setValue(0); + } + else if( val > index ) + { + // subtract 1 to make up for the missing channel + inst->effectChannelModel()->setValue(val-1); } } }