#include "ardour/vca.h"
#include "ardour/vca_manager.h"
-#include "i18n.h"
+#include "pbd/i18n.h"
using namespace ARDOUR;
using namespace std;
GainControl::GainControl (Session& session, const Evoral::Parameter ¶m, boost::shared_ptr<AutomationList> al)
: SlavableAutomationControl (session, param, ParameterDescriptor(param),
al ? al : boost::shared_ptr<AutomationList> (new AutomationList (param)),
- param.type() == GainAutomation ? X_("gaincontrol") : X_("trimcontrol")) {
-
+ param.type() == GainAutomation ? X_("gaincontrol") : X_("trimcontrol"),
+ Controllable::GainLike)
+{
alist()->reset_default (1.0);
lower_db = accurate_coefficient_to_dB (_desc.lower);
range_db = accurate_coefficient_to_dB (_desc.upper) - lower_db;
}
-void
-GainControl::actually_set_value (double val, Controllable::GroupControlDisposition group_override)
-{
- val = std::max (std::min (val, (double)_desc.upper), (double)_desc.lower);
-
- {
- Glib::Threads::RWLock::WriterLock lm (master_lock);
-
- if (!_masters.empty()) {
- recompute_masters_ratios (val);
- }
- }
-
- /* this sets the Evoral::Control::_user_value for us, which will
- be retrieved by AutomationControl::get_value ()
- */
-
- AutomationControl::actually_set_value (val, group_override);
-
- _session.set_dirty ();
-}
-
double
GainControl::internal_to_interface (double v) const
{
Mr(n) is the new ratio number for the slaves
*/
-
const double nmasters = _masters.size();
double masters_total_gain_coefficient = 1.0;
}
}
-XMLNode&
-GainControl::get_state ()
-{
- XMLNode& node (AutomationControl::get_state());
-
-#if 0
- /* store VCA master IDs */
-
- string str;
-
- {
- Glib::Threads::RWLock::ReaderLock lm (master_lock);
- for (Masters::const_iterator mr = _masters.begin(); mr != _masters.end(); ++mr) {
- if (!str.empty()) {
- str += ',';
- }
- str += PBD::to_string (mr->first, std::dec);
- }
- }
-
- if (!str.empty()) {
- node.add_property (X_("masters"), str);
- }
-#endif
-
- return node;
-}
-
-int
-GainControl::set_state (XMLNode const& node, int version)
-{
- AutomationControl::set_state (node, version);
-
-#if 0
- XMLProperty const* prop = node.property (X_("masters"));
-
- /* Problem here if we allow VCA's to be slaved to other VCA's .. we
- * have to load all VCAs first, then set up slave/master relationships
- * once we have them all.
- */
-
- if (prop) {
- masters_string = prop->value ();
-
- if (_session.vca_manager().vcas_loaded()) {
- vcas_loaded ();
- } else {
- _session.vca_manager().VCAsLoaded.connect_same_thread (vca_loaded_connection, boost::bind (&GainControl::vcas_loaded, this));
- }
- }
-#endif
-
- return 0;
-}
-
-void
-GainControl::vcas_loaded ()
-{
- if (masters_string.empty()) {
- return;
- }
-
- vector<string> masters;
- split (masters_string, masters, ',');
-
- for (vector<string>::const_iterator m = masters.begin(); m != masters.end(); ++m) {
- boost::shared_ptr<VCA> vca = _session.vca_manager().vca_by_number (PBD::atoi (*m));
- if (vca) {
- add_master (vca->gain_control());
- }
- }
-
- vca_loaded_connection.disconnect ();
- masters_string.clear ();
-}
-