mirror of
https://github.com/cookiengineer/audacity
synced 2026-01-02 14:17:07 +01:00
Exception safety in: BatchCommands
This commit is contained in:
@@ -481,10 +481,14 @@ bool BatchCommands::WriteMp3File( const wxString & Name, int bitrate )
|
|||||||
bool rc;
|
bool rc;
|
||||||
long prevBitRate = gPrefs->Read(wxT("/FileFormats/MP3Bitrate"), 128);
|
long prevBitRate = gPrefs->Read(wxT("/FileFormats/MP3Bitrate"), 128);
|
||||||
gPrefs->Write(wxT("/FileFormats/MP3Bitrate"), bitrate);
|
gPrefs->Write(wxT("/FileFormats/MP3Bitrate"), bitrate);
|
||||||
|
|
||||||
|
auto cleanup = finally( [&] {
|
||||||
|
gPrefs->Write(wxT("/FileFormats/MP3Bitrate"), prevBitRate);
|
||||||
|
gPrefs->Flush();
|
||||||
|
} );
|
||||||
|
|
||||||
// Use Mp3Stereo to control if export is to a stereo or mono file
|
// Use Mp3Stereo to control if export is to a stereo or mono file
|
||||||
rc = mExporter.Process(project, numChannels, wxT("MP3"), Name, false, 0.0, endTime);
|
rc = mExporter.Process(project, numChannels, wxT("MP3"), Name, false, 0.0, endTime);
|
||||||
gPrefs->Write(wxT("/FileFormats/MP3Bitrate"), prevBitRate);
|
|
||||||
gPrefs->Flush();
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user