+void
+MidiSource::drop_model ()
+{
+ _model.reset();
+ ModelChanged (); /* EMIT SIGNAL */
+}
+
+void
+MidiSource::set_model (boost::shared_ptr<MidiModel> m)
+{
+ _model = m;
+ ModelChanged (); /* EMIT SIGNAL */
+}
+
+/** @return Interpolation style that should be used for control parameter \a p */
+Evoral::ControlList::InterpolationStyle
+MidiSource::interpolation_of (Evoral::Parameter p) const
+{
+ InterpolationStyleMap::const_iterator i = _interpolation_style.find (p);
+ if (i == _interpolation_style.end()) {
+ return EventTypeMap::instance().interpolation_of (p);
+ }
+
+ return i->second;
+}
+
+AutoState
+MidiSource::automation_state_of (Evoral::Parameter p) const
+{
+ AutomationStateMap::const_iterator i = _automation_state.find (p);
+ if (i == _automation_state.end()) {
+ /* default to `play', otherwise if MIDI is recorded /
+ imported with controllers etc. they are by default
+ not played back, which is a little surprising.
+ */
+ return Play;
+ }
+
+ return i->second;
+}
+
+/** Set interpolation style to be used for a given parameter. This change will be
+ * propagated to anyone who needs to know.
+ */
+void
+MidiSource::set_interpolation_of (Evoral::Parameter p, Evoral::ControlList::InterpolationStyle s)
+{
+ if (interpolation_of (p) == s) {
+ return;
+ }
+
+ if (EventTypeMap::instance().interpolation_of (p) == s) {
+ /* interpolation type is being set to the default, so we don't need a note in our map */
+ _interpolation_style.erase (p);
+ } else {
+ _interpolation_style[p] = s;
+ }
+
+ InterpolationChanged (p, s); /* EMIT SIGNAL */
+}
+
+void
+MidiSource::set_automation_state_of (Evoral::Parameter p, AutoState s)
+{
+ if (automation_state_of (p) == s) {
+ return;
+ }
+
+ if (s == Play) {
+ /* automation state is being set to the default, so we don't need a note in our map */
+ _automation_state.erase (p);
+ } else {
+ _automation_state[p] = s;
+ }
+
+ AutomationStateChanged (p, s); /* EMIT SIGNAL */
+}
+
+void
+MidiSource::copy_interpolation_from (boost::shared_ptr<MidiSource> s)
+{
+ copy_interpolation_from (s.get ());
+}
+
+void
+MidiSource::copy_automation_state_from (boost::shared_ptr<MidiSource> s)
+{
+ copy_automation_state_from (s.get ());
+}
+
+void
+MidiSource::copy_interpolation_from (MidiSource* s)
+{
+ _interpolation_style = s->_interpolation_style;
+
+ /* XXX: should probably emit signals here */
+}
+
+void
+MidiSource::copy_automation_state_from (MidiSource* s)
+{
+ _automation_state = s->_automation_state;
+
+ /* XXX: should probably emit signals here */
+}