1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-02-07 12:12:23 +01:00

Stack-allocate where possible! ...

... Removed many unnecessary naked news and deletes.
This commit is contained in:
Paul Licameli
2016-01-31 20:39:24 -05:00
parent be1d9b7dd5
commit dbaa811577
43 changed files with 785 additions and 839 deletions

View File

@@ -1792,48 +1792,48 @@ int ExportMP3::Export(AudacityProject *project,
brate);
}
ProgressDialog *progress = new ProgressDialog(wxFileName(fName).GetName(), title);
{
ProgressDialog progress(wxFileName(fName).GetName(), title);
while (updateResult == eProgressSuccess) {
sampleCount blockLen = mixer->Process(inSamples);
while (updateResult == eProgressSuccess) {
sampleCount blockLen = mixer->Process(inSamples);
if (blockLen == 0) {
break;
}
if (blockLen == 0) {
break;
}
short *mixed = (short *)mixer->GetBuffer();
short *mixed = (short *)mixer->GetBuffer();
if (blockLen < inSamples) {
if (channels > 1) {
bytes = exporter.EncodeRemainder(mixed, blockLen , buffer);
if (blockLen < inSamples) {
if (channels > 1) {
bytes = exporter.EncodeRemainder(mixed, blockLen, buffer);
}
else {
bytes = exporter.EncodeRemainderMono(mixed, blockLen, buffer);
}
}
else {
bytes = exporter.EncodeRemainderMono(mixed, blockLen , buffer);
if (channels > 1) {
bytes = exporter.EncodeBuffer(mixed, buffer);
}
else {
bytes = exporter.EncodeBufferMono(mixed, buffer);
}
}
}
else {
if (channels > 1) {
bytes = exporter.EncodeBuffer(mixed, buffer);
}
else {
bytes = exporter.EncodeBufferMono(mixed, buffer);
if (bytes < 0) {
wxString msg;
msg.Printf(_("Error %ld returned from MP3 encoder"), bytes);
wxMessageBox(msg);
break;
}
outFile.Write(buffer, bytes);
updateResult = progress.Update(mixer->MixGetCurrentTime() - t0, t1 - t0);
}
if (bytes < 0) {
wxString msg;
msg.Printf(_("Error %ld returned from MP3 encoder"), bytes);
wxMessageBox(msg);
break;
}
outFile.Write(buffer, bytes);
updateResult = progress->Update(mixer->MixGetCurrentTime()-t0, t1-t0);
}
delete progress;
delete mixer;
bytes = exporter.FinishStream(buffer);