From 593b421180290f46f39efcb21ed8192b624bbc73 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 14 Jul 2010 00:58:15 +0000 Subject: A few fixes to interpolation of MIDI controller data. Don't interpolate when writing these data back to a source, otherwise surprising new interpolated points appear in MIDI automation. Similarly don't interpolate when reading the model during MIDI stretch. Fix handling of interpolation state; controllers that have been set by the user to use a different interpolation style are noted in the tag of the session file and this state is sprayed around to MidiModel and the GUI as necessary. git-svn-id: svn://localhost/ardour2/branches/3.0@7409 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/ardour/midi_model.h | 7 +++++++ libs/ardour/ardour/midi_source.h | 13 +++++++++++++ libs/ardour/ardour/smf_source.h | 2 -- 3 files changed, 20 insertions(+), 2 deletions(-) (limited to 'libs/ardour/ardour') diff --git a/libs/ardour/ardour/midi_model.h b/libs/ardour/ardour/midi_model.h index 4e348af287..a8303539b5 100644 --- a/libs/ardour/ardour/midi_model.h +++ b/libs/ardour/ardour/midi_model.h @@ -148,6 +148,8 @@ public: InsertMergePolicy insert_merge_policy () const; void set_insert_merge_policy (InsertMergePolicy); + boost::shared_ptr control_factory(const Evoral::Parameter& id); + protected: int resolve_overlaps_unlocked (const NotePtr, void* arg = 0); @@ -170,6 +172,11 @@ public: private: friend class DeltaCommand; + void source_interpolation_changed (Evoral::Parameter, Evoral::ControlList::InterpolationStyle); + void control_list_interpolation_changed (Evoral::Parameter, Evoral::ControlList::InterpolationStyle); + + PBD::ScopedConnectionList _midi_source_connections; + // We cannot use a boost::shared_ptr here to avoid a retain cycle MidiSource* _midi_source; InsertMergePolicy _insert_merge_policy; diff --git a/libs/ardour/ardour/midi_source.h b/libs/ardour/ardour/midi_source.h index 0d0b744a95..8d20f9c7b6 100644 --- a/libs/ardour/ardour/midi_source.h +++ b/libs/ardour/ardour/midi_source.h @@ -117,8 +117,15 @@ class MidiSource : virtual public Source void set_model (boost::shared_ptr); void drop_model(); + Evoral::ControlList::InterpolationStyle interpolation_of (Evoral::Parameter) const; + void set_interpolation_of (Evoral::Parameter, Evoral::ControlList::InterpolationStyle); + void copy_interpolation_from (boost::shared_ptr); + void copy_interpolation_from (MidiSource *); + /** Emitted when a different MidiModel is set */ PBD::Signal0 ModelChanged; + /** Emitted when a parameter's interpolation style is changed */ + PBD::Signal2 InterpolationChanged; protected: virtual void flush_midi() = 0; @@ -146,6 +153,12 @@ class MidiSource : virtual public Source mutable double _length_beats; mutable sframes_t _last_read_end; sframes_t _last_write_end; + + /** Map of interpolation styles to use for Parameters; if they are not in this map, + * the correct interpolation style can be obtained from EventTypeMap::interpolation_of () + */ + typedef std::map InterpolationStyleMap; + InterpolationStyleMap _interpolation_style; }; } diff --git a/libs/ardour/ardour/smf_source.h b/libs/ardour/ardour/smf_source.h index d271cb0dba..6dcea9dd60 100644 --- a/libs/ardour/ardour/smf_source.h +++ b/libs/ardour/ardour/smf_source.h @@ -82,8 +82,6 @@ private: sframes_t position, nframes_t cnt); - void set_default_controls_interpolation (); - double _last_ev_time_beats; sframes_t _last_ev_time_frames; /** end time (start + duration) of last call to read_unlocked */ -- cgit v1.2.3