1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-03-10 00:15:31 +01:00

More uses of SampleBuffer, eliminating explicit DeleteSamples calls

This commit is contained in:
Paul Licameli
2016-02-01 10:16:00 -05:00
parent 508286661a
commit 321d5259a2
22 changed files with 145 additions and 156 deletions

View File

@@ -428,7 +428,7 @@ int SimpleBlockFile::ReadData(samplePtr data, sampleFormat format,
mSilentLog=FALSE;
sf_seek(sf, start, SEEK_SET);
samplePtr buffer = NewSamples(len, floatSample);
SampleBuffer buffer(len, floatSample);
int framesRead = 0;
@@ -456,13 +456,11 @@ int SimpleBlockFile::ReadData(samplePtr data, sampleFormat format,
// Otherwise, let libsndfile handle the conversion and
// scaling, and pass us normalized data as floats. We can
// then convert to whatever format we want.
framesRead = sf_readf_float(sf, (float *)buffer, len);
CopySamples(buffer, floatSample,
framesRead = sf_readf_float(sf, (float *)buffer.ptr(), len);
CopySamples(buffer.ptr(), floatSample,
(samplePtr)data, format, framesRead);
}
DeleteSamples(buffer);
sf_close(sf);
return framesRead;