From 11e508cbe6a25f81bb75ca80f497940adba3fff4 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 29 Jan 2024 22:23:42 +0100 Subject: [PATCH] Vapor: sync automation state of multi-channel surround pans --- libs/ardour/ardour/surround_pannable.h | 1 + libs/ardour/surround_pannable.cc | 8 +++++++- libs/ardour/surround_send.cc | 6 ++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/libs/ardour/ardour/surround_pannable.h b/libs/ardour/ardour/surround_pannable.h index 963d2cc6ff..ae465be2b6 100644 --- a/libs/ardour/ardour/surround_pannable.h +++ b/libs/ardour/ardour/surround_pannable.h @@ -62,6 +62,7 @@ public: void setup_visual_links (); void sync_visual_link_to (std::shared_ptr); + void sync_auto_state_with (std::shared_ptr); bool touching() const; diff --git a/libs/ardour/surround_pannable.cc b/libs/ardour/surround_pannable.cc index 25f7d6180c..e42df07851 100644 --- a/libs/ardour/surround_pannable.cc +++ b/libs/ardour/surround_pannable.cc @@ -130,6 +130,12 @@ SurroundPannable::sync_visual_link_to (std::shared_ptr other) pan_pos_z->add_visually_linked_control (other->pan_pos_z); } +void +SurroundPannable::sync_auto_state_with (std::shared_ptr other) +{ + other->pan_pos_x->alist()->automation_state_changed.connect_same_thread (*this, boost::bind (&SurroundPannable::control_auto_state_changed, this, _1)); +} + void SurroundPannable::foreach_pan_control (boost::function)> f) const { @@ -143,7 +149,7 @@ SurroundPannable::foreach_pan_control (boost::functionpan_size); add_control (p->pan_snap); add_control (p->binaural_render_mode); + + for (uint32_t i = 0; i < _pannable.size (); ++i) { + _pannable[i]->sync_auto_state_with (p); + p->sync_auto_state_with (_pannable[i]); + } + _pannable.push_back (p); _change_connections.drop_connections ();