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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user