From 59ac52f11301ec8c43446fc164603909fc912dee Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 24 Nov 2021 10:27:24 -0700 Subject: [PATCH] libardour: provide Processor::check_active() as a standard way to handle Processor::_{pending_,}active --- libs/ardour/ardour/processor.h | 1 + libs/ardour/processor.cc | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/libs/ardour/ardour/processor.h b/libs/ardour/ardour/processor.h index a1c194d502..a15ecdedcc 100644 --- a/libs/ardour/ardour/processor.h +++ b/libs/ardour/ardour/processor.h @@ -161,6 +161,7 @@ protected: virtual XMLNode& state (); virtual int set_state_2X (const XMLNode&, int version); + bool check_active (); bool map_loop_range (samplepos_t& start, samplepos_t& end) const; int _pending_active; diff --git a/libs/ardour/processor.cc b/libs/ardour/processor.cc index 2d6a78c198..ec0e3375f1 100644 --- a/libs/ardour/processor.cc +++ b/libs/ardour/processor.cc @@ -332,3 +332,18 @@ Processor::owner() const { return _owner; } + +bool +Processor::check_active () +{ + if (_active) { + if (!_pending_active) { + _active = false; + } + } else { + if (_pending_active) { + _active = true; + } + } + return _active; +}