1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-12-13 08:06:32 +01:00

Remove naked new[] in: blockfile and commands

This commit is contained in:
Paul Licameli
2016-04-14 12:05:14 -04:00
parent 88cac8cd7e
commit e6db1a57a3
7 changed files with 56 additions and 77 deletions

View File

@@ -99,8 +99,9 @@ bool CompareAudioCommand::Apply(CommandExecutionContext context)
// Initialize buffers for track data to be analyzed
auto buffSize = std::min(mTrack0->GetMaxBlockSize(), mTrack1->GetMaxBlockSize());
float *buff0 = new float[buffSize];
float *buff1 = new float[buffSize];
Floats buff0{ buffSize };
Floats buff1{ buffSize };
// Compare tracks block by block
auto s0 = mTrack0->TimeToLongSamples(mT0);
@@ -113,8 +114,8 @@ bool CompareAudioCommand::Apply(CommandExecutionContext context)
auto block = limitSampleBufferSize(
mTrack0->GetBestBlockSize(position), s1 - position
);
mTrack0->Get((samplePtr)buff0, floatSample, position, block);
mTrack1->Get((samplePtr)buff1, floatSample, position, block);
mTrack0->Get((samplePtr)buff0.get(), floatSample, position, block);
mTrack1->Get((samplePtr)buff1.get(), floatSample, position, block);
for (decltype(block) buffPos = 0; buffPos < block; ++buffPos)
{
@@ -131,9 +132,6 @@ bool CompareAudioCommand::Apply(CommandExecutionContext context)
);
}
delete [] buff0;
delete [] buff1;
// Output the results
double errorSeconds = mTrack0->LongSamplesToTime(errorCount);
Status(wxString::Format(wxT("%li"), errorCount));