diff options
author | David Robillard <d@drobilla.net> | 2006-11-19 16:45:16 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2006-11-19 16:45:16 +0000 |
commit | ef6b25432d9c46d71b08c0f7d5f2686df428c4e8 (patch) | |
tree | 9b30d87b6670aadce365c9b112321dd674a0bab4 /libs/ardour/ardour | |
parent | af105afe6cde5b0088647cea7d5e4e3314f8478b (diff) |
Merged with trunk R1141
git-svn-id: svn://localhost/ardour2/branches/midi@1142 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/ardour')
31 files changed, 220 insertions, 253 deletions
diff --git a/libs/ardour/ardour/audio_diskstream.h b/libs/ardour/ardour/audio_diskstream.h index 76b76b1061..4a95e094a9 100644 --- a/libs/ardour/ardour/audio_diskstream.h +++ b/libs/ardour/ardour/audio_diskstream.h @@ -77,6 +77,8 @@ class AudioDiskstream : public Diskstream } void set_record_enabled (bool yn); + int set_destructive (bool yn); + bool can_become_destructive (bool& requires_bounce) const; float peak_power(uint32_t n=0) { float x = channels[n].peak_power; diff --git a/libs/ardour/ardour/audio_track.h b/libs/ardour/ardour/audio_track.h index fdf373a1cb..e87434b0fb 100644 --- a/libs/ardour/ardour/audio_track.h +++ b/libs/ardour/ardour/audio_track.h @@ -37,6 +37,9 @@ class AudioTrack : public Track AudioTrack (Session&, const XMLNode&); ~AudioTrack (); + int set_mode (TrackMode m); + bool can_use_mode (TrackMode m, bool& bounce_required); + int roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, nframes_t offset, int declick, bool can_record, bool rec_monitors_input); @@ -63,6 +66,8 @@ class AudioTrack : public Track protected: XMLNode& state (bool full); + + int _set_state (const XMLNode&, bool call_base); private: int set_diskstream (boost::shared_ptr<AudioDiskstream>, void *); diff --git a/libs/ardour/ardour/audio_unit.h b/libs/ardour/ardour/audio_unit.h index 8a51580f27..88591ab845 100644 --- a/libs/ardour/ardour/audio_unit.h +++ b/libs/ardour/ardour/audio_unit.h @@ -1,6 +1,6 @@ /* Copyright (C) 2006 Paul Davis - Written by Taybin Rutkin + Written by Taybin Rutkin This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/libs/ardour/ardour/audiofilesource.h b/libs/ardour/ardour/audiofilesource.h index af5f5cdb60..bd609a7d80 100644 --- a/libs/ardour/ardour/audiofilesource.h +++ b/libs/ardour/ardour/audiofilesource.h @@ -31,6 +31,7 @@ struct SoundFileInfo { uint16_t channels; int64_t length; std::string format_name; + int64_t timecode; }; class AudioFileSource : public AudioSource { @@ -81,6 +82,8 @@ class AudioFileSource : public AudioSource { void mark_take (string); string take_id() const { return _take_id; } + bool is_embedded() const { return _is_embedded; } + static void set_bwf_serial_number (int); static void set_search_path (string); @@ -93,6 +96,9 @@ class AudioFileSource : public AudioSource { XMLNode& get_state (); int set_state (const XMLNode&); + bool destructive() const { return (_flags & Destructive); } + virtual bool set_destructive (bool yn) { return false; } + /* this should really be protected, but C++ is getting stricter and creating slots from protected member functions is starting to cause issues. @@ -121,9 +127,12 @@ class AudioFileSource : public AudioSource { string _path; Flag _flags; string _take_id; - uint64_t timeline_position; + int64_t timeline_position; bool file_is_new; + bool _is_embedded; + static bool determine_embeddedness(string path); + static string peak_dir; static string search_path; @@ -133,7 +142,7 @@ class AudioFileSource : public AudioSource { static uint64_t header_position_offset; - virtual void set_timeline_position (nframes_t pos); + virtual void set_timeline_position (int64_t pos); virtual void set_header_timeline_position () = 0; bool find (std::string path, bool must_exist, bool& is_new); diff --git a/libs/ardour/ardour/audioregion.h b/libs/ardour/ardour/audioregion.h index e14cfd0180..53c7e68b82 100644 --- a/libs/ardour/ardour/audioregion.h +++ b/libs/ardour/ardour/audioregion.h @@ -110,6 +110,7 @@ class AudioRegion : public Region void set_fade_out (FadeShape, nframes_t); void set_envelope_active (bool yn); + void set_default_envelope (); int separate_by_channel (ARDOUR::Session&, vector<AudioRegion*>&) const; @@ -143,7 +144,6 @@ class AudioRegion : public Region void set_default_fades (); void set_default_fade_in (); void set_default_fade_out (); - void set_default_envelope (); void recompute_gain_at_end (); void recompute_gain_at_start (); @@ -157,8 +157,11 @@ class AudioRegion : public Region void recompute_at_start (); void recompute_at_end (); - void envelope_changed (Change); + void envelope_changed (); + void fade_in_changed (); + void fade_out_changed (); void source_offset_changed (); + void listen_to_my_curves (); mutable Curve _fade_in; FadeShape _fade_in_shape; @@ -171,6 +174,13 @@ class AudioRegion : public Region protected: int set_live_state (const XMLNode&, Change&, bool send); + + virtual bool verify_start (jack_nframes_t); + virtual bool verify_start_and_length (jack_nframes_t, jack_nframes_t); + virtual bool verify_start_mutable (jack_nframes_t&_start); + virtual bool verify_length (jack_nframes_t); + /*virtual void recompute_at_start () = 0; + virtual void recompute_at_end () = 0;*/ }; } /* namespace ARDOUR */ diff --git a/libs/ardour/ardour/audiosource.h b/libs/ardour/ardour/audiosource.h index db82acf894..2ada255236 100644 --- a/libs/ardour/ardour/audiosource.h +++ b/libs/ardour/ardour/audiosource.h @@ -70,7 +70,7 @@ const nframes_t frames_per_peak = 256; uint32_t read_data_count() const { return _read_data_count; } uint32_t write_data_count() const { return _write_data_count; } - int read_peaks (PeakData *peaks, nframes_t npeaks, nframes_t start, nframes_t cnt, double samples_per_unit) const; + virtual int read_peaks (PeakData *peaks, nframes_t npeaks, nframes_t start, nframes_t cnt, double samples_per_unit) const; int build_peaks (); bool peaks_ready (sigc::slot<void>, sigc::connection&) const; diff --git a/libs/ardour/ardour/automation_event.h b/libs/ardour/ardour/automation_event.h index 22ab706f82..e5c194e683 100644 --- a/libs/ardour/ardour/automation_event.h +++ b/libs/ardour/ardour/automation_event.h @@ -33,7 +33,6 @@ #include <pbd/statefuldestructible.h> #include <ardour/ardour.h> -#include <ardour/state_manager.h> namespace ARDOUR { @@ -54,14 +53,15 @@ struct ControlEvent { }; - class AutomationList : public StateManager, public PBD::StatefulDestructible +class AutomationList : public PBD::StatefulDestructible { public: typedef std::list<ControlEvent*> AutomationEventList; typedef AutomationEventList::iterator iterator; typedef AutomationEventList::const_iterator const_iterator; - AutomationList(double default_value, bool no_state = false); + AutomationList (double default_value); + AutomationList (const XMLNode&); ~AutomationList(); AutomationList (const AutomationList&); @@ -85,8 +85,9 @@ struct ControlEvent { void reposition_for_rt_add (double when); void rt_add (double when, double value); - iterator add (double when, double value, iterator, bool ignore_mode = false); - void add (double when, double value, bool for_loading = false); + void add (double when, double value); + /* this should be private but old-school automation loading needs it in IO/Redirect */ + void fast_simple_add (double when, double value); void reset_range (double start, double end); void erase_range (double start, double end); @@ -151,13 +152,12 @@ struct ControlEvent { (obj.*method)(*this); } - UndoAction get_memento () const; - - virtual void store_state (XMLNode& node) const; - virtual void load_state (const XMLNode&); + sigc::signal<void> StateChanged; - XMLNode &get_state(void); + XMLNode& get_state(void); int set_state (const XMLNode &s); + XMLNode& state (bool full); + XMLNode& serialize_events (); void set_max_xval (double); double get_max_xval() const { return max_xval; } @@ -188,12 +188,6 @@ struct ControlEvent { protected: - struct State : public ARDOUR::StateManager::State { - AutomationEventList events; - - State (std::string why) : ARDOUR::StateManager::State (why) {} - }; - AutomationEventList events; mutable Glib::Mutex lock; bool _frozen; @@ -215,7 +209,6 @@ struct ControlEvent { double min_yval; double max_yval; double default_value; - bool no_state; iterator rt_insertion_point; double rt_pos; @@ -242,14 +235,12 @@ struct ControlEvent { virtual double unlocked_eval (double where); - Change restore_state (StateManager::State&); - StateManager::State* state_factory (std::string why) const; - virtual ControlEvent* point_factory (double,double) const; virtual ControlEvent* point_factory (const ControlEvent&) const; - AutomationList* cut_copy_clear (double, double, int op); + + int deserialize_events (const XMLNode&); }; } // namespace diff --git a/libs/ardour/ardour/configuration_vars.h b/libs/ardour/ardour/configuration_vars.h index fe65e9d433..8044190066 100644 --- a/libs/ardour/ardour/configuration_vars.h +++ b/libs/ardour/ardour/configuration_vars.h @@ -80,7 +80,6 @@ CONFIG_VARIABLE (std::string, click_emphasis_sound, "click-emphasis-sound", "") CONFIG_VARIABLE (bool, auto_play, "auto-play", false) CONFIG_VARIABLE (bool, auto_return, "auto-return", false) CONFIG_VARIABLE (bool, auto_input, "auto-input", true) -CONFIG_VARIABLE (bool, auto_loop, "auto-loop", false) CONFIG_VARIABLE (bool, punch_in, "punch-in", false) CONFIG_VARIABLE (bool, punch_out, "punch-out", false) CONFIG_VARIABLE (bool, plugins_stop_with_transport, "plugins-stop-with-transport", false) diff --git a/libs/ardour/ardour/coreaudiosource.h b/libs/ardour/ardour/coreaudiosource.h index 668fe61102..bd69c78e18 100644 --- a/libs/ardour/ardour/coreaudiosource.h +++ b/libs/ardour/ardour/coreaudiosource.h @@ -38,6 +38,8 @@ class CoreAudioSource : public AudioFileSource { int flush_header () {return 0;}; void set_header_timeline_position () {}; + static int get_soundfile_info (string path, SoundFileInfo& _info, string& error_msg); + protected: nframes_t read_unlocked (Sample *dst, nframes_t start, nframes_t cnt) const; nframes_t write_unlocked (Sample *dst, nframes_t cnt) { return 0; } @@ -50,7 +52,7 @@ class CoreAudioSource : public AudioFileSource { mutable nframes_t tmpbufsize; mutable Glib::Mutex _tmpbuf_lock; - void init (const string &str); + void init (string str); }; }; /* namespace ARDOUR */ diff --git a/libs/ardour/ardour/curve.h b/libs/ardour/ardour/curve.h index 87893ca260..df984b74e0 100644 --- a/libs/ardour/ardour/curve.h +++ b/libs/ardour/ardour/curve.h @@ -51,9 +51,10 @@ class Curve : public AutomationList ~Curve (); Curve (const Curve& other); Curve (const Curve& other, double start, double end); + Curve (const XMLNode&); - bool rt_safe_get_vector (double x0, double x1, float *arg, size_t veclen); - void get_vector (double x0, double x1, float *arg, size_t veclen); + bool rt_safe_get_vector (double x0, double x1, float *arg, int32_t veclen); + void get_vector (double x0, double x1, float *arg, int32_t veclen); AutomationEventList::iterator closest_control_point_before (double xval); AutomationEventList::iterator closest_control_point_after (double xval); @@ -66,22 +67,20 @@ class Curve : public AutomationList ControlEvent* point_factory (double,double) const; ControlEvent* point_factory (const ControlEvent&) const; - Change restore_state (StateManager::State&); - private: AutomationList::iterator last_bound; double unlocked_eval (double where); double multipoint_eval (double x); - void _get_vector (double x0, double x1, float *arg, size_t veclen); + void _get_vector (double x0, double x1, float *arg, int32_t veclen); }; } // namespace ARDOUR extern "C" { - void curve_get_vector_from_c (void *arg, double, double, float*, size_t); + void curve_get_vector_from_c (void *arg, double, double, float*, int32_t); } #endif /* __ardour_curve_h__ */ diff --git a/libs/ardour/ardour/destructive_filesource.h b/libs/ardour/ardour/destructive_filesource.h index 1e75042ce9..2e6f5d0e57 100644 --- a/libs/ardour/ardour/destructive_filesource.h +++ b/libs/ardour/ardour/destructive_filesource.h @@ -48,6 +48,8 @@ class DestructiveFileSource : public SndFileSource { static void setup_standard_crossfades (nframes_t sample_rate); + int read_peaks (PeakData *peaks, nframes_t npeaks, nframes_t start, nframes_t cnt, double samples_per_unit) const; + protected: nframes_t write_unlocked (Sample *src, nframes_t cnt); @@ -66,7 +68,7 @@ class DestructiveFileSource : public SndFileSource { void init (); nframes_t crossfade (Sample* data, nframes_t cnt, int dir); - void set_timeline_position (nframes_t); + void set_timeline_position (int64_t); }; } diff --git a/libs/ardour/ardour/diskstream.h b/libs/ardour/ardour/diskstream.h index 7a779b69bf..eb6d936222 100644 --- a/libs/ardour/ardour/diskstream.h +++ b/libs/ardour/ardour/diskstream.h @@ -90,7 +90,8 @@ class IO; virtual void set_record_enabled (bool yn) = 0; bool destructive() const { return _flags & Destructive; } - virtual void set_destructive (bool yn); + virtual int set_destructive (bool yn) { return -1; } + virtual bool can_become_destructive (bool& requires_bounce) const { return false; } bool hidden() const { return _flags & Hidden; } bool recordable() const { return _flags & Recordable; } @@ -137,6 +138,8 @@ class IO; void handle_input_change (IOChange, void *src); + void remove_region_from_last_capture (boost::weak_ptr<Region> wregion); + sigc::signal<void> RecordEnableChanged; sigc::signal<void> SpeedChanged; sigc::signal<void> ReverseChanged; @@ -223,6 +226,7 @@ class IO; virtual bool realtime_set_speed (double, bool global_change); std::list<boost::shared_ptr<Region> > _last_capture_regions; + virtual int use_pending_capture_data (XMLNode& node) = 0; virtual void get_input_sources () = 0; diff --git a/libs/ardour/ardour/insert.h b/libs/ardour/ardour/insert.h index 5d917a8c2c..217fd89885 100644 --- a/libs/ardour/ardour/insert.h +++ b/libs/ardour/ardour/insert.h @@ -89,15 +89,6 @@ class PortInsert : public Insert int32_t compute_output_streams (int32_t cnt) const; }; -struct PluginInsertState : public RedirectState -{ - PluginInsertState (std::string why) - : RedirectState (why) {} - ~PluginInsertState() {} - - PluginState plugin_state; -}; - class PluginInsert : public Insert { public: @@ -112,9 +103,6 @@ class PluginInsert : public Insert XMLNode& get_state(void); int set_state(const XMLNode&); - StateManager::State* state_factory (std::string why) const; - Change restore_state (StateManager::State&); - void run (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset); void silence (nframes_t nframes, nframes_t offset); @@ -160,9 +148,7 @@ class PluginInsert : public Insert nframes_t latency(); void transport_stopped (nframes_t now); - - protected: - void store_state (PluginInsertState&) const; + void automation_snapshot (nframes_t now); private: diff --git a/libs/ardour/ardour/io.h b/libs/ardour/ardour/io.h index 56566149c0..f7e1993bb2 100644 --- a/libs/ardour/ardour/io.h +++ b/libs/ardour/ardour/io.h @@ -36,7 +36,6 @@ #include <ardour/ardour.h> #include <ardour/utils.h> -#include <ardour/state_manager.h> #include <ardour/curve.h> #include <ardour/types.h> #include <ardour/data_type.h> @@ -65,7 +64,7 @@ class BufferSet; * An IO can contain ports of varying types, making routes/inserts/etc with * varied combinations of types (eg MIDI and audio) possible. */ -class IO : public PBD::StatefulDestructible, public ARDOUR::StateManager +class IO : public PBD::StatefulDestructible { public: @@ -74,7 +73,9 @@ class IO : public PBD::StatefulDestructible, public ARDOUR::StateManager IO (Session&, string name, int input_min = -1, int input_max = -1, int output_min = -1, int output_max = -1, - DataType default_type = DataType::AUDIO); + DataType default_type = DataType::AUDIO); + + IO (Session&, const XMLNode&, DataType default_type = DataType::AUDIO); virtual ~IO(); @@ -82,18 +83,12 @@ class IO : public PBD::StatefulDestructible, public ARDOUR::StateManager ChanCount input_maximum() const { return _input_maximum; } ChanCount output_minimum() const { return _output_minimum; } ChanCount output_maximum() const { return _output_maximum; } - + void set_input_minimum (ChanCount n); void set_input_maximum (ChanCount n); void set_output_minimum (ChanCount n); void set_output_maximum (ChanCount n); - // Do not write any new code using these - void set_input_minimum (int n); - void set_input_maximum (int n); - void set_output_minimum (int n); - void set_output_maximum (int n); - DataType default_type() const { return _default_type; } void set_default_type(DataType t) { _default_type = t; } @@ -187,9 +182,6 @@ class IO : public PBD::StatefulDestructible, public ARDOUR::StateManager XMLNode& get_state (void); int set_state (const XMLNode&); - virtual UndoAction get_memento() const; - - static int disable_connecting (void); static int enable_connecting (void); @@ -224,6 +216,14 @@ public: /* automation */ + static void set_automation_interval (jack_nframes_t frames) { + _automation_interval = frames; + } + + static jack_nframes_t automation_interval() { + return _automation_interval; + } + void clear_automation (); bool gain_automation_recording() const { @@ -245,6 +245,7 @@ public: sigc::signal<void> gain_automation_style_changed; virtual void transport_stopped (nframes_t now); + void automation_snapshot (nframes_t now); ARDOUR::Curve& gain_automation_curve () { return _gain_automation_curve; } @@ -304,10 +305,8 @@ public: GainControllable _gain_control; - /* state management */ - - Change restore_state (State&); - StateManager::State* state_factory (std::string why) const; + nframes_t last_automation_snapshot; + static nframes_t _automation_interval; AutoState _gain_automation_state; AutoStyle _gain_automation_style; @@ -315,11 +314,12 @@ public: bool apply_gain_automation; Curve _gain_automation_curve; - int save_automation (const string&); - int load_automation (const string&); - Glib::Mutex automation_lock; + virtual int set_automation_state (const XMLNode&); + virtual XMLNode& get_automation_state (); + virtual int load_automation (std::string path); + /* AudioTrack::deprecated_use_diskstream_connections() needs these */ int set_inputs (const string& str); diff --git a/libs/ardour/ardour/location.h b/libs/ardour/ardour/location.h index 1f1c02d67c..94f70bb4e8 100644 --- a/libs/ardour/ardour/location.h +++ b/libs/ardour/ardour/location.h @@ -36,7 +36,6 @@ #include <pbd/statefuldestructible.h> #include <ardour/ardour.h> -#include <ardour/state_manager.h> using std::string; @@ -131,7 +130,7 @@ class Location : public PBD::StatefulDestructible bool set_flag_internal (bool yn, Flags flag); }; -class Locations : public StateManager, public PBD::StatefulDestructible +class Locations : public PBD::StatefulDestructible { public: typedef std::list<Location *> LocationList; @@ -169,6 +168,7 @@ class Locations : public StateManager, public PBD::StatefulDestructible sigc::signal<void> changed; sigc::signal<void,Location*> added; sigc::signal<void,Location*> removed; + sigc::signal<void,Change> StateChanged; template<class T> void apply (T& obj, void (T::*method)(LocationList&)) { Glib::Mutex::Lock lm (lock); @@ -180,26 +180,14 @@ class Locations : public StateManager, public PBD::StatefulDestructible (obj.*method)(locations, arg); } - UndoAction get_memento () const; - private: - struct State : public ARDOUR::StateManager::State { - LocationList locations; - LocationList states; - - State (std::string why) : ARDOUR::StateManager::State (why) {} - }; - LocationList locations; Location *current_location; mutable Glib::Mutex lock; int set_current_unlocked (Location *); void location_changed (Location*); - - Change restore_state (StateManager::State&); - StateManager::State* state_factory (std::string why) const; }; } // namespace ARDOUR diff --git a/libs/ardour/ardour/midi_diskstream.h b/libs/ardour/ardour/midi_diskstream.h index e62121672f..583cc23de5 100644 --- a/libs/ardour/ardour/midi_diskstream.h +++ b/libs/ardour/ardour/midi_diskstream.h @@ -87,7 +87,7 @@ class MidiDiskstream : public Diskstream boost::shared_ptr<SMFSource> write_source () { return _write_source; } - void set_destructive (bool yn); // doom! + int set_destructive (bool yn); // doom! protected: friend class Session; diff --git a/libs/ardour/ardour/midi_region.h b/libs/ardour/ardour/midi_region.h index a5c578b7cd..2fa39a37df 100644 --- a/libs/ardour/ardour/midi_region.h +++ b/libs/ardour/ardour/midi_region.h @@ -84,9 +84,6 @@ class MidiRegion : public Region friend class Playlist; private: - StateManager::State* state_factory (std::string why) const; - Change restore_state (StateManager::State&); - jack_nframes_t _read_at (const SourceList&, MidiRingBuffer& dst, jack_nframes_t position, jack_nframes_t dur, diff --git a/libs/ardour/ardour/midi_track.h b/libs/ardour/ardour/midi_track.h index 6cffe01318..0347df5669 100644 --- a/libs/ardour/ardour/midi_track.h +++ b/libs/ardour/ardour/midi_track.h @@ -58,7 +58,7 @@ public: int use_diskstream (string name); int use_diskstream (const PBD::ID& id); - void set_mode (TrackMode m); + int set_mode (TrackMode m); void set_latency_delay (jack_nframes_t); diff --git a/libs/ardour/ardour/panner.h b/libs/ardour/ardour/panner.h index 5231120840..79bff7d2a5 100644 --- a/libs/ardour/ardour/panner.h +++ b/libs/ardour/ardour/panner.h @@ -85,18 +85,18 @@ class StreamPanner : public sigc::trackable, public Stateful virtual Curve& automation() = 0; - virtual int load (istream&, string path, uint32_t&) = 0; - - virtual int save (ostream&) const = 0; - sigc::signal<void> Changed; /* for position */ sigc::signal<void> StateChanged; /* for mute */ int set_state (const XMLNode&); virtual XMLNode& state (bool full_state) = 0; - + Panner & get_parent() { return parent; } + /* old school automation loading */ + + virtual int load (istream&, string path, uint32_t&) = 0; + protected: friend class Panner; Panner& parent; @@ -145,8 +145,6 @@ class BaseStereoPanner : public StreamPanner void distribute (AudioBuffer& src, BufferSet& obufs, gain_t gain_coeff, nframes_t nframes); - int load (istream&, string path, uint32_t&); - int save (ostream&) const; void snapshot (nframes_t now); void transport_stopped (nframes_t frame); void set_automation_state (AutoState); @@ -154,6 +152,10 @@ class BaseStereoPanner : public StreamPanner Curve& automation() { return _automation; } + /* old school automation loading */ + + int load (istream&, string path, uint32_t&); + protected: float left; float right; @@ -207,10 +209,7 @@ class Multi2dPanner : public StreamPanner void distribute (AudioBuffer& src, BufferSet& obufs, gain_t gain_coeff, nframes_t nframes); void distribute_automated (AudioBuffer& src, BufferSet& obufs, - nframes_t start, nframes_t end, nframes_t nframes, pan_t** buffers); - - int load (istream&, string path, uint32_t&); - int save (ostream&) const; + nframes_t start, nframes_t end, nframes_t nframes, pan_t** buffers); static StreamPanner* factory (Panner&); static string name; @@ -219,6 +218,10 @@ class Multi2dPanner : public StreamPanner XMLNode& get_state (void); int set_state (const XMLNode&); + /* old school automation loading */ + + int load (istream&, string path, uint32_t&); + private: Curve _automation; void update (); @@ -244,8 +247,6 @@ class Panner : public std::vector<StreamPanner*>, public Stateful, public sigc:: /// The fundamental Panner function void distribute(BufferSet& src, BufferSet& dest, nframes_t start_frame, nframes_t end_frames, nframes_t nframes, nframes_t offset); - void set_name (string); - bool bypassed() const { return _bypassed; } void set_bypassed (bool yn); @@ -265,9 +266,6 @@ class Panner : public std::vector<StreamPanner*>, public Stateful, public sigc:: AutoStyle automation_style() const; bool touching() const; - int load (); - int save () const; - XMLNode& get_state (void); XMLNode& state (bool full); int set_state (const XMLNode&); @@ -304,12 +302,14 @@ class Panner : public std::vector<StreamPanner*>, public Stateful, public sigc:: void set_position (float x, StreamPanner& orig); void set_position (float x, float y, StreamPanner& orig); void set_position (float x, float y, float z, StreamPanner& orig); - + + /* old school automation */ + + int load (); + private: void distribute_no_automation(BufferSet& src, BufferSet& dest, nframes_t nframes, nframes_t offset, gain_t gain_coeff); - - string automation_path; Session& _session; uint32_t current_outs; bool _linked; @@ -317,6 +317,11 @@ class Panner : public std::vector<StreamPanner*>, public Stateful, public sigc:: LinkDirection _link_direction; static float current_automation_version_number; + + /* old school automation handling */ + + std::string automation_path; + void set_name (std::string); }; } // namespace ARDOUR diff --git a/libs/ardour/ardour/playlist.h b/libs/ardour/ardour/playlist.h index 93b30f42ef..831c9b3905 100644 --- a/libs/ardour/ardour/playlist.h +++ b/libs/ardour/ardour/playlist.h @@ -63,8 +63,8 @@ class Playlist : public PBD::StatefulDestructible { void unref(); uint32_t refcnt() const { return _refcnt; } - const string& name() const { return _name; } - void set_name (const string& str); + std::string name() const { return _name; } + void set_name (std::string str); const DataType& data_type() const { return _type; } @@ -73,6 +73,7 @@ class Playlist : public PBD::StatefulDestructible { bool hidden() const { return _hidden; } bool empty() const; + uint32_t n_regions() const; nframes_t get_maximum_extent () const; layer_t top_layer() const; @@ -91,19 +92,15 @@ class Playlist : public PBD::StatefulDestructible { void duplicate (boost::shared_ptr<Region>, nframes_t position, float times); void nudge_after (nframes_t start, nframes_t distance, bool forwards); - boost::shared_ptr<Region> find_region (const PBD::ID&) const; - Playlist* cut (list<AudioRange>&, bool result_is_hidden = true); Playlist* copy (list<AudioRange>&, bool result_is_hidden = true); int paste (Playlist&, nframes_t position, float times); - uint32_t read_data_count() { return _read_data_count; } - - RegionList* regions_at (nframes_t frame); - RegionList* regions_touched (nframes_t start, nframes_t end); + RegionList* regions_at (nframes_t frame); + RegionList* regions_touched (nframes_t start, nframes_t end); + boost::shared_ptr<Region> find_region (const PBD::ID&) const; boost::shared_ptr<Region> top_region_at (nframes_t frame); - - boost::shared_ptr<Region> find_next_region (nframes_t frame, RegionPoint point, int dir); + boost::shared_ptr<Region> find_next_region (nframes_t frame, RegionPoint point, int dir); template<class T> void foreach_region (T *t, void (T::*func)(boost::shared_ptr<Region>, void *), void *arg); template<class T> void foreach_region (T *t, void (T::*func)(boost::shared_ptr<Region>)); diff --git a/libs/ardour/ardour/redirect.h b/libs/ardour/ardour/redirect.h index ae58fa9b70..79ae4516c5 100644 --- a/libs/ardour/ardour/redirect.h +++ b/libs/ardour/ardour/redirect.h @@ -47,14 +47,6 @@ namespace ARDOUR { class Session; -struct RedirectState : public StateManager::State { - RedirectState (string why) - : StateManager::State (why) {} - ~RedirectState () {} - - bool active; -}; - class Redirect : public IO { public: @@ -99,9 +91,6 @@ class Redirect : public IO XMLNode& get_state (void); int set_state (const XMLNode&); - StateManager::State* state_factory (string why) const; - Change restore_state (StateManager::State&); - void *get_gui () const { return _gui; } void set_gui (void *p) { _gui = p; } @@ -110,9 +99,6 @@ class Redirect : public IO return 1.0f; } - int load_automation (string path); - int save_automation (string path); - void what_has_automation (set<uint32_t>&) const; void what_has_visible_automation (set<uint32_t>&) const; const set<uint32_t>& what_can_be_automated () const { return can_automate_list; } @@ -137,15 +123,19 @@ class Redirect : public IO void can_automate (uint32_t); set<uint32_t> can_automate_list; - void store_state (RedirectState&) const; - virtual void automation_list_creation_callback (uint32_t, AutomationList&) {} + int set_automation_state (const XMLNode&); + XMLNode& get_automation_state (); + private: bool _active; Placement _placement; uint32_t _sort_key; void* _gui; /* generic, we don't know or care what this is */ + + int old_set_automation_state (const XMLNode&); + int load_automation (std::string path); }; } // namespace ARDOUR diff --git a/libs/ardour/ardour/region.h b/libs/ardour/ardour/region.h index 627e556cad..88bb294e5d 100644 --- a/libs/ardour/ardour/region.h +++ b/libs/ardour/ardour/region.h @@ -144,6 +144,7 @@ class Region : public PBD::StatefulDestructible, public boost::enable_shared_fro void special_set_position (nframes_t); void nudge_position (long, void *src); + bool at_natural_position () const; void move_to_natural_position (void *src); void trim_start (nframes_t new_position, void *src); @@ -171,7 +172,7 @@ class Region : public PBD::StatefulDestructible, public boost::enable_shared_fro void set_playlist (ARDOUR::Playlist*); void source_deleted (boost::shared_ptr<Source>); - + boost::shared_ptr<Source> source (uint32_t n=0) const { return _sources[ (n < _sources.size()) ? n : 0 ]; } uint32_t n_channels() const { return _sources.size(); } @@ -185,7 +186,7 @@ class Region : public PBD::StatefulDestructible, public boost::enable_shared_fro virtual int set_state (const XMLNode&); virtual int set_live_state (const XMLNode&, Change&, bool send); - boost::shared_ptr<Region> get_parent(); + virtual boost::shared_ptr<Region> get_parent() const; uint64_t last_layer_op() const { return _last_layer_op; } void set_last_layer_op (uint64_t when); @@ -214,10 +215,10 @@ class Region : public PBD::StatefulDestructible, public boost::enable_shared_fro void maybe_uncopy (); void first_edit (); - bool verify_start (jack_nframes_t); - bool verify_start_and_length (jack_nframes_t, jack_nframes_t); - bool verify_start_mutable (jack_nframes_t&_start); - bool verify_length (jack_nframes_t); + virtual bool verify_start (jack_nframes_t); + virtual bool verify_start_and_length (jack_nframes_t, jack_nframes_t); + virtual bool verify_start_mutable (jack_nframes_t&_start); + virtual bool verify_length (jack_nframes_t); virtual void recompute_at_start () = 0; virtual void recompute_at_end () = 0; diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h index 5c71bb16d3..6bc37ee51e 100644 --- a/libs/ardour/ardour/route.h +++ b/libs/ardour/ardour/route.h @@ -72,8 +72,7 @@ class Route : public IO Route (Session&, std::string name, int input_min, int input_max, int output_min, int output_max, Flag flags = Flag(0), DataType default_type = DataType::AUDIO); - - Route (Session&, const XMLNode&); + Route (Session&, const XMLNode&, DataType default_type = DataType::AUDIO); virtual ~Route(); std::string comment() { return _comment; } @@ -205,11 +204,6 @@ class Route : public IO sigc::signal<void,void*> SelectedChanged; - /* undo */ - - UndoAction get_memento() const; - void set_state (state_id_t); - int set_control_outs (const vector<std::string>& ports); IO* control_outs() { return _control_outs; } @@ -238,6 +232,7 @@ class Route : public IO return _mute_control; } + void automation_snapshot (nframes_t now); void protect_automation (); void set_remote_control_id (uint32_t id); @@ -317,13 +312,14 @@ class Route : public IO sigc::connection input_signal_connection; - state_id_t _current_state_id; ChanCount redirect_max_outs; uint32_t _remote_control_id; uint32_t pans_required() const; ChanCount n_process_buffers (); + virtual int _set_state (const XMLNode&, bool call_base); + private: void init (); diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index f06c4117a6..039bf92362 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -359,7 +359,10 @@ class Session : public PBD::StatefulDestructible void request_bounded_roll (nframes_t start, nframes_t end); void request_stop (bool abort = false); void request_locate (nframes_t frame, bool with_roll = false); + void request_play_loop (bool yn); + bool get_play_loop () const { return play_loop; } + nframes_t last_transport_start() const { return _last_roll_location; } void goto_end () { request_locate (end_location->start(), false);} void goto_start () { request_locate (start_location->start(), false); } @@ -562,7 +565,8 @@ class Session : public PBD::StatefulDestructible string new_region_name (string); string path_from_region_name (string name, string identifier); - boost::shared_ptr<Region> find_whole_file_parent (Region&); + boost::shared_ptr<Region> find_whole_file_parent (boost::shared_ptr<Region const>); + void find_equivalent_playlist_regions (boost::shared_ptr<Region>, std::vector<boost::shared_ptr<Region> >& result); boost::shared_ptr<Region> XMLRegionFactory (const XMLNode&, bool full); @@ -646,6 +650,7 @@ class Session : public PBD::StatefulDestructible uint32_t n_playlists() const; template<class T> void foreach_playlist (T *obj, void (T::*func)(Playlist *)); + void get_playlists (std::vector<Playlist*>&); /* named selections */ @@ -757,16 +762,19 @@ class Session : public PBD::StatefulDestructible /* History (for editors, mixers, UIs etc.) */ void undo (uint32_t n) { - history.undo (n); + _history.undo (n); } + void redo (uint32_t n) { - history.redo (n); + _history.redo (n); } - uint32_t undo_depth() const { return history.undo_depth(); } - uint32_t redo_depth() const { return history.redo_depth(); } - string next_undo() const { return history.next_undo(); } - string next_redo() const { return history.next_redo(); } + UndoHistory& history() { return _history; } + + uint32_t undo_depth() const { return _history.undo_depth(); } + uint32_t redo_depth() const { return _history.redo_depth(); } + string next_undo() const { return _history.next_undo(); } + string next_redo() const { return _history.next_redo(); } void begin_reversible_command (string cmd_name); void commit_reversible_command (Command* cmd = 0); @@ -775,11 +783,11 @@ class Session : public PBD::StatefulDestructible current_trans->add_command (cmd); } - std::map<PBD::ID, PBD::StatefulDestructible*> registry; + std::map<PBD::ID, PBD::StatefulThingWithGoingAway*> registry; // these commands are implemented in libs/ardour/session_command.cc Command *memento_command_factory(XMLNode *n); - void register_with_memento_command_factory(PBD::ID, PBD::StatefulDestructible *); + void register_with_memento_command_factory(PBD::ID, PBD::StatefulThingWithGoingAway *); class GlobalSoloStateCommand : public Command { @@ -944,6 +952,8 @@ class Session : public PBD::StatefulDestructible private: int create (bool& new_session, string* mix_template, nframes_t initial_length); + nframes_t compute_initial_length (); + static const char* _template_suffix; static const char* _statefile_suffix; static const char* _pending_suffix; @@ -1566,7 +1576,7 @@ class Session : public PBD::StatefulDestructible void reverse_diskstream_buffers (); - UndoHistory history; + UndoHistory _history; UndoTransaction* current_trans; GlobalRouteBooleanState get_global_route_boolean (bool (Route::*method)(void) const); @@ -1658,7 +1668,7 @@ class Session : public PBD::StatefulDestructible void* ptr, float opt); - /* number of hardware audio ports we're using, + /* number of hardware ports we're using, based on max (requested,available) */ diff --git a/libs/ardour/ardour/sndfilesource.h b/libs/ardour/ardour/sndfilesource.h index 50fd5e6839..1d07f6888d 100644 --- a/libs/ardour/ardour/sndfilesource.h +++ b/libs/ardour/ardour/sndfilesource.h @@ -36,10 +36,7 @@ class SndFileSource : public AudioFileSource { /* constructor to be called for new in-session files */ SndFileSource (Session&, std::string path, SampleFormat samp_format, HeaderFormat hdr_format, nframes_t rate, - Flag flags = AudioFileSource::Flag (AudioFileSource::Writable| - AudioFileSource::Removable| - AudioFileSource::RemovableIfEmpty| - AudioFileSource::CanRename)); + Flag flags = SndFileSource::default_writable_flags); /* constructor to be called for existing in-session files */ @@ -53,6 +50,18 @@ class SndFileSource : public AudioFileSource { nframes_t natural_position () const; + nframes_t last_capture_start_frame() const; + void mark_capture_start (nframes_t); + void mark_capture_end (); + void clear_capture_marks(); + + bool set_destructive (bool yn); + + static void setup_standard_crossfades (nframes_t sample_rate); + static const AudioFileSource::Flag default_writable_flags; + + static int get_soundfile_info (string path, SoundFileInfo& _info, string& error_msg); + protected: void set_header_timeline_position (); @@ -69,10 +78,32 @@ class SndFileSource : public AudioFileSource { mutable float *interleave_buf; mutable nframes_t interleave_bufsize; - void init (const string &str); + void init (string str); int open(); void close(); int setup_broadcast_info (nframes_t when, struct tm&, time_t); + + /* destructive */ + + static nframes_t xfade_frames; + static gain_t* out_coefficient; + static gain_t* in_coefficient; + + bool _capture_start; + bool _capture_end; + nframes_t capture_start_frame; + nframes_t file_pos; // unit is frames + nframes_t xfade_out_count; + nframes_t xfade_in_count; + Sample* xfade_buf; + + nframes_t crossfade (Sample* data, nframes_t cnt, int dir); + void set_timeline_position (int64_t); + nframes_t destructive_write_unlocked (Sample *dst, nframes_t cnt); + nframes_t nondestructive_write_unlocked (Sample *dst, nframes_t cnt); + void handle_header_position_change (); + + static int64_t get_timecode_info (SNDFILE* sf, SF_BROADCAST_INFO* binfo, bool& exists); }; } // namespace ARDOUR diff --git a/libs/ardour/ardour/source.h b/libs/ardour/ardour/source.h index 8bf66f8b8d..e94b1af54f 100644 --- a/libs/ardour/ardour/source.h +++ b/libs/ardour/ardour/source.h @@ -22,6 +22,7 @@ #define __ardour_source_h__ #include <string> +#include <set> #include <sigc++/signal.h> @@ -33,6 +34,7 @@ namespace ARDOUR { class Session; +class Playlist; class Source : public PBD::StatefulDestructible { @@ -57,22 +59,34 @@ class Source : public PBD::StatefulDestructible virtual void mark_for_remove() = 0; virtual void mark_streaming_write_completed () = 0; - + XMLNode& get_state (); int set_state (const XMLNode&); + void use () { _in_use++; } + void disuse () { if (_in_use) { _in_use--; } } + + void add_playlist (ARDOUR::Playlist*); + void remove_playlist (ARDOUR::Playlist*); + + uint32_t used() const; + + static sigc::signal<void,Source*> SourceCreated; protected: void update_length (jack_nframes_t pos, jack_nframes_t cnt); - + Session& _session; string _name; DataType _type; time_t _timestamp; jack_nframes_t _length; + std::set<ARDOUR::Playlist*> _playlists; + private: + uint32_t _in_use; }; } diff --git a/libs/ardour/ardour/state_manager.h b/libs/ardour/ardour/state_manager.h deleted file mode 100644 index e123b2cb37..0000000000 --- a/libs/ardour/ardour/state_manager.h +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef __ardour_state_manager_h__ -#define __ardour_state_manager_h__ - -#include <list> -#include <string> -#include <set> - -#include <sigc++/signal.h> - -#include <ardour/ardour.h> - -namespace ARDOUR { - -typedef uint32_t state_id_t; - -class StateManager : public virtual sigc::trackable -{ - public: - struct State { - std::string operation; - State (std::string why) : operation (why) {} - virtual ~State() {} - }; - - typedef std::list<State*> StateMap; - - StateManager (); - virtual ~StateManager (); - - virtual void drop_all_states (); - virtual void use_state (state_id_t); - virtual void save_state (std::string why); - - sigc::signal<void,Change> StateChanged; - - state_id_t _current_state_id; - - virtual bool should_save_state () const { return true; } - - static void prohibit_save (); - static void allow_save (const char* why, bool dosave); - - protected: - static bool _allow_save; - static sigc::signal<void,const char*> SaveAllowed; - - StateMap states; - - virtual Change restore_state (State&) = 0; - virtual State* state_factory (std::string why) const = 0; - virtual void send_state_changed (Change); -}; - -} // namespace ARDOUR - -#endif /* __ardour_state_manager_h__ */ diff --git a/libs/ardour/ardour/tempo.h b/libs/ardour/ardour/tempo.h index 7cdbe56cf2..f8751b5d2b 100644 --- a/libs/ardour/ardour/tempo.h +++ b/libs/ardour/ardour/tempo.h @@ -34,7 +34,6 @@ #include <sigc++/signal.h> #include <ardour/ardour.h> -#include <ardour/state_manager.h> class XMLNode; @@ -162,17 +161,7 @@ class TempoSection : public MetricSection, public Tempo { typedef list<MetricSection*> Metrics; -class TempoMapState : public StateManager::State { - public: - TempoMapState (std::string why) - : StateManager::State (why) { - metrics = new Metrics; - } - - Metrics *metrics; -}; - -class TempoMap : public StateManager, public PBD::StatefulDestructible +class TempoMap : public PBD::StatefulDestructible { public: @@ -246,8 +235,6 @@ class TempoMap : public StateManager, public PBD::StatefulDestructible void dump (std::ostream&) const; void clear (); - UndoAction get_memento() const; - /* this is a helper class that we use to be able to keep track of which meter *AND* tempo are in effect at a given point in time. @@ -279,6 +266,8 @@ class TempoMap : public StateManager, public PBD::StatefulDestructible Metric metric_at (nframes_t) const; void bbt_time_with_metric (nframes_t, BBT_Time&, const Metric&) const; + sigc::signal<void,ARDOUR::Change> StateChanged; + private: static Tempo _default_tempo; static Meter _default_meter; @@ -309,16 +298,6 @@ class TempoMap : public StateManager, public PBD::StatefulDestructible int move_metric_section (MetricSection&, const BBT_Time& to); void do_insert (MetricSection* section); - - Change restore_state (StateManager::State&); - StateManager::State* state_factory (std::string why) const; - - bool in_set_state; - - /* override state_manager::save_state so we can check in_set_state */ - - void save_state (std::string why); - }; }; /* namespace ARDOUR */ diff --git a/libs/ardour/ardour/track.h b/libs/ardour/ardour/track.h index 243d0db46d..d7a2da2f46 100644 --- a/libs/ardour/ardour/track.h +++ b/libs/ardour/ardour/track.h @@ -39,6 +39,11 @@ class Track : public Route int set_name (string str, void *src); + TrackMode mode () const { return _mode; } + virtual int set_mode (TrackMode m) { return false; } + virtual bool can_use_mode (TrackMode m, bool& bounce_required) { return false; } + sigc::signal<void> TrackModeChanged; + virtual int roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, nframes_t offset, int declick, bool can_record, bool rec_monitors_input) = 0; @@ -57,9 +62,6 @@ class Track : public Route virtual int use_diskstream (string name) = 0; virtual int use_diskstream (const PBD::ID& id) = 0; - TrackMode mode() const { return _mode; } - void set_mode (TrackMode m); - nframes_t update_total_latency(); void set_latency_delay (nframes_t); @@ -88,7 +90,6 @@ class Track : public Route void set_meter_point (MeterPoint, void* src); - sigc::signal<void> ModeChanged; sigc::signal<void> DiskstreamChanged; sigc::signal<void> FreezeChange; diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h index 61e5f35c95..1138b5208f 100644 --- a/libs/ardour/ardour/types.h +++ b/libs/ardour/ardour/types.h @@ -89,11 +89,17 @@ namespace ARDOUR { Play = 0x4 }; + std::string auto_state_to_string (AutoState); + AutoState string_to_auto_state (std::string); + enum AutoStyle { Absolute = 0x1, Trim = 0x2 }; + std::string auto_style_to_string (AutoStyle); + AutoStyle string_to_auto_style (std::string); + enum AlignStyle { CaptureTime, ExistingMaterial diff --git a/libs/ardour/ardour/vst_plugin.h b/libs/ardour/ardour/vst_plugin.h index 7b8246868c..8034341bcc 100644 --- a/libs/ardour/ardour/vst_plugin.h +++ b/libs/ardour/ardour/vst_plugin.h @@ -31,7 +31,6 @@ #include <sigc++/signal.h> #include <pbd/stateful.h> #include <jack/types.h> -#include <ardour/plugin_state.h> #include <ardour/plugin.h> using std::string; |