13
0

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
This commit is contained in:
Sampo Savolainen 2007-09-25 17:56:39 +00:00
parent 08d255de89
commit 05b27b52a2

View File

@ -66,17 +66,29 @@ class LadspaPlugin : public ARDOUR::Plugin
std::set<Parameter> 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);
}
}