Can't call the wrong function when there's only one of them: remove ARDOUR::Parameter...
[ardour.git] / libs / ardour / io.cc
index 69c74f5f03cb3be933967471858c4e56c4ecbdda..0343545936fcdf07e348c8601cb4427bcc1e5e50 100644 (file)
@@ -103,7 +103,8 @@ static double direct_gain_to_control (gain_t gain) {
 IO::IO (Session& s, const string& name,
        int input_min, int input_max, int output_min, int output_max,
        DataType default_type, bool public_ports)
-       : Automatable (s, name),
+       : SessionObject(s, name),
+         AutomatableControls (s),
          _output_buffers (new BufferSet()),
          _active(true),
          _default_type (default_type),
@@ -137,7 +138,7 @@ IO::IO (Session& s, const string& name,
        deferred_state = 0;
 
        boost::shared_ptr<AutomationList> gl(
-                       new AutomationList(Parameter(GainAutomation)));
+                       new AutomationList(Evoral::Parameter(GainAutomation)));
 
        _gain_control = boost::shared_ptr<GainControl>(
                        new GainControl(X_("gaincontrol"), *this, gl));
@@ -162,8 +163,9 @@ IO::IO (Session& s, const string& name,
 }
 
 IO::IO (Session& s, const XMLNode& node, DataType dt)
-       : Automatable (s, "unnamed io"),
-      _output_buffers (new BufferSet()),
+       : SessionObject(s, "unnamed io"),
+         AutomatableControls (s),
+         _output_buffers (new BufferSet()),
          _active(true),
          _default_type (dt)
 {
@@ -178,7 +180,7 @@ IO::IO (Session& s, const XMLNode& node, DataType dt)
        apply_gain_automation = false;
        
        boost::shared_ptr<AutomationList> gl(
-                       new AutomationList(Parameter(GainAutomation)));
+                       new AutomationList(Evoral::Parameter(GainAutomation)));
 
        _gain_control = boost::shared_ptr<GainControl>(
                        new GainControl(X_("gaincontrol"), *this, gl));
@@ -322,6 +324,7 @@ IO::collect_input (BufferSet& outs, nframes_t nframes, nframes_t offset)
                
                BufferSet::iterator o = outs.begin(*t);
                for (PortSet::iterator i = _inputs.begin(*t); i != _inputs.end(*t); ++i, ++o) {
+                       (*i).cycle_start (nframes, offset);
                        o->read_from(i->get_buffer(), nframes, offset);
                }
 
@@ -1408,7 +1411,7 @@ IO::set_state (const XMLNode& node)
 
                if ((*iter)->name() == X_("Automation")) {
 
-                       set_automation_state (*(*iter), Parameter(GainAutomation));
+                       set_automation_state (*(*iter), Evoral::Parameter(GainAutomation));
                }
 
                if ((*iter)->name() == X_("controllable")) {
@@ -2266,12 +2269,12 @@ IO::meter ()
 void
 IO::clear_automation ()
 {
-       Automatable::clear (); // clears gain automation
+       data().clear (); // clears gain automation
        _panner->clear_automation ();
 }
 
 void
-IO::set_parameter_automation_state (Parameter param, AutoState state)
+IO::set_parameter_automation_state (Evoral::Parameter param, AutoState state)
 {
        // XXX: would be nice to get rid of this special hack
 
@@ -2280,7 +2283,7 @@ IO::set_parameter_automation_state (Parameter param, AutoState state)
                bool changed = false;
 
                { 
-                       Glib::Mutex::Lock lm (_control_lock);
+                       Glib::Mutex::Lock lm (control_lock());
 
                        boost::shared_ptr<AutomationList> gain_auto
                                = boost::dynamic_pointer_cast<AutomationList>(_gain_control->list());
@@ -2302,7 +2305,7 @@ IO::set_parameter_automation_state (Parameter param, AutoState state)
                }
 
        } else {
-               Automatable::set_parameter_automation_state(param, state);
+               AutomatableControls::set_parameter_automation_state(param, state);
        }
 }
 
@@ -2366,7 +2369,7 @@ IO::end_pan_touch (uint32_t which)
 void
 IO::automation_snapshot (nframes_t now, bool force)
 {
-       Automatable::automation_snapshot (now, force);
+       AutomatableControls::automation_snapshot (now, force);
 
        if (_last_automation_snapshot > now || (now - _last_automation_snapshot) > _automation_interval) {
                _panner->snapshot (now);
@@ -2742,3 +2745,12 @@ IO::UserBundleInfo::UserBundleInfo (IO* io, boost::shared_ptr<UserBundle> b)
                );
 }
 
+void
+IO::prepare_inputs (nframes_t nframes, nframes_t offset)
+{
+       /* io_lock, not taken: function must be called from Session::process() calltree */
+
+       for (PortSet::iterator i = _inputs.begin(); i != _inputs.end(); ++i) {
+               (*i).cycle_start (nframes, offset);
+       }
+}