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

Do not fill buffer if bufferLen is zero. This avoids a false +ve assert downstream when checking for non-existent buffers.

This commit is contained in:
james.k.crook 2010-02-12 16:10:22 +00:00
parent b646b10df2
commit 8fbe4f7185

View File

@ -1830,6 +1830,10 @@ bool WaveTrack::Set(samplePtr buffer, sampleFormat format,
void WaveTrack::GetEnvelopeValues(double *buffer, int bufferLen,
double t0, double tstep)
{
// Possibly nothing to do.
if( bufferLen <= 0 )
return;
memset(buffer, 0, sizeof(double)*bufferLen);
double startTime = t0;
@ -1839,6 +1843,7 @@ void WaveTrack::GetEnvelopeValues(double *buffer, int bufferLen,
{
WaveClip *clip = it->GetData();
// IF clip intersects startTime..endTime THEN...
if (clip->GetStartTime() < endTime && clip->GetEndTime() > startTime)
{
double* rbuf = buffer;
@ -1857,7 +1862,6 @@ void WaveTrack::GetEnvelopeValues(double *buffer, int bufferLen,
{
rlen = (int) ((clip->GetEndTime()-rt0) / tstep);
}
clip->GetEnvelope()->GetValues(rbuf, rlen, rt0, tstep);
}
}