From 27dfbecd5450fc4b4881f02cd9e985c0aacc7ab5 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 29 Dec 2021 12:41:11 -0700 Subject: [PATCH] triggerbox: add skeleton for push/pop of cue-affected trigger properties --- libs/ardour/ardour/triggerbox.h | 18 ++++++++++++++++++ libs/ardour/triggerbox.cc | 18 ++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/libs/ardour/ardour/triggerbox.h b/libs/ardour/ardour/triggerbox.h index c703e1f6c9..846e0482c0 100644 --- a/libs/ardour/ardour/triggerbox.h +++ b/libs/ardour/ardour/triggerbox.h @@ -287,6 +287,24 @@ class LIBARDOUR_API Trigger : public PBD::Stateful { PBD::Property _isolated; PBD::Property _color; + struct CueModifiedProperties { + FollowAction follow_action; + LaunchStyle launch_style; + + CueModifiedProperties() : follow_action (NextTrigger), launch_style (Toggle), _valid (false) {} + CueModifiedProperties (FollowAction fa, LaunchStyle ls) : follow_action (fa), launch_style (ls), _valid (true) {} + + bool valid() const { return _valid; } + void invalidate() { _valid = false; } + + private: + bool _valid; + }; + + CueModifiedProperties pre_cue_properties; + void push_cue_properties (); + void pop_cue_properties (); + /* computed from data */ double _barcnt; /* our estimate of the number of bars in the region */ diff --git a/libs/ardour/triggerbox.cc b/libs/ardour/triggerbox.cc index b5f75cdc00..309fadc4a7 100644 --- a/libs/ardour/triggerbox.cc +++ b/libs/ardour/triggerbox.cc @@ -112,6 +112,24 @@ Trigger::Trigger (uint32_t n, TriggerBox& b) add_property (_color); } +void +Trigger::push_cue_properties () +{ + /* must be called from RT process context */ + pre_cue_properties = CueModifiedProperties (_follow_action0, _launch_style); +} + +void +Trigger::pop_cue_properties () +{ + /* must be called from RT process context */ + if (pre_cue_properties.valid()) { + _follow_action0 = pre_cue_properties.follow_action; + _launch_style = pre_cue_properties.launch_style; + pre_cue_properties.invalidate (); + } +} + void Trigger::request_trigger_delete (Trigger* t) {