1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-08 14:13:57 +01:00

Exception safety in: batch processing

This commit is contained in:
Paul Licameli
2016-12-03 14:33:10 -05:00
parent abbe9276f0
commit 464828d88f
2 changed files with 40 additions and 29 deletions

View File

@@ -91,7 +91,22 @@ public:
bool HasPresets(const PluginID & ID);
wxString GetPreset(const PluginID & ID, const wxString & params, wxWindow * parent);
wxString GetDefaultPreset(const PluginID & ID);
private:
void SetBatchProcessing(const PluginID & ID, bool start);
struct UnsetBatchProcessing {
PluginID mID;
void operator () (EffectManager *p) const
{ if(p) p->SetBatchProcessing(mID, false); }
};
using BatchProcessingScope =
std::unique_ptr< EffectManager, UnsetBatchProcessing >;
public:
// RAII for the function above
BatchProcessingScope SetBatchProcessing(const PluginID &ID)
{
SetBatchProcessing(ID, true); return BatchProcessingScope{ this, {ID} };
}
/** Allow effects to disable saving the state at run time */
void SetSkipStateFlag(bool flag);