13
0

Vapor: add AutomationControl to en/disable surround send

This is in preparation to allow grouping send-enable.
This commit is contained in:
Robin Gareus 2024-01-30 23:03:12 +01:00
parent 11e508cbe6
commit 2e00638761
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 45 additions and 5 deletions

View File

@ -67,6 +67,7 @@ public:
BufferSet const& bufs () const { return _mixbufs; }
std::shared_ptr<SurroundPannable> const& pan_param (size_t chn, timepos_t& s, timepos_t& e) const;
std::shared_ptr<AutomationControl> send_enable_control () const { return _send_enable_control; }
protected:
int set_state (const XMLNode&, int version);
@ -78,20 +79,25 @@ private:
void cycle_start (pframes_t);
void add_pannable ();
void send_enable_changed ();
void proc_active_changed ();
BufferSet _mixbufs;
int32_t _surround_id;
timepos_t _cycle_start;
timepos_t _cycle_end;
gain_t _current_gain;
bool _has_state;
bool _ignore_enable_change;
std::vector<std::shared_ptr<SurroundPannable>> _pannable;
std::shared_ptr<GainControl> _gain_control;
std::shared_ptr<Amp> _amp;
std::shared_ptr<MuteMaster> _mute_master;
std::shared_ptr<DelayLine> _send_delay;
std::shared_ptr<DelayLine> _thru_delay;
std::shared_ptr<AutomationControl> _send_enable_control;
std::shared_ptr<GainControl> _gain_control;
std::shared_ptr<Amp> _amp;
std::shared_ptr<MuteMaster> _mute_master;
std::shared_ptr<DelayLine> _send_delay;
std::shared_ptr<DelayLine> _thru_delay;
PBD::ScopedConnectionList _change_connections;
};

View File

@ -17,6 +17,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "pbd/unwind.h"
#include "ardour/surround_send.h"
#include "ardour/amp.h"
#include "ardour/audioengine.h"
@ -37,6 +39,7 @@ SurroundSend::SurroundSend (Session& s, std::shared_ptr<MuteMaster> mm)
, _surround_id (s.next_surround_send_id ())
, _current_gain (GAIN_COEFF_ZERO)
, _has_state (false)
, _ignore_enable_change (false)
, _mute_master (mm)
{
@ -53,11 +56,18 @@ SurroundSend::SurroundSend (Session& s, std::shared_ptr<MuteMaster> mm)
add_control (_gain_control);
_send_enable_control = std::shared_ptr<AutomationControl> (new AutomationControl (_session, BusSendEnable, ParameterDescriptor(BusSendEnable)));
_send_enable_control->Changed.connect_same_thread (*this, boost::bind (&SurroundSend::send_enable_changed, this));
_send_enable_control->clear_flag (PBD::Controllable::RealTime);
ActiveChanged.connect_same_thread (*this, boost::bind (&SurroundSend::proc_active_changed, this));
InternalSend::CycleStart.connect_same_thread (*this, boost::bind (&SurroundSend::cycle_start, this, _1));
}
SurroundSend::~SurroundSend ()
{
_send_enable_control->drop_references ();
}
std::shared_ptr<SurroundPannable>
@ -396,6 +406,30 @@ SurroundSend::describe_parameter (Evoral::Parameter param)
return Automatable::describe_parameter (param);
}
void
SurroundSend::send_enable_changed ()
{
if (_ignore_enable_change) {
return;
}
PBD::Unwinder<bool> uw (_ignore_enable_change, true);
if (_send_enable_control->get_value () > 0) {
activate ();
} else {
deactivate ();
}
}
void
SurroundSend::proc_active_changed ()
{
if (_ignore_enable_change) {
return;
}
PBD::Unwinder<bool> uw (_ignore_enable_change, true);
_send_enable_control->set_value (_pending_active ? 1 : 0, PBD::Controllable::UseGroup);
}
int
SurroundSend::set_state (const XMLNode& node, int version)
{