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

Bug1104: If one stereo channel is shorter, don't buzz or stop playback short...

... A better fix this time!
This commit is contained in:
Paul Licameli 2016-01-31 15:42:23 -05:00
parent fd2e36b538
commit 508286661a

View File

@ -4222,10 +4222,17 @@ int audacityAudioCallback(const void *inputBuffer, void *outputBuffer,
len = gAudioIO->mPlaybackBuffers[t]->Get((samplePtr)tempBufs[chanCnt], len = gAudioIO->mPlaybackBuffers[t]->Get((samplePtr)tempBufs[chanCnt],
floatSample, floatSample,
(int)framesPerBuffer); (int)framesPerBuffer);
if (len < framesPerBuffer)
// Pad with zeroes to the end, in case of a short channel
memset((void*)&tempBufs[chanCnt][len], 0,
(framesPerBuffer - len) * sizeof(float));
chanCnt++; chanCnt++;
} }
// There should not be a difference of len in different loop passes...
// but anyway take a max. // PRL: Bug1104:
// There can be a difference of len in different loop passes if one channel
// of a stereo track ends before the other! Take a max!
maxLen = std::max(maxLen, len); maxLen = std::max(maxLen, len);
@ -4257,6 +4264,9 @@ int audacityAudioCallback(const void *inputBuffer, void *outputBuffer,
} }
#endif #endif
// Last channel seen now
len = maxLen;
if( !cut && selected ) if( !cut && selected )
{ {
len = em.RealtimeProcess(group, chanCnt, tempBufs, len); len = em.RealtimeProcess(group, chanCnt, tempBufs, len);