From a33ef8ef9b0e80c3e8ce383999927bb90d9ebc89 Mon Sep 17 00:00:00 2001 From: richardash1981 Date: Sun, 28 Aug 2011 20:14:47 +0000 Subject: [PATCH] r11246 didn't work, because the track list passed is the list of all tracks in project, not just the ones we are working on. This change resolves this by using a handy iterator which only gives out the tracks we need to work with. This could and should replace all other uses of iter in this function, but that's rather more invasive just now. --- src/Mix.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Mix.cpp b/src/Mix.cpp index 90bd4b6ec..c83705a8d 100644 --- a/src/Mix.cpp +++ b/src/Mix.cpp @@ -58,6 +58,10 @@ bool MixAndRender(TrackList *tracks, TrackFactory *trackFactory, int w; TrackListIterator iter(tracks); + SelectedTrackListOfKindIterator usefulIter(Track::Wave, tracks); + // this only iterates tracks which are relevant to this function, i.e. + // selected WaveTracks. The tracklist is (confusingly) the list of all + // tracks in the project t = iter.First(); while (t) { @@ -114,13 +118,13 @@ bool MixAndRender(TrackList *tracks, TrackFactory *trackFactory, } /* create the destination track (new track) */ - if ((numWaves == 1) || ((numWaves == 2) && (iter.First()->GetLink() != NULL))) + if ((numWaves == 1) || ((numWaves == 2) && (usefulIter.First()->GetLink() != NULL))) oneinput = true; // only one input track (either 1 mono or one linked stereo pair) WaveTrack *mixLeft = trackFactory->NewWaveTrack(format, rate); if (oneinput) - mixLeft->SetName(iter.First()->GetName()); /* set name of output track to be the same as the sole input track */ + mixLeft->SetName(usefulIter.First()->GetName()); /* set name of output track to be the same as the sole input track */ else mixLeft->SetName(_("Mix")); mixLeft->SetOffset(mixStartTime); @@ -131,7 +135,7 @@ bool MixAndRender(TrackList *tracks, TrackFactory *trackFactory, else { mixRight = trackFactory->NewWaveTrack(format, rate); if (oneinput) - mixLeft->SetName(iter.First()->GetLink()->GetName()); /* set name to match input track's right channel!*/ + mixLeft->SetName(usefulIter.First()->GetLink()->GetName()); /* set name to match input track's right channel!*/ else mixRight->SetName(_("Mix")); mixLeft->SetChannel(Track::LeftChannel);