From 05b27b52a2be32dc6adb7332285fb10191aa690c Mon Sep 17 00:00:00 2001 From: Sampo Savolainen Date: Tue, 25 Sep 2007 17:56:39 +0000 Subject: Make sure activate() and deactivate() are never run multiple times in a row. Make cleanup work nicely git-svn-id: svn://localhost/ardour2/trunk@2485 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/ardour/ladspa_plugin.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'libs/ardour/ardour') diff --git a/libs/ardour/ardour/ladspa_plugin.h b/libs/ardour/ardour/ladspa_plugin.h index 4c8d9ff741..3365384321 100644 --- a/libs/ardour/ardour/ladspa_plugin.h +++ b/libs/ardour/ardour/ladspa_plugin.h @@ -66,17 +66,29 @@ class LadspaPlugin : public ARDOUR::Plugin std::set automatable() const; uint32_t nth_parameter (uint32_t port, bool& ok) const; void activate () { + if (was_activated) + return; + if (descriptor->activate) { descriptor->activate (handle); } + was_activated = true; } void deactivate () { - if (descriptor->deactivate) + if (!was_activated) + return; + + if (descriptor->deactivate) { descriptor->deactivate (handle); + } + + was_activated = false; } void cleanup () { - if (was_activated && descriptor->cleanup) { + deactivate(); + + if (descriptor->cleanup) { descriptor->cleanup (handle); } } -- cgit v1.2.3