1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-31 07:59:27 +02:00

Bug2086: Mixer board behavior...

... and also fixed analogous mistakes in some effects (Vamp, SoundTouch, and
SBSMS effects), found by review of all uses of TrackList::Channels.

The first member of the pair of iterators returned by TrackList::Channels
does not necessarily deference to a null pointer when it is incremented to
the end of the range.
This commit is contained in:
Paul Licameli 2019-03-29 11:05:01 -04:00
parent fc14d031e4
commit 2de696b461
4 changed files with 17 additions and 8 deletions

View File

@ -342,10 +342,12 @@ WaveTrack *MixerTrackCluster::GetRight() const
{
// TODO: more-than-two-channels
auto left = GetWave();
if (left)
return * ++ TrackList::Channels(left).begin();
else
return nullptr;
if (left) {
auto channels = TrackList::Channels(left);
if ( channels.size() > 1 )
return * ++ channels.first;
}
return nullptr;
}
#ifdef EXPERIMENTAL_MIDI_OUT

View File

@ -253,8 +253,10 @@ bool EffectSBSMS::Process()
auto end = leftTrack->TimeToLongSamples(mCurT1);
// TODO: more-than-two-channels
WaveTrack *rightTrack =
* ++ TrackList::Channels(leftTrack).begin();
auto channels = TrackList::Channels(leftTrack);
WaveTrack *rightTrack = (channels.size() > 1)
? * ++ channels.first
: nullptr;
if (rightTrack) {
double t;

View File

@ -122,7 +122,10 @@ bool EffectSoundTouch::ProcessWithTimeWarper(const TimeWarper &warper)
// TODO: more-than-two-channels
auto channels = TrackList::Channels(leftTrack);
if (auto rightTrack = * ++ channels.begin()) {
auto rightTrack = (channels.size() > 1)
? * ++ channels.first
: nullptr;
if ( rightTrack ) {
double t;
//Adjust bounds by the right tracks markers

View File

@ -372,7 +372,9 @@ bool VampEffect::Process()
unsigned channels = 1;
const WaveTrack *right = *channelGroup.first++;
// channelGroup now contains all but the first channel
const WaveTrack *right =
channelGroup.size() ? *channelGroup.first++ : nullptr;
if (right)
{
channels = 2;