13
0

Vapor: link stereo surround pan automation visibility

This commit is contained in:
Robin Gareus 2024-01-29 21:41:13 +01:00
parent 24929a2475
commit 21c3c865d3
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
4 changed files with 64 additions and 6 deletions

View File

@ -128,6 +128,10 @@ public:
_visually_linked_ctrls.push_back (ctrl);
}
void clear_visually_linked_control () {
_visually_linked_ctrls.clear ();
}
WeakAutomationControlList visually_linked_controls () const {
return _visually_linked_ctrls;
}

View File

@ -58,6 +58,11 @@ public:
return (_auto_state & Play) || ((_auto_state & (Touch | Latch)) && !touching());
}
void foreach_pan_control (boost::function<void(std::shared_ptr<AutomationControl>)>) const;
void setup_visual_links ();
void sync_visual_link_to (std::shared_ptr<SurroundPannable>);
bool touching() const;
XMLNode& get_state () const;

View File

@ -95,6 +95,16 @@ SurroundPannable::SurroundPannable (Session& s, uint32_t chn, Temporal::TimeDoma
pan_size->Changed.connect_same_thread (*this, boost::bind (&SurroundPannable::value_changed, this));
pan_snap->Changed.connect_same_thread (*this, boost::bind (&SurroundPannable::value_changed, this));
setup_visual_links ();
}
SurroundPannable::~SurroundPannable ()
{
}
void
SurroundPannable::setup_visual_links ()
{
/* all controls are visible together */
pan_pos_x->add_visually_linked_control (pan_pos_y);
pan_pos_x->add_visually_linked_control (pan_pos_z);
@ -104,8 +114,30 @@ SurroundPannable::SurroundPannable (Session& s, uint32_t chn, Temporal::TimeDoma
pan_pos_z->add_visually_linked_control (pan_pos_y);
}
SurroundPannable::~SurroundPannable ()
void
SurroundPannable::sync_visual_link_to (std::shared_ptr<SurroundPannable> other)
{
pan_pos_x->add_visually_linked_control (other->pan_pos_x);
pan_pos_x->add_visually_linked_control (other->pan_pos_y);
pan_pos_x->add_visually_linked_control (other->pan_pos_z);
pan_pos_y->add_visually_linked_control (other->pan_pos_x);
pan_pos_y->add_visually_linked_control (other->pan_pos_y);
pan_pos_y->add_visually_linked_control (other->pan_pos_z);
pan_pos_z->add_visually_linked_control (other->pan_pos_x);
pan_pos_z->add_visually_linked_control (other->pan_pos_y);
pan_pos_z->add_visually_linked_control (other->pan_pos_z);
}
void
SurroundPannable::foreach_pan_control (boost::function<void(std::shared_ptr<AutomationControl>)> f) const
{
f (pan_pos_x);
f (pan_pos_y);
f (pan_pos_z);
f (pan_size);
f (pan_snap);
}
void
@ -117,11 +149,9 @@ SurroundPannable::control_auto_state_changed (AutoState new_state)
_responding_to_control_auto_state_change++;
pan_pos_x->set_automation_state (new_state);
pan_pos_y->set_automation_state (new_state);
pan_pos_z->set_automation_state (new_state);
pan_size->set_automation_state (new_state);
pan_snap->set_automation_state (new_state);
foreach_pan_control ([new_state](std::shared_ptr<AutomationControl> ac) {
ac->set_automation_state (new_state);
});
_responding_to_control_auto_state_change--;

View File

@ -255,6 +255,25 @@ SurroundSend::configure_io (ChanCount in, ChanCount out)
add_pannable ();
}
#ifdef MIXBUS
/* Link visibility - currently only for Mixbus which has a custom UI, and at most stereo */
for (uint32_t i = 0; i < _pannable.size (); ++i) {
_pannable[i]->foreach_pan_control ([](std::shared_ptr<AutomationControl> ac) { ac->clear_visually_linked_control (); });
}
/* first link local controls */
for (uint32_t i = 0; i < n_audio; ++i) {
_pannable[i]->setup_visual_links ();
}
for (uint32_t i = 0; i < n_audio; ++i) {
for (uint32_t j = 0; j < n_audio; ++j) {
if (i == j) {
continue;
}
_pannable[i]->sync_visual_link_to (_pannable[j]);
}
}
#endif
if (!_configured && !_has_state) {
switch (n_audio) {
case 2: