diff options
Diffstat (limited to 'libs/ardour/ardour')
-rw-r--r-- | libs/ardour/ardour/audioregion.h | 14 | ||||
-rw-r--r-- | libs/ardour/ardour/automatable.h | 43 | ||||
-rw-r--r-- | libs/ardour/ardour/automation_control.h | 7 | ||||
-rw-r--r-- | libs/ardour/ardour/io.h | 4 | ||||
-rw-r--r-- | libs/ardour/ardour/midi_model.h | 18 | ||||
-rw-r--r-- | libs/ardour/ardour/midi_region.h | 28 | ||||
-rw-r--r-- | libs/ardour/ardour/midi_track.h | 6 | ||||
-rw-r--r-- | libs/ardour/ardour/panner.h | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/processor.h | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/region.h | 13 |
10 files changed, 101 insertions, 36 deletions
diff --git a/libs/ardour/ardour/audioregion.h b/libs/ardour/ardour/audioregion.h index f8bd8a1794..b8cde44b77 100644 --- a/libs/ardour/ardour/audioregion.h +++ b/libs/ardour/ardour/audioregion.h @@ -123,6 +123,18 @@ class AudioRegion : public Region void set_default_envelope (); int separate_by_channel (ARDOUR::Session&, vector<boost::shared_ptr<AudioRegion> >&) const; + + /* automation */ + + boost::shared_ptr<Evoral::Control> + control(const Evoral::Parameter& id, bool create=false) { + return _automatable.data().control(id, create); + } + + virtual boost::shared_ptr<const Evoral::Control> + control(const Evoral::Parameter& id) const { + return _automatable.data().control(id); + } /* export */ @@ -174,6 +186,8 @@ class AudioRegion : public Region void listen_to_my_curves (); void listen_to_my_sources (); + AutomatableControls _automatable; + boost::shared_ptr<AutomationList> _fade_in; FadeShape _fade_in_shape; boost::shared_ptr<AutomationList> _fade_out; diff --git a/libs/ardour/ardour/automatable.h b/libs/ardour/ardour/automatable.h index 99e7891ce8..837bbbc617 100644 --- a/libs/ardour/ardour/automatable.h +++ b/libs/ardour/ardour/automatable.h @@ -28,22 +28,28 @@ #include <ardour/automation_control.h> #include <ardour/parameter.h> #include <evoral/ControlSet.hpp> +#include <evoral/Sequence.hpp> namespace ARDOUR { class Session; class AutomationControl; -class Automatable : public SessionObject, virtual public Evoral::ControlSet + +/** Note this class is abstract, actual objects must either be + * an AutomatableControls or an AutomatableSequence + */ +class Automatable : virtual public Evoral::ControlSet { public: - Automatable(Session&, const std::string& name); + Automatable(Session&); + Automatable(); virtual ~Automatable() {} - boost::shared_ptr<Evoral::Control> control_factory(boost::shared_ptr<Evoral::ControlList> list) const; - boost::shared_ptr<Evoral::ControlList> control_list_factory(const Evoral::Parameter& param) const; - + boost::shared_ptr<Evoral::Control> + control_factory(const Evoral::Parameter& id); + virtual void add_control(boost::shared_ptr<Evoral::Control>); virtual void automation_snapshot(nframes_t now, bool force); @@ -74,8 +80,14 @@ public: static jack_nframes_t automation_interval() { return _automation_interval; } + + typedef Evoral::ControlSet::Controls Controls; + + Evoral::ControlSet& data() { return *this; } + const Evoral::ControlSet& data() const { return *this; } protected: + Session& _a_session; void can_automate(Parameter); @@ -90,10 +102,29 @@ protected: std::set<Parameter> _visible_controls; std::set<Parameter> _can_automate_list; - nframes_t _last_automation_snapshot; + nframes_t _last_automation_snapshot; static nframes_t _automation_interval; }; + +/** Contains notes and controllers */ +class AutomatableSequence : public Automatable, public Evoral::Sequence { +public: + AutomatableSequence(Session& s, size_t size) + : Evoral::ControlSet() + , Automatable(s) + , Evoral::Sequence(size) + {} +}; + + +/** Contains only controllers */ +class AutomatableControls : public Automatable { +public: + AutomatableControls(Session& s) : Evoral::ControlSet(), Automatable(s) {} +}; + + } // namespace ARDOUR #endif /* __ardour_automatable_h__ */ diff --git a/libs/ardour/ardour/automation_control.h b/libs/ardour/ardour/automation_control.h index 78f4553d87..52fce1096c 100644 --- a/libs/ardour/ardour/automation_control.h +++ b/libs/ardour/ardour/automation_control.h @@ -34,14 +34,15 @@ class Session; class Automatable; -/** A PBD:Controllable with associated automation data (AutomationList) +/** A PBD::Controllable with associated automation data (AutomationList) */ class AutomationControl : public PBD::Controllable, public Evoral::Control { public: AutomationControl(ARDOUR::Session&, - boost::shared_ptr<ARDOUR::AutomationList>, - std::string name="unnamed controllable"); + const Parameter& parameter, + boost::shared_ptr<ARDOUR::AutomationList> l=boost::shared_ptr<ARDOUR::AutomationList>(), + const string& name=""); boost::shared_ptr<AutomationList> alist() const { return boost::dynamic_pointer_cast<AutomationList>(_list); } diff --git a/libs/ardour/ardour/io.h b/libs/ardour/ardour/io.h index 6cae11a7fa..08c8a1b211 100644 --- a/libs/ardour/ardour/io.h +++ b/libs/ardour/ardour/io.h @@ -69,7 +69,7 @@ class BufferSet; * varied combinations of types (eg MIDI and audio) possible. */ -class IO : public Automatable, public Latent +class IO : public SessionObject, public AutomatableControls, public Latent { public: static const string state_node_name; @@ -229,7 +229,7 @@ class IO : public Automatable, public Latent struct GainControl : public AutomationControl { GainControl (std::string name, IO& i, boost::shared_ptr<AutomationList> al) - : AutomationControl (i._session, al, name) + : AutomationControl (i._session, al->parameter(), al, name) , _io (i) {} diff --git a/libs/ardour/ardour/midi_model.h b/libs/ardour/ardour/midi_model.h index 51bddfde44..a1a0da7296 100644 --- a/libs/ardour/ardour/midi_model.h +++ b/libs/ardour/ardour/midi_model.h @@ -39,7 +39,7 @@ namespace ARDOUR { class Session; class MidiSource; - + /** This is a higher level (than MidiBuffer) model of MIDI data, with separate * representations for notes (instead of just unassociated note on/off events) * and controller data. Controller data is represented as part of the @@ -47,7 +47,7 @@ class MidiSource; * Because of this MIDI controllers and automatable controllers/widgets/etc * are easily interchangeable. */ -class MidiModel : public Automatable, public Evoral::Sequence { +class MidiModel : public AutomatableSequence { public: MidiModel(MidiSource* s, size_t size=0); @@ -55,13 +55,13 @@ public: void set_note_mode(NoteMode mode) { set_percussive(mode == Percussive); }; /** Add/Remove notes. - * Technically all operations can be implemented as one of these. + * Technically all note operations can be implemented as one of these, but + * a custom command can be more efficient. */ - class DeltaCommand : public Command - { + class DeltaCommand : public Command { public: DeltaCommand (boost::shared_ptr<MidiModel> m, const std::string& name); - DeltaCommand (boost::shared_ptr<MidiModel>, const XMLNode& node); + DeltaCommand (boost::shared_ptr<MidiModel> m, const XMLNode& node); const std::string& name() const { return _name; } @@ -78,8 +78,8 @@ public: XMLNode &marshal_note(const boost::shared_ptr<Evoral::Note> note); boost::shared_ptr<Evoral::Note> unmarshal_note(XMLNode *xml_note); - boost::shared_ptr<MidiModel> _model; - const std::string _name; + boost::shared_ptr<MidiModel> _model; + const std::string _name; typedef std::list< boost::shared_ptr<Evoral::Note> > NoteList; @@ -88,7 +88,7 @@ public: }; MidiModel::DeltaCommand* new_delta_command(const std::string name="midi edit"); - void apply_command(Command* cmd); + void apply_command(Session& session, Command* cmd); bool write_to(boost::shared_ptr<MidiSource> source); diff --git a/libs/ardour/ardour/midi_region.h b/libs/ardour/ardour/midi_region.h index e0caddd954..2cbed8f99c 100644 --- a/libs/ardour/ardour/midi_region.h +++ b/libs/ardour/ardour/midi_region.h @@ -72,22 +72,28 @@ class MidiRegion : public Region int set_state (const XMLNode&); int separate_by_channel (ARDOUR::Session&, vector<MidiRegion*>&) const; - - UndoAction get_memento() const; - - // Act as a proxy for MidiModel automation stuff (for CC) - // Yep, this is pretty ugly... - Controls& controls() { return midi_source()->model()->controls(); } - const Controls& controls() const { return midi_source()->model()->controls(); } - boost::shared_ptr<Evoral::Control> control(const Evoral::Parameter& id, bool create=false) - { return midi_source()->model()->control(id, create); } + /* automation */ + + boost::shared_ptr<Evoral::Control> + control(const Evoral::Parameter& id, bool create=false) { + return model()->data().control(id, create); + } - boost::shared_ptr<const Evoral::Control> control(const Evoral::Parameter& id) const - { return midi_source()->model()->control(id); } + virtual boost::shared_ptr<const Evoral::Control> + control(const Evoral::Parameter& id) const { + return model()->data().control(id); + } + + /* export */ int exportme (ARDOUR::Session&, ARDOUR::ExportSpecification&); + UndoAction get_memento() const; + + boost::shared_ptr<MidiModel> model() { return midi_source()->model(); } + boost::shared_ptr<const MidiModel> model() const { return midi_source()->model(); } + private: friend class RegionFactory; diff --git a/libs/ardour/ardour/midi_track.h b/libs/ardour/ardour/midi_track.h index 7eda6f904b..02313c7e6e 100644 --- a/libs/ardour/ardour/midi_track.h +++ b/libs/ardour/ardour/midi_track.h @@ -73,9 +73,11 @@ public: void midi_panic(void); bool write_immediate_event(size_t size, const uint8_t* buf); + /** A control that will send "immediate" events to a MIDI track when twiddled */ struct MidiControl : public AutomationControl { - MidiControl(MidiTrack* route, boost::shared_ptr<AutomationList> al) - : AutomationControl (route->session(), al, al->parameter().symbol()) + MidiControl(MidiTrack* route, const Parameter& param, + boost::shared_ptr<AutomationList> al = boost::shared_ptr<AutomationList>()) + : AutomationControl (route->session(), param, al) , _route (route) {} diff --git a/libs/ardour/ardour/panner.h b/libs/ardour/ardour/panner.h index 47ef212d58..fb8048e7ef 100644 --- a/libs/ardour/ardour/panner.h +++ b/libs/ardour/ardour/panner.h @@ -104,7 +104,7 @@ class StreamPanner : public sigc::trackable, public PBD::Stateful struct PanControllable : public AutomationControl { PanControllable (Session& s, std::string name, StreamPanner& p, Parameter param) - : AutomationControl (s, + : AutomationControl (s, param, boost::shared_ptr<AutomationList>(new AutomationList(param)), name) , panner (p) { assert(param.type() != NullAutomation); } diff --git a/libs/ardour/ardour/processor.h b/libs/ardour/ardour/processor.h index 8c4ac8dfe5..4b236d159e 100644 --- a/libs/ardour/ardour/processor.h +++ b/libs/ardour/ardour/processor.h @@ -42,7 +42,7 @@ class Session; /* A mixer strip element - plugin, send, meter, etc. */ -class Processor : public Automatable, public Latent +class Processor : public SessionObject, public AutomatableControls, public Latent { public: static const string state_node_name; diff --git a/libs/ardour/ardour/region.h b/libs/ardour/ardour/region.h index dc81de6374..d3c8341623 100644 --- a/libs/ardour/ardour/region.h +++ b/libs/ardour/ardour/region.h @@ -45,7 +45,10 @@ enum RegionEditState { EditChangesID = 2 }; -class Region : public Automatable, public boost::enable_shared_from_this<Region>, public Readable +class Region + : public SessionObject + , public boost::enable_shared_from_this<Region> + , public Readable { public: typedef std::vector<boost::shared_ptr<Source> > SourceList; @@ -220,6 +223,14 @@ class Region : public Automatable, public boost::enable_shared_from_this<Region> std::vector<string> master_source_names(); void set_master_sources (const SourceList&); + /* automation */ + + virtual boost::shared_ptr<Evoral::Control> + control(const Evoral::Parameter& id, bool create=false) = 0; + + virtual boost::shared_ptr<const Evoral::Control> + control(const Evoral::Parameter& id) const = 0; + /* serialization */ XMLNode& get_state (); |