Bug 2010 - Scriptables: SelectTracks and Select incorrect for stereo tracks

This commit is contained in:
James Crook 2018-10-11 11:29:53 +01:00
parent 7e5a716e65
commit 15a3ea7763
1 changed files with 4 additions and 5 deletions

View File

@ -230,19 +230,18 @@ bool SelectTracksCommand::Apply(const CommandContext &context)
// Add 0.01 so we are free of rounding errors in comparisons.
constexpr double fudge = 0.01;
for (auto channel : channels) {
(void)channel;// compiler food
double track = index + fudge + term;
bool sel = first <= track && track <= last;
if( mMode == 0 ){ // Set
t->SetSelected(sel);
channel->SetSelected(sel);
}
else if( mMode == 1 && sel ){ // Add
t->SetSelected(sel);
channel->SetSelected(sel);
}
else if( mMode == 2 && sel ){ // Remove
t->SetSelected(!sel);
channel->SetSelected(!sel);
}
term += (1.0 - fudge) / channels.size();
term += 1.0 / channels.size();
}
++index;
}