1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-15 15:49:36 +02:00

Fix use of uninitialized data for meter when emulating volume

This commit is contained in:
Paul Licameli 2021-01-15 13:19:58 -05:00
parent 350f84bed6
commit e47245bd8c
2 changed files with 7 additions and 10 deletions

View File

@ -3786,7 +3786,6 @@ void AudioIoCallback::CheckSoundActivatedRecordingLevel(
void AudioIoCallback::AddToOutputChannel( unsigned int chan, void AudioIoCallback::AddToOutputChannel( unsigned int chan,
float * outputMeterFloats, float * outputMeterFloats,
float * outputFloats, float * outputFloats,
float * tempFloats,
float * tempBuf, float * tempBuf,
bool drop, bool drop,
unsigned long len, unsigned long len,
@ -3804,7 +3803,7 @@ void AudioIoCallback::AddToOutputChannel( unsigned int chan,
if (outputMeterFloats != outputFloats) if (outputMeterFloats != outputFloats)
for ( unsigned i = 0; i < len; ++i) for ( unsigned i = 0; i < len; ++i)
outputMeterFloats[numPlaybackChannels*i+chan] += outputMeterFloats[numPlaybackChannels*i+chan] +=
gain*tempFloats[i]; gain*tempBuf[i];
if (mEmulateMixerOutputVol) if (mEmulateMixerOutputVol)
gain *= mMixerOutputVol; gain *= mMixerOutputVol;
@ -3836,8 +3835,7 @@ void ClampBuffer(float * pBuffer, unsigned long len){
// //
bool AudioIoCallback::FillOutputBuffers( bool AudioIoCallback::FillOutputBuffers(
void *outputBuffer, void *outputBuffer,
unsigned long framesPerBuffer, unsigned long framesPerBuffer, float *outputMeterFloats
float * tempFloats, float *outputMeterFloats
) )
{ {
const auto numPlaybackTracks = mPlaybackTracks.size(); const auto numPlaybackTracks = mPlaybackTracks.size();
@ -3999,11 +3997,13 @@ bool AudioIoCallback::FillOutputBuffers(
if (vt->GetChannelIgnoringPan() == Track::LeftChannel || if (vt->GetChannelIgnoringPan() == Track::LeftChannel ||
vt->GetChannelIgnoringPan() == Track::MonoChannel ) vt->GetChannelIgnoringPan() == Track::MonoChannel )
AddToOutputChannel( 0, outputMeterFloats, outputFloats, tempFloats, tempBufs[c], drop, len, vt); AddToOutputChannel( 0, outputMeterFloats, outputFloats,
tempBufs[c], drop, len, vt);
if (vt->GetChannelIgnoringPan() == Track::RightChannel || if (vt->GetChannelIgnoringPan() == Track::RightChannel ||
vt->GetChannelIgnoringPan() == Track::MonoChannel ) vt->GetChannelIgnoringPan() == Track::MonoChannel )
AddToOutputChannel( 1, outputMeterFloats, outputFloats, tempFloats, tempBufs[c], drop, len, vt); AddToOutputChannel( 1, outputMeterFloats, outputFloats,
tempBufs[c], drop, len, vt);
} }
chanCnt = 0; chanCnt = 0;
@ -4472,7 +4472,6 @@ int AudioIoCallback::AudioCallback(const void *inputBuffer, void *outputBuffer,
if( FillOutputBuffers( if( FillOutputBuffers(
outputBuffer, outputBuffer,
framesPerBuffer, framesPerBuffer,
tempFloats,
outputMeterFloats)) outputMeterFloats))
return mCallbackReturn; return mCallbackReturn;

View File

@ -315,7 +315,6 @@ public:
void AddToOutputChannel( unsigned int chan, void AddToOutputChannel( unsigned int chan,
float * outputMeterFloats, float * outputMeterFloats,
float * outputFloats, float * outputFloats,
float * tempFloats,
float * tempBuf, float * tempBuf,
bool drop, bool drop,
unsigned long len, unsigned long len,
@ -323,8 +322,7 @@ public:
); );
bool FillOutputBuffers( bool FillOutputBuffers(
void *outputBuffer, void *outputBuffer,
unsigned long framesPerBuffer, unsigned long framesPerBuffer, float *outputMeterFloats
float * tempFloats, float *outputMeterFloats
); );
void FillInputBuffers( void FillInputBuffers(
const void *inputBuffer, const void *inputBuffer,