summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2017-10-04 00:35:29 +0200
committerRobin Gareus <robin@gareus.org>2017-10-04 00:54:55 +0200
commite31f5d999837b0d0d63dc824c50e9da4acca7244 (patch)
treeef4712ccd25e8cc651ffabcd16e120571c21921d /libs
parent5dd9acf9ab39306277652c28fb5ac4af330e0af0 (diff)
Clean up State API:
* Processor implement get_state(), classes derived from Processor implement protected ::state() -- as documented in processor.h * likewise for Route, Track: make ::state() a protected interface * removal of "full_state", use explicit "template_save" * use RAII/Unwind to skip saving automation-state
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/amp.cc4
-rw-r--r--libs/ardour/ardour/amp.h2
-rw-r--r--libs/ardour/ardour/audio_track.h2
-rw-r--r--libs/ardour/ardour/automatable.h2
-rw-r--r--libs/ardour/ardour/automation_list.h2
-rw-r--r--libs/ardour/ardour/capturing_processor.h11
-rw-r--r--libs/ardour/ardour/delayline.h3
-rw-r--r--libs/ardour/ardour/delivery.h7
-rw-r--r--libs/ardour/ardour/disk_reader.h9
-rw-r--r--libs/ardour/ardour/disk_writer.h4
-rw-r--r--libs/ardour/ardour/internal_return.h10
-rw-r--r--libs/ardour/ardour/internal_send.h9
-rw-r--r--libs/ardour/ardour/io.h12
-rw-r--r--libs/ardour/ardour/io_processor.h2
-rw-r--r--libs/ardour/ardour/lv2_plugin.h2
-rw-r--r--libs/ardour/ardour/meter.h4
-rw-r--r--libs/ardour/ardour/midi_track.h3
-rw-r--r--libs/ardour/ardour/monitor_processor.h2
-rw-r--r--libs/ardour/ardour/pannable.h9
-rw-r--r--libs/ardour/ardour/plugin_insert.h11
-rw-r--r--libs/ardour/ardour/port_insert.h8
-rw-r--r--libs/ardour/ardour/processor.h4
-rw-r--r--libs/ardour/ardour/region.h11
-rw-r--r--libs/ardour/ardour/return.h6
-rw-r--r--libs/ardour/ardour/route.h5
-rw-r--r--libs/ardour/ardour/send.h10
-rw-r--r--libs/ardour/ardour/session.h11
-rw-r--r--libs/ardour/ardour/session_playlists.h2
-rw-r--r--libs/ardour/ardour/sidechain.h6
-rw-r--r--libs/ardour/ardour/track.h8
-rw-r--r--libs/ardour/ardour/unknown_processor.h3
-rw-r--r--libs/ardour/audio_track.cc4
-rw-r--r--libs/ardour/automatable.cc3
-rw-r--r--libs/ardour/automation_list.cc4
-rw-r--r--libs/ardour/capturing_processor.cc4
-rw-r--r--libs/ardour/delayline.cc4
-rw-r--r--libs/ardour/delivery.cc4
-rw-r--r--libs/ardour/disk_reader.cc4
-rw-r--r--libs/ardour/disk_writer.cc4
-rw-r--r--libs/ardour/internal_return.cc10
-rw-r--r--libs/ardour/internal_send.cc10
-rw-r--r--libs/ardour/io.cc4
-rw-r--r--libs/ardour/io_processor.cc8
-rw-r--r--libs/ardour/meter.cc4
-rw-r--r--libs/ardour/midi_track.cc4
-rw-r--r--libs/ardour/monitor_processor.cc4
-rw-r--r--libs/ardour/pannable.cc4
-rw-r--r--libs/ardour/plugin_insert.cc12
-rw-r--r--libs/ardour/port_insert.cc10
-rw-r--r--libs/ardour/processor.cc6
-rw-r--r--libs/ardour/return.cc10
-rw-r--r--libs/ardour/route.cc20
-rw-r--r--libs/ardour/send.cc12
-rw-r--r--libs/ardour/session_playlists.cc18
-rw-r--r--libs/ardour/session_state.cc42
-rw-r--r--libs/ardour/sidechain.cc4
-rw-r--r--libs/ardour/track.cc16
-rw-r--r--libs/ardour/unknown_processor.cc2
58 files changed, 197 insertions, 218 deletions
diff --git a/libs/ardour/amp.cc b/libs/ardour/amp.cc
index 94d3f4617d..cd55514fc1 100644
--- a/libs/ardour/amp.cc
+++ b/libs/ardour/amp.cc
@@ -365,9 +365,9 @@ Amp::apply_simple_gain (AudioBuffer& buf, samplecnt_t nframes, gain_t target)
}
XMLNode&
-Amp::state (bool full_state)
+Amp::state ()
{
- XMLNode& node (Processor::state (full_state));
+ XMLNode& node (Processor::state ());
node.set_property("type", _gain_control->parameter().type() == GainAutomation ? "amp" : "trim");
node.add_child_nocopy (_gain_control->get_state());
diff --git a/libs/ardour/ardour/amp.h b/libs/ardour/ardour/amp.h
index c0ff59d9e7..9ca2b9a404 100644
--- a/libs/ardour/ardour/amp.h
+++ b/libs/ardour/ardour/amp.h
@@ -53,7 +53,7 @@ public:
void setup_gain_automation (samplepos_t start_sample, samplepos_t end_sample, samplecnt_t nframes);
- XMLNode& state (bool full);
+ XMLNode& state ();
int set_state (const XMLNode&, int version);
static gain_t apply_gain (BufferSet& bufs, samplecnt_t sample_rate, samplecnt_t nframes, gain_t initial, gain_t target, bool midi_amp = true);
diff --git a/libs/ardour/ardour/audio_track.h b/libs/ardour/ardour/audio_track.h
index 96cea7e1fe..aecf5d2c9f 100644
--- a/libs/ardour/ardour/audio_track.h
+++ b/libs/ardour/ardour/audio_track.h
@@ -51,7 +51,7 @@ class LIBARDOUR_API AudioTrack : public Track
boost::shared_ptr<AudioFileSource> write_source (uint32_t n = 0);
protected:
- XMLNode& state (bool full);
+ XMLNode& state (bool save_template);
private:
int deprecated_use_diskstream_connections ();
diff --git a/libs/ardour/ardour/automatable.h b/libs/ardour/ardour/automatable.h
index 84164568c5..c7db1c7a21 100644
--- a/libs/ardour/ardour/automatable.h
+++ b/libs/ardour/ardour/automatable.h
@@ -52,6 +52,8 @@ public:
virtual ~Automatable();
+ static bool skip_saving_automation; // to be used only by session-state
+
boost::shared_ptr<Evoral::Control> control_factory(const Evoral::Parameter& id);
boost::shared_ptr<AutomationControl> automation_control (PBD::ID const & id) const;
diff --git a/libs/ardour/ardour/automation_list.h b/libs/ardour/ardour/automation_list.h
index d6de3decda..5ef92735f8 100644
--- a/libs/ardour/ardour/automation_list.h
+++ b/libs/ardour/ardour/automation_list.h
@@ -125,7 +125,7 @@ private:
void create_curve_if_necessary ();
int deserialize_events (const XMLNode&);
- XMLNode& state (bool full, bool need_lock);
+ XMLNode& state (bool save_auto_state, bool need_lock);
XMLNode& serialize_events (bool need_lock);
void maybe_signal_changed ();
diff --git a/libs/ardour/ardour/capturing_processor.h b/libs/ardour/ardour/capturing_processor.h
index fe548d7bbc..12d999c0c3 100644
--- a/libs/ardour/ardour/capturing_processor.h
+++ b/libs/ardour/ardour/capturing_processor.h
@@ -28,23 +28,24 @@ namespace ARDOUR {
class LIBARDOUR_API CapturingProcessor : public Processor
{
- public:
+public:
CapturingProcessor (Session & session, samplecnt_t latency);
~CapturingProcessor();
- public: // main interface
+public: // main interface
BufferSet const & get_capture_buffers() const { return capture_buffers; }
- public: // Processor overrides
+public: // Processor overrides
bool display_to_user() const { return false; }
int set_block_size (pframes_t nframes);
void run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool result_required);
bool configure_io (ChanCount in, ChanCount out);
bool can_support_io_configuration (const ChanCount& in, ChanCount& out);
- virtual XMLNode& state (bool);
- private:
+protected:
+ XMLNode& state ();
+private:
void realloc_buffers();
samplecnt_t block_size;
diff --git a/libs/ardour/ardour/delayline.h b/libs/ardour/ardour/delayline.h
index 80a032374e..0618374295 100644
--- a/libs/ardour/ardour/delayline.h
+++ b/libs/ardour/ardour/delayline.h
@@ -56,7 +56,8 @@ public:
bool set_name (const std::string& str);
- XMLNode& state (bool full);
+protected:
+ XMLNode& state ();
private:
void allocate_pending_buffers (samplecnt_t);
diff --git a/libs/ardour/ardour/delivery.h b/libs/ardour/ardour/delivery.h
index ce5b050982..451d7bdd0c 100644
--- a/libs/ardour/ardour/delivery.h
+++ b/libs/ardour/ardour/delivery.h
@@ -84,7 +84,6 @@ public:
PBD::Signal0<void> MuteChange;
- XMLNode& state (bool full);
int set_state (const XMLNode&, int version);
/* Panning */
@@ -103,7 +102,9 @@ public:
uint32_t pans_required() const { return _configured_input.n_audio(); }
virtual uint32_t pan_outs() const;
- protected:
+protected:
+ XMLNode& state ();
+
Role _role;
BufferSet* _output_buffers;
gain_t _current_gain;
@@ -111,7 +112,7 @@ public:
gain_t target_gain ();
- private:
+private:
bool _no_outs_cuz_we_no_monitor;
boost::shared_ptr<MuteMaster> _mute_master;
diff --git a/libs/ardour/ardour/disk_reader.h b/libs/ardour/ardour/disk_reader.h
index 4bc78cbd67..cb37bc6cb1 100644
--- a/libs/ardour/ardour/disk_reader.h
+++ b/libs/ardour/ardour/disk_reader.h
@@ -35,7 +35,7 @@ template<typename T> class MidiRingBuffer;
class LIBARDOUR_API DiskReader : public DiskIOProcessor
{
- public:
+public:
DiskReader (Session&, std::string const & name, DiskIOProcessor::Flag f = DiskIOProcessor::Flag (0));
~DiskReader ();
@@ -52,7 +52,6 @@ class LIBARDOUR_API DiskReader : public DiskIOProcessor
int overwrite_existing_buffers ();
void set_pending_overwrite (bool yn);
- virtual XMLNode& state (bool full);
int set_state (const XMLNode&, int version);
PBD::Signal0<void> AlignmentStyleChanged;
@@ -99,17 +98,19 @@ class LIBARDOUR_API DiskReader : public DiskIOProcessor
static void set_no_disk_output (bool yn);
static bool no_disk_output() { return _no_disk_output; }
- protected:
+protected:
friend class Track;
friend class MidiTrack;
+ XMLNode& state ();
+
void resolve_tracker (Evoral::EventSink<samplepos_t>& buffer, samplepos_t time);
void playlist_changed (const PBD::PropertyChange&);
int use_playlist (DataType, boost::shared_ptr<Playlist>);
void playlist_ranges_moved (std::list< Evoral::RangeMove<samplepos_t> > const &, bool);
- private:
+private:
/** The number of samples by which this diskstream's output should be delayed
with respect to the transport sample. This is used for latency compensation.
*/
diff --git a/libs/ardour/ardour/disk_writer.h b/libs/ardour/ardour/disk_writer.h
index 59267f5f8f..11d795c11a 100644
--- a/libs/ardour/ardour/disk_writer.h
+++ b/libs/ardour/ardour/disk_writer.h
@@ -55,7 +55,6 @@ public:
void non_realtime_locate (samplepos_t);
void realtime_handle_transport_stopped ();
- virtual XMLNode& state (bool full);
int set_state (const XMLNode&, int version);
virtual bool set_write_source_name (const std::string& str);
@@ -133,6 +132,9 @@ public:
protected:
friend class Track;
+
+ virtual XMLNode& state ();
+
int do_flush (RunContext context, bool force = false);
void get_input_sources ();
diff --git a/libs/ardour/ardour/internal_return.h b/libs/ardour/ardour/internal_return.h
index dbc9bab3f2..71b8fc354d 100644
--- a/libs/ardour/ardour/internal_return.h
+++ b/libs/ardour/ardour/internal_return.h
@@ -31,12 +31,9 @@ class InternalSend;
class LIBARDOUR_API InternalReturn : public Return
{
- public:
+public:
InternalReturn (Session&);
- XMLNode& state (bool full);
- XMLNode& get_state ();
-
void run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool);
bool configure_io (ChanCount, ChanCount);
bool can_support_io_configuration (const ChanCount& in, ChanCount& out);
@@ -46,7 +43,10 @@ class LIBARDOUR_API InternalReturn : public Return
void set_playback_offset (samplecnt_t cnt);
- private:
+protected:
+ XMLNode& state ();
+
+private:
/** sends that we are receiving data from */
std::list<InternalSend*> _sends;
/** mutex to protect _sends */
diff --git a/libs/ardour/ardour/internal_send.h b/libs/ardour/ardour/internal_send.h
index c46236c559..8547f73b08 100644
--- a/libs/ardour/ardour/internal_send.h
+++ b/libs/ardour/ardour/internal_send.h
@@ -27,7 +27,7 @@ namespace ARDOUR {
class LIBARDOUR_API InternalSend : public Send
{
- public:
+public:
InternalSend (Session&, boost::shared_ptr<Pannable>, boost::shared_ptr<MuteMaster>, boost::shared_ptr<Route> send_from, boost::shared_ptr<Route> send_to, Delivery::Role role = Delivery::Aux, bool ignore_bitslot = false);
virtual ~InternalSend ();
@@ -35,8 +35,6 @@ class LIBARDOUR_API InternalSend : public Send
bool set_name (const std::string&);
bool visible() const;
- XMLNode& state(bool full);
- XMLNode& get_state(void);
int set_state(const XMLNode& node, int version);
void cycle_start (pframes_t);
@@ -62,7 +60,10 @@ class LIBARDOUR_API InternalSend : public Send
static PBD::Signal1<void, pframes_t> CycleStart;
- private:
+protected:
+ XMLNode& state();
+
+private:
BufferSet mixbufs;
boost::shared_ptr<Route> _send_from;
boost::shared_ptr<Route> _send_to;
diff --git a/libs/ardour/ardour/io.h b/libs/ardour/ardour/io.h
index 0eacaa973a..48f3653c2b 100644
--- a/libs/ardour/ardour/io.h
+++ b/libs/ardour/ardour/io.h
@@ -67,7 +67,7 @@ class UserBundle;
*/
class LIBARDOUR_API IO : public SessionObject, public Latent
{
- public:
+public:
static const std::string state_node_name;
enum Direction {
@@ -147,8 +147,8 @@ class LIBARDOUR_API IO : public SessionObject, public Latent
*/
PBD::Signal2<void, IOChange, void *> changed;
- virtual XMLNode& state (bool full);
XMLNode& get_state (void);
+
int set_state (const XMLNode&, int version);
int set_state_2X (const XMLNode&, int, bool);
static void prepare_for_reset (XMLNode&, const std::string&);
@@ -205,17 +205,17 @@ class LIBARDOUR_API IO : public SessionObject, public Latent
int set_ports (const std::string& str);
- private:
- mutable Glib::Threads::Mutex io_lock;
+protected:
+ virtual XMLNode& state ();
- protected:
PortSet _ports;
Direction _direction;
DataType _default_type;
bool _active;
bool _sendish;
- private:
+private:
+ mutable Glib::Threads::Mutex io_lock;
int connecting_became_legal ();
PBD::ScopedConnection connection_legal_c;
diff --git a/libs/ardour/ardour/io_processor.h b/libs/ardour/ardour/io_processor.h
index f17c338155..7dcbb630ab 100644
--- a/libs/ardour/ardour/io_processor.h
+++ b/libs/ardour/ardour/io_processor.h
@@ -74,7 +74,7 @@ class LIBARDOUR_API IOProcessor : public Processor
PBD::Signal2<void,IOProcessor*,bool> AutomationPlaybackChanged;
PBD::Signal2<void,IOProcessor*,uint32_t> AutomationChanged;
- XMLNode& state (bool full_state);
+ XMLNode& state ();
int set_state (const XMLNode&, int version);
static void prepare_for_reset (XMLNode& state, const std::string& name);
diff --git a/libs/ardour/ardour/lv2_plugin.h b/libs/ardour/ardour/lv2_plugin.h
index 9e432c1180..25fda7400a 100644
--- a/libs/ardour/ardour/lv2_plugin.h
+++ b/libs/ardour/ardour/lv2_plugin.h
@@ -63,7 +63,7 @@ class LIBARDOUR_API LV2Plugin : public ARDOUR::Plugin, public ARDOUR::Workee
LV2Plugin (const LV2Plugin &);
~LV2Plugin ();
- static bool force_state_save;
+ static bool force_state_save; // to be used only by session-state
std::string unique_id () const;
const char* uri () const;
diff --git a/libs/ardour/ardour/meter.h b/libs/ardour/ardour/meter.h
index 52ca751932..1f7ad30216 100644
--- a/libs/ardour/ardour/meter.h
+++ b/libs/ardour/ardour/meter.h
@@ -77,10 +77,12 @@ public:
void set_type(MeterType t);
MeterType get_type() { return _meter_type; }
- XMLNode& state (bool full);
PBD::Signal1<void, MeterType> TypeChanged;
+protected:
+ XMLNode& state ();
+
private:
friend class IO;
diff --git a/libs/ardour/ardour/midi_track.h b/libs/ardour/ardour/midi_track.h
index 417d7688f6..abee445e01 100644
--- a/libs/ardour/ardour/midi_track.h
+++ b/libs/ardour/ardour/midi_track.h
@@ -133,7 +133,8 @@ public:
PBD::Signal0<void> InputActiveChanged;
protected:
- XMLNode& state (bool full);
+
+ XMLNode& state (bool save_template);
void act_on_mute ();
void monitoring_changed (bool, PBD::Controllable::GroupControlDisposition);
diff --git a/libs/ardour/ardour/monitor_processor.h b/libs/ardour/ardour/monitor_processor.h
index 1d537c0937..63e153e48e 100644
--- a/libs/ardour/ardour/monitor_processor.h
+++ b/libs/ardour/ardour/monitor_processor.h
@@ -126,7 +126,7 @@ public:
void run (BufferSet& /*bufs*/, samplepos_t /*start_sample*/, samplepos_t /*end_sample*/, double /*speed*/, pframes_t /*nframes*/, bool /*result_required*/);
- XMLNode& state (bool full);
+ XMLNode& state ();
int set_state (const XMLNode&, int /* version */);
bool configure_io (ChanCount in, ChanCount out);
diff --git a/libs/ardour/ardour/pannable.h b/libs/ardour/ardour/pannable.h
index f96670afec..afdb512342 100644
--- a/libs/ardour/ardour/pannable.h
+++ b/libs/ardour/ardour/pannable.h
@@ -38,7 +38,7 @@ class Panner;
class LIBARDOUR_API Pannable : public PBD::Stateful, public Automatable, public SessionHandleRef
{
- public:
+public:
Pannable (Session& s);
~Pannable ();
@@ -73,12 +73,13 @@ class LIBARDOUR_API Pannable : public PBD::Stateful, public Automatable, public
bool touch_enabled() const { return _auto_state & (Touch | Latch); }
XMLNode& get_state ();
- XMLNode& state (bool full_state);
int set_state (const XMLNode&, int version);
bool has_state() const { return _has_state; }
- protected:
+protected:
+ virtual XMLNode& state ();
+
boost::weak_ptr<Panner> _panner;
AutoState _auto_state;
gint _touching;
@@ -87,7 +88,7 @@ class LIBARDOUR_API Pannable : public PBD::Stateful, public Automatable, public
void control_auto_state_changed (AutoState);
- private:
+private:
void value_changed ();
};
diff --git a/libs/ardour/ardour/plugin_insert.h b/libs/ardour/ardour/plugin_insert.h
index 1076c5198f..e13986c2c7 100644
--- a/libs/ardour/ardour/plugin_insert.h
+++ b/libs/ardour/ardour/plugin_insert.h
@@ -50,14 +50,12 @@ class Plugin;
*/
class LIBARDOUR_API PluginInsert : public Processor
{
- public:
+public:
PluginInsert (Session&, boost::shared_ptr<Plugin> = boost::shared_ptr<Plugin>());
~PluginInsert ();
static const std::string port_automation_node_name;
- XMLNode& state(bool);
- XMLNode& get_state(void);
int set_state(const XMLNode&, int version);
void update_id (PBD::ID);
void set_owner (SessionObject*);
@@ -215,7 +213,7 @@ class LIBARDOUR_API PluginInsert : public Processor
double get_value (void) const;
XMLNode& get_state();
- protected:
+ protected:
void actually_set_value (double value, PBD::Controllable::GroupControlDisposition);
private:
@@ -301,7 +299,10 @@ class LIBARDOUR_API PluginInsert : public Processor
bool custom_cfg; ///< custom config (if not strict)
};
- private:
+protected:
+ XMLNode& state ();
+
+private:
/* disallow copy construction */
PluginInsert (const PluginInsert&);
diff --git a/libs/ardour/ardour/port_insert.h b/libs/ardour/ardour/port_insert.h
index 2461f8a90f..e96779c63e 100644
--- a/libs/ardour/ardour/port_insert.h
+++ b/libs/ardour/ardour/port_insert.h
@@ -45,12 +45,10 @@ class Pannable;
*/
class LIBARDOUR_API PortInsert : public IOProcessor
{
- public:
+public:
PortInsert (Session&, boost::shared_ptr<Pannable>, boost::shared_ptr<MuteMaster> mm);
~PortInsert ();
- XMLNode& state(bool full);
- XMLNode& get_state(void);
int set_state (const XMLNode&, int version);
void run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool);
@@ -82,7 +80,9 @@ class LIBARDOUR_API PortInsert : public IOProcessor
static std::string name_and_id_new_insert (Session&, uint32_t&);
- private:
+protected:
+ XMLNode& state ();
+private:
/* disallow copy construction */
PortInsert (const PortInsert&);
diff --git a/libs/ardour/ardour/processor.h b/libs/ardour/ardour/processor.h
index 8dfc1494d3..f3325a1194 100644
--- a/libs/ardour/ardour/processor.h
+++ b/libs/ardour/ardour/processor.h
@@ -120,8 +120,7 @@ class LIBARDOUR_API Processor : public SessionObject, public Automatable, public
smoothly.
*/
- virtual XMLNode& state (bool full);
- XMLNode& get_state (void);
+ XMLNode& get_state ();
int set_state (const XMLNode&, int version);
virtual void set_pre_fader (bool);
@@ -147,6 +146,7 @@ class LIBARDOUR_API Processor : public SessionObject, public Automatable, public
SessionObject* owner() const;
protected:
+ virtual XMLNode& state ();
virtual int set_state_2X (const XMLNode&, int version);
int _pending_active;
diff --git a/libs/ardour/ardour/region.h b/libs/ardour/ardour/region.h
index 1ae75d1469..a147a6163a 100644
--- a/libs/ardour/ardour/region.h
+++ b/libs/ardour/ardour/region.h
@@ -88,7 +88,7 @@ class LIBARDOUR_API Region
, public Trimmable
, public Movable
{
- public:
+public:
typedef std::vector<boost::shared_ptr<Source> > SourceList;
static void make_property_quarks ();
@@ -281,7 +281,6 @@ class LIBARDOUR_API Region
/* serialization */
XMLNode& get_state ();
- virtual XMLNode& state ();
virtual int set_state (const XMLNode&, int version);
virtual boost::shared_ptr<Region> get_parent() const;
@@ -344,7 +343,9 @@ class LIBARDOUR_API Region
void drop_sources ();
- protected:
+protected:
+ virtual XMLNode& state ();
+
friend class RegionFactory;
/** Construct a region from multiple sources*/
@@ -366,7 +367,7 @@ class LIBARDOUR_API Region
return false;
}
- protected:
+protected:
void send_change (const PBD::PropertyChange&);
virtual int _set_state (const XMLNode&, int version, PBD::PropertyChange& what_changed, bool send_signal);
@@ -412,7 +413,7 @@ class LIBARDOUR_API Region
samplepos_t _transient_analysis_start;
samplepos_t _transient_analysis_end;
- private:
+private:
void mid_thaw (const PBD::PropertyChange&);
virtual void trim_to_internal (samplepos_t position, samplecnt_t length, const int32_t sub_num);
diff --git a/libs/ardour/ardour/return.h b/libs/ardour/ardour/return.h
index 18845f9815..0dbf5eb1d3 100644
--- a/libs/ardour/ardour/return.h
+++ b/libs/ardour/ardour/return.h
@@ -51,8 +51,6 @@ public:
bool metering() const { return _metering; }
void set_metering (bool yn) { _metering = yn; }
- XMLNode& state(bool full);
- XMLNode& get_state(void);
int set_state(const XMLNode&, int version);
uint32_t pans_required() const { return _configured_input.n_audio(); }
@@ -63,7 +61,9 @@ public:
static uint32_t how_many_returns();
static std::string name_and_id_new_return (Session&, uint32_t&);
- protected:
+protected:
+ XMLNode& state();
+
bool _metering;
boost::shared_ptr<GainControl> _gain_control;
boost::shared_ptr<Amp> _amp;
diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h
index 830ef4bab3..8500232c27 100644
--- a/libs/ardour/ardour/route.h
+++ b/libs/ardour/ardour/route.h
@@ -390,10 +390,9 @@ public:
PBD::Signal0<void> io_changed;
/* stateful */
-
XMLNode& get_state();
+ XMLNode& get_template();
virtual int set_state (const XMLNode&, int version);
- virtual XMLNode& get_template();
XMLNode& get_processor_state ();
void set_processor_state (const XMLNode&);
@@ -674,7 +673,7 @@ protected:
virtual ChanCount input_streams () const;
- virtual XMLNode& state(bool);
+ virtual XMLNode& state (bool save_template);
int configure_processors (ProcessorStreams*);
diff --git a/libs/ardour/ardour/send.h b/libs/ardour/ardour/send.h
index 8d9cdaa0af..c37055cd94 100644
--- a/libs/ardour/ardour/send.h
+++ b/libs/ardour/ardour/send.h
@@ -36,7 +36,7 @@ class DelayLine;
class LIBARDOUR_API Send : public Delivery
{
- public:
+public:
Send (Session&, boost::shared_ptr<Pannable> pannable, boost::shared_ptr<MuteMaster>, Delivery::Role r = Delivery::Send, bool ignore_bitslot = false);
virtual ~Send ();
@@ -51,8 +51,6 @@ class LIBARDOUR_API Send : public Delivery
bool metering() const { return _metering; }
void set_metering (bool yn) { _metering = yn; }
- XMLNode& state (bool full);
- XMLNode& get_state ();
int set_state(const XMLNode&, int version);
PBD::Signal0<void> SelfDestruct;
@@ -83,7 +81,9 @@ class LIBARDOUR_API Send : public Delivery
static uint32_t how_many_sends();
static std::string name_and_id_new_send (Session&, Delivery::Role r, uint32_t&, bool);
- protected:
+protected:
+ XMLNode& state ();
+
bool _metering;
boost::shared_ptr<GainControl> _gain_control;
boost::shared_ptr<Amp> _amp;
@@ -91,7 +91,7 @@ class LIBARDOUR_API Send : public Delivery
boost::shared_ptr<DelayLine> _send_delay;
boost::shared_ptr<DelayLine> _thru_delay;
- private:
+private:
/* disallow copy construction */
Send (const Send&);
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index 88195e626a..d7c621d51f 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -563,10 +563,7 @@ public:
std::vector<std::string> possible_states() const;
static std::vector<std::string> possible_states (std::string path);
- XMLNode& get_state();
- int set_state(const XMLNode& node, int version); // not idempotent
- XMLNode& get_template();
- bool export_track_state (boost::shared_ptr<RouteList> rl, const std::string& path);
+ bool export_track_state (boost::shared_ptr<RouteList> rl, const std::string& path);
/// The instant xml file is written to the session directory
void add_instant_xml (XMLNode&, bool write_to_config = true);
@@ -1903,7 +1900,11 @@ private:
SwitchToSnapshot
};
- XMLNode& state(bool, snapshot_t snapshot_type = NormalSave);
+ XMLNode& state (bool save_template, snapshot_t snapshot_type = NormalSave);
+
+ XMLNode& get_state ();
+ int set_state (const XMLNode& node, int version); // not idempotent
+ XMLNode& get_template ();
/* click track */
typedef std::list<Click*> Clicks;
diff --git a/libs/ardour/ardour/session_playlists.h b/libs/ardour/ardour/session_playlists.h
index 273b12d040..66f4f2c537 100644
--- a/libs/ardour/ardour/session_playlists.h
+++ b/libs/ardour/ardour/session_playlists.h
@@ -73,7 +73,7 @@ private:
void find_equivalent_playlist_regions (boost::shared_ptr<Region>, std::vector<boost::shared_ptr<Region> >& result);
void update_after_tempo_map_change ();
- void add_state (XMLNode *, bool);
+ void add_state (XMLNode*, bool save_template, bool include_unused);
bool maybe_delete_unused (boost::function<int(boost::shared_ptr<Playlist>)>);
int load (Session &, const XMLNode&);
int load_unused (Session &, const XMLNode&);
diff --git a/libs/ardour/ardour/sidechain.h b/libs/ardour/ardour/sidechain.h
index f3755496c2..dd608c8951 100644
--- a/libs/ardour/ardour/sidechain.h
+++ b/libs/ardour/ardour/sidechain.h
@@ -39,8 +39,10 @@ public:
bool can_support_io_configuration (const ChanCount& in, ChanCount& out);
bool configure_io (ChanCount in, ChanCount out);
- XMLNode& state(bool full);
- int set_state(const XMLNode&, int version);
+ int set_state(const XMLNode&, int version);
+
+protected:
+ XMLNode& state ();
private:
/* disallow copy construction */
diff --git a/libs/ardour/ardour/track.h b/libs/ardour/ardour/track.h
index 7b21a77591..6b024274f0 100644
--- a/libs/ardour/ardour/track.h
+++ b/libs/ardour/ardour/track.h
@@ -50,7 +50,7 @@ class RecordSafeControl;
*/
class LIBARDOUR_API Track : public Route, public Recordable
{
- public:
+public:
Track (Session&, std::string name, PresentationInfo::Flag f = PresentationInfo::Flag (0), TrackMode m = Normal, DataType default_type = DataType::AUDIO);
virtual ~Track ();
@@ -110,8 +110,6 @@ class LIBARDOUR_API Track : public Route, public Recordable
virtual int export_stuff (BufferSet& bufs, samplepos_t start_sample, samplecnt_t nframes,
boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export, bool for_freeze) = 0;
- XMLNode& get_state();
- XMLNode& get_template();
virtual int set_state (const XMLNode&, int version);
static void zero_diskstream_id_in_xml (XMLNode&);
@@ -175,8 +173,8 @@ class LIBARDOUR_API Track : public Route, public Recordable
PBD::Signal0<void> SpeedChanged;
PBD::Signal0<void> AlignmentStyleChanged;
- protected:
- XMLNode& state (bool full);
+protected:
+ XMLNode& state (bool save_template);
boost::shared_ptr<Playlist> _playlists[DataType::num_types];
diff --git a/libs/ardour/ardour/unknown_processor.h b/libs/ardour/ardour/unknown_processor.h
index 33d32f5b34..c329da201e 100644
--- a/libs/ardour/ardour/unknown_processor.h
+++ b/libs/ardour/ardour/unknown_processor.h
@@ -48,7 +48,8 @@ public:
bool can_support_io_configuration (const ChanCount &, ChanCount &);
void run (BufferSet& /*bufs*/, samplepos_t /*start_sample*/, samplepos_t /*end_sample*/, double /*speed*/, pframes_t /*nframes*/, bool /*result_required*/);
- XMLNode & state (bool);
+protected:
+ XMLNode& state ();
private:
XMLNode _state;
diff --git a/libs/ardour/audio_track.cc b/libs/ardour/audio_track.cc
index cfcb1fbf14..12c2f1975b 100644
--- a/libs/ardour/audio_track.cc
+++ b/libs/ardour/audio_track.cc
@@ -95,9 +95,9 @@ AudioTrack::set_state (const XMLNode& node, int version)
}
XMLNode&
-AudioTrack::state (bool full_state)
+AudioTrack::state (bool save_template)
{
- XMLNode& root (Track::state(full_state));
+ XMLNode& root (Track::state (save_template));
XMLNode* freeze_node;
if (_freeze_record.playlist) {
diff --git a/libs/ardour/automatable.cc b/libs/ardour/automatable.cc
index 26961f633c..65b83b4b6e 100644
--- a/libs/ardour/automatable.cc
+++ b/libs/ardour/automatable.cc
@@ -48,6 +48,9 @@ using namespace std;
using namespace ARDOUR;
using namespace PBD;
+/* used for templates (previously: !full_state) */
+bool Automatable::skip_saving_automation = false;
+
const string Automatable::xml_node_name = X_("Automation");
Automatable::Automatable(Session& session)
diff --git a/libs/ardour/automation_list.cc b/libs/ardour/automation_list.cc
index b3a727ff9e..cb09786c64 100644
--- a/libs/ardour/automation_list.cc
+++ b/libs/ardour/automation_list.cc
@@ -344,7 +344,7 @@ AutomationList::get_state ()
}
XMLNode&
-AutomationList::state (bool full, bool need_lock)
+AutomationList::state (bool save_auto_state, bool need_lock)
{
XMLNode* root = new XMLNode (X_("AutomationList"));
@@ -352,7 +352,7 @@ AutomationList::state (bool full, bool need_lock)
root->set_property ("id", id());
root->set_property ("interpolation-style", _interpolation);
- if (full) {
+ if (save_auto_state) {
/* never serialize state with Write enabled - too dangerous
for the user's data
*/
diff --git a/libs/ardour/capturing_processor.cc b/libs/ardour/capturing_processor.cc
index 496bfc53f2..6e9049472a 100644
--- a/libs/ardour/capturing_processor.cc
+++ b/libs/ardour/capturing_processor.cc
@@ -84,9 +84,9 @@ CapturingProcessor::realloc_buffers()
}
XMLNode &
-CapturingProcessor::state (bool full)
+CapturingProcessor::state ()
{
- XMLNode& node = Processor::state (full);
+ XMLNode& node = Processor::state ();
node.set_property (X_("type"), X_("capture"));
return node;
diff --git a/libs/ardour/delayline.cc b/libs/ardour/delayline.cc
index 0416a9a0bb..19ef460fd0 100644
--- a/libs/ardour/delayline.cc
+++ b/libs/ardour/delayline.cc
@@ -385,9 +385,9 @@ DelayLine::flush()
}
XMLNode&
-DelayLine::state (bool full_state)
+DelayLine::state ()
{
- XMLNode& node (Processor::state (full_state));
+ XMLNode& node (Processor::state ());
node.set_property("type", "delay");
return node;
}
diff --git a/libs/ardour/delivery.cc b/libs/ardour/delivery.cc
index 88d735bd5e..27a12dbc29 100644
--- a/libs/ardour/delivery.cc
+++ b/libs/ardour/delivery.cc
@@ -355,9 +355,9 @@ out:
}
XMLNode&
-Delivery::state (bool full_state)
+Delivery::state ()
{
- XMLNode& node (IOProcessor::state (full_state));
+ XMLNode& node (IOProcessor::state ());
if (_role & Main) {
node.set_property("type", "main-outs");
diff --git a/libs/ardour/disk_reader.cc b/libs/ardour/disk_reader.cc
index 9bd433718e..98643f8ebd 100644
--- a/libs/ardour/disk_reader.cc
+++ b/libs/ardour/disk_reader.cc
@@ -126,9 +126,9 @@ DiskReader::set_name (string const & str)
}
XMLNode&
-DiskReader::state (bool full)
+DiskReader::state ()
{
- XMLNode& node (DiskIOProcessor::state (full));
+ XMLNode& node (DiskIOProcessor::state ());
node.set_property(X_("type"), X_("diskreader"));
return node;
}
diff --git a/libs/ardour/disk_writer.cc b/libs/ardour/disk_writer.cc
index f9ff347280..0efc2e2811 100644
--- a/libs/ardour/disk_writer.cc
+++ b/libs/ardour/disk_writer.cc
@@ -272,9 +272,9 @@ DiskWriter::set_align_style (AlignStyle a, bool force)
}
XMLNode&
-DiskWriter::state (bool full)
+DiskWriter::state ()
{
- XMLNode& node (DiskIOProcessor::state (full));
+ XMLNode& node (DiskIOProcessor::state ());
node.set_property (X_("type"), X_("diskwriter"));
node.set_property (X_("record-safe"), (_record_safe ? X_("yes" : "no")));
return node;
diff --git a/libs/ardour/internal_return.cc b/libs/ardour/internal_return.cc
index 0f7eb295d6..a162628853 100644
--- a/libs/ardour/internal_return.cc
+++ b/libs/ardour/internal_return.cc
@@ -77,20 +77,14 @@ InternalReturn::set_playback_offset (samplecnt_t cnt)
}
XMLNode&
-InternalReturn::state (bool full)
+InternalReturn::state ()
{
- XMLNode& node (Return::state (full));
+ XMLNode& node (Return::state ());
/* override type */
node.set_property("type", "intreturn");
return node;
}
-XMLNode&
-InternalReturn::get_state()
-{
- return state (true);
-}
-
bool
InternalReturn::can_support_io_configuration (const ChanCount& in, ChanCount& out)
{
diff --git a/libs/ardour/internal_send.cc b/libs/ardour/internal_send.cc
index 72e58b6056..9749dab760 100644
--- a/libs/ardour/internal_send.cc
+++ b/libs/ardour/internal_send.cc
@@ -297,9 +297,9 @@ InternalSend::feeds (boost::shared_ptr<Route> other) const
}
XMLNode&
-InternalSend::state (bool full)
+InternalSend::state ()
{
- XMLNode& node (Send::state (full));
+ XMLNode& node (Send::state ());
/* this replaces any existing "type" property */
@@ -313,12 +313,6 @@ InternalSend::state (bool full)
return node;
}
-XMLNode&
-InternalSend::get_state()
-{
- return state (true);
-}
-
int
InternalSend::set_state (const XMLNode& node, int version)
{
diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc
index a2a46270c8..3628ec9b48 100644
--- a/libs/ardour/io.cc
+++ b/libs/ardour/io.cc
@@ -498,11 +498,11 @@ IO::ensure_io (ChanCount count, bool clear, void* src)
XMLNode&
IO::get_state ()
{
- return state (true);
+ return state ();
}
XMLNode&
-IO::state (bool /*full_state*/)
+IO::state ()
{
XMLNode* node = new XMLNode (state_node_name);
int n;
diff --git a/libs/ardour/io_processor.cc b/libs/ardour/io_processor.cc
index 85ae6f90f3..a7e13fecb4 100644
--- a/libs/ardour/io_processor.cc
+++ b/libs/ardour/io_processor.cc
@@ -106,15 +106,15 @@ IOProcessor::set_output (boost::shared_ptr<IO> io)
}
XMLNode&
-IOProcessor::state (bool full_state)
+IOProcessor::state ()
{
- XMLNode& node (Processor::state (full_state));
+ XMLNode& node (Processor::state ());
node.set_property ("own-input", _own_input);
if (_input) {
if (_own_input) {
- XMLNode& i (_input->state (full_state));
+ XMLNode& i (_input->get_state ());
// i.name() = X_("output");
node.add_child_nocopy (i);
} else {
@@ -126,7 +126,7 @@ IOProcessor::state (bool full_state)
if (_output) {
if (_own_output) {
- XMLNode& o (_output->state (full_state));
+ XMLNode& o (_output->get_state ());
node.add_child_nocopy (o);
} else {
node.set_property ("output", _output->name ());
diff --git a/libs/ardour/meter.cc b/libs/ardour/meter.cc
index c0b029a158..da97041657 100644
--- a/libs/ardour/meter.cc
+++ b/libs/ardour/meter.cc
@@ -427,9 +427,9 @@ PeakMeter::set_type(MeterType t)
}
XMLNode&
-PeakMeter::state (bool full_state)
+PeakMeter::state ()
{
- XMLNode& node (Processor::state (full_state));
+ XMLNode& node (Processor::state ());
node.set_property("type", "meter");
return node;
}
diff --git a/libs/ardour/midi_track.cc b/libs/ardour/midi_track.cc
index 11e6bec41b..a6a3b9f6f8 100644
--- a/libs/ardour/midi_track.cc
+++ b/libs/ardour/midi_track.cc
@@ -195,9 +195,9 @@ MidiTrack::set_state (const XMLNode& node, int version)
}
XMLNode&
-MidiTrack::state(bool full_state)
+MidiTrack::state(bool save_template)
{
- XMLNode& root (Track::state(full_state));
+ XMLNode& root (Track::state (save_template));
XMLNode* freeze_node;
char buf[64];
diff --git a/libs/ardour/monitor_processor.cc b/libs/ardour/monitor_processor.cc
index e035d6a346..56d8f879d6 100644
--- a/libs/ardour/monitor_processor.cc
+++ b/libs/ardour/monitor_processor.cc
@@ -218,9 +218,9 @@ MonitorProcessor::set_state (const XMLNode& node, int version)
}
XMLNode&
-MonitorProcessor::state (bool full)
+MonitorProcessor::state ()
{
- XMLNode& node(Processor::state(full));
+ XMLNode& node(Processor::state ());
/* this replaces any existing "type" property */
diff --git a/libs/ardour/pannable.cc b/libs/ardour/pannable.cc
index 32bf2fe33f..09a63cca3f 100644
--- a/libs/ardour/pannable.cc
+++ b/libs/ardour/pannable.cc
@@ -166,11 +166,11 @@ Pannable::stop_touch (double when)
XMLNode&
Pannable::get_state ()
{
- return state (true);
+ return state ();
}
XMLNode&
-Pannable::state (bool /*full*/)
+Pannable::state ()
{
XMLNode* node = new XMLNode (X_("Pannable"));
diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc
index 6094b963bb..21bc6b5d3d 100644
--- a/libs/ardour/plugin_insert.cc
+++ b/libs/ardour/plugin_insert.cc
@@ -2358,15 +2358,9 @@ PluginInsert::automatic_can_support_io_configuration (ChanCount const & inx, Cha
XMLNode&
-PluginInsert::get_state ()
+PluginInsert::state ()
{
- return state (true);
-}
-
-XMLNode&
-PluginInsert::state (bool full)
-{
- XMLNode& node = Processor::state (full);
+ XMLNode& node = Processor::state ();
node.set_property("type", _plugins[0]->state_node_name());
node.set_property("unique-id", _plugins[0]->unique_id());
@@ -2391,7 +2385,7 @@ PluginInsert::state (bool full)
node.add_child_nocopy (* _thru_map.state ("ThruMap"));
if (_sidechain) {
- node.add_child_nocopy (_sidechain->state (full));
+ node.add_child_nocopy (_sidechain->get_state ());
}
_plugins[0]->set_insert_id(this->id());
diff --git a/libs/ardour/port_insert.cc b/libs/ardour/port_insert.cc
index ed165a6988..a6a05cede7 100644
--- a/libs/ardour/port_insert.cc
+++ b/libs/ardour/port_insert.cc
@@ -159,15 +159,9 @@ PortInsert::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_samp
}
XMLNode&
-PortInsert::get_state(void)
+PortInsert::state ()
{
- return state (true);
-}
-
-XMLNode&
-PortInsert::state (bool full)
-{
- XMLNode& node = IOProcessor::state(full);
+ XMLNode& node = IOProcessor::state ();
node.set_property ("type", "port");
node.set_property ("bitslot", _bitslot);
node.set_property ("latency", _measured_latency);
diff --git a/libs/ardour/processor.cc b/libs/ardour/processor.cc
index 03510130a2..c6e6c21360 100644
--- a/libs/ardour/processor.cc
+++ b/libs/ardour/processor.cc
@@ -102,7 +102,7 @@ Processor::~Processor ()
XMLNode&
Processor::get_state (void)
{
- return state (true);
+ return state ();
}
/* NODE STRUCTURE
@@ -120,7 +120,7 @@ Processor::get_state (void)
*/
XMLNode&
-Processor::state (bool full_state)
+Processor::state ()
{
XMLNode* node = new XMLNode (state_node_name);
@@ -132,7 +132,7 @@ Processor::state (bool full_state)
node->add_child_copy (*_extra_xml);
}
- if (full_state) {
+ if (!skip_saving_automation) {
XMLNode& automation = Automatable::get_automation_xml_state();
if (!automation.children().empty() || !automation.properties().empty()) {
node->add_child_nocopy (automation);
diff --git a/libs/ardour/return.cc b/libs/ardour/return.cc
index 5bc0a695a5..74b1cbeb32 100644
--- a/libs/ardour/return.cc
+++ b/libs/ardour/return.cc
@@ -64,15 +64,9 @@ Return::~Return ()
}
XMLNode&
-Return::get_state(void)
+Return::state()
{
- return state (true);
-}
-
-XMLNode&
-Return::state(bool full)
-{
- XMLNode& node = IOProcessor::state(full);
+ XMLNode& node = IOProcessor::state ();
node.set_property ("type", "return");
node.set_property ("bitslot", _bitslot);
diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc
index 236f2d7c0c..368ec50eae 100644
--- a/libs/ardour/route.cc
+++ b/libs/ardour/route.cc
@@ -2428,17 +2428,17 @@ Route::set_strict_io (const bool enable)
XMLNode&
Route::get_state()
{
- return state(true);
+ return state (false);
}
XMLNode&
Route::get_template()
{
- return state(false);
+ return state (true);
}
XMLNode&
-Route::state(bool full_state)
+Route::state (bool save_template)
{
if (!_session._template_state_dir.empty()) {
foreach_processor (sigc::bind (sigc::mem_fun (*this, &Route::set_plugin_state_dir), _session._template_state_dir));
@@ -2469,14 +2469,14 @@ Route::state(bool full_state)
node->add_child_nocopy (_solo_isolate_control->get_state ());
node->add_child_nocopy (_solo_safe_control->get_state ());
- node->add_child_nocopy (_input->state (full_state));
- node->add_child_nocopy (_output->state (full_state));
+ node->add_child_nocopy (_input->get_state ());
+ node->add_child_nocopy (_output->get_state ());
node->add_child_nocopy (_mute_master->get_state ());
node->add_child_nocopy (_mute_control->get_state ());
node->add_child_nocopy (_phase_control->get_state ());
- if (full_state) {
+ if (!skip_saving_automation) {
node->add_child_nocopy (Automatable::get_automation_xml_state ());
}
@@ -2486,7 +2486,7 @@ Route::state(bool full_state)
}
if (_pannable) {
- node->add_child_nocopy (_pannable->state (full_state));
+ node->add_child_nocopy (_pannable->get_state ());
}
{
@@ -2495,7 +2495,7 @@ Route::state(bool full_state)
if (*i == _delayline) {
continue;
}
- if (!full_state) {
+ if (save_template) {
/* template save: do not include internal sends functioning as
aux sends because the chance of the target ID
in the session where this template is used
@@ -2513,7 +2513,7 @@ Route::state(bool full_state)
}
}
}
- node->add_child_nocopy((*i)->state (full_state));
+ node->add_child_nocopy((*i)->get_state ());
}
}
@@ -2908,7 +2908,7 @@ Route::get_processor_state ()
{
XMLNode* root = new XMLNode (X_("redirects"));
for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) {
- root->add_child_nocopy ((*i)->state (true));
+ root->add_child_nocopy ((*i)->get_state ());
}
return *root;
diff --git a/libs/ardour/send.cc b/libs/ardour/send.cc
index 7fd88aebac..dcea3fd510 100644
--- a/libs/ardour/send.cc
+++ b/libs/ardour/send.cc
@@ -260,15 +260,9 @@ Send::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, do
}
XMLNode&
-Send::get_state(void)
+Send::state ()
{
- return state (true);
-}
-
-XMLNode&
-Send::state (bool full)
-{
- XMLNode& node = Delivery::state(full);
+ XMLNode& node = Delivery::state ();
node.set_property ("type", "send");
@@ -278,7 +272,7 @@ Send::state (bool full)
node.set_property ("selfdestruct", _remove_on_disconnect);
- node.add_child_nocopy (_amp->state (full));
+ node.add_child_nocopy (_amp->get_state ());
return node;
}
diff --git a/libs/ardour/session_playlists.cc b/libs/ardour/session_playlists.cc
index d7780ea9b5..50bc710347 100644
--- a/libs/ardour/session_playlists.cc
+++ b/libs/ardour/session_playlists.cc
@@ -325,7 +325,7 @@ get_id_sorted_playlists (const List& playlists, IDSortedList& id_sorted_playlist
} // anonymous namespace
void
-SessionPlaylists::add_state (XMLNode* node, bool full_state)
+SessionPlaylists::add_state (XMLNode* node, bool save_template, bool include_unused)
{
XMLNode* child = node->add_child ("Playlists");
@@ -334,14 +334,18 @@ SessionPlaylists::add_state (XMLNode* node, bool full_state)
for (IDSortedList::iterator i = id_sorted_playlists.begin (); i != id_sorted_playlists.end (); ++i) {
if (!(*i)->hidden ()) {
- if (full_state) {
- child->add_child_nocopy ((*i)->get_state ());
- } else {
+ if (save_template) {
child->add_child_nocopy ((*i)->get_template ());
+ } else {
+ child->add_child_nocopy ((*i)->get_state ());
}
}
}
+ if (!include_unused) {
+ return;
+ }
+
child = node->add_child ("UnusedPlaylists");
IDSortedList id_sorted_unused_playlists;
@@ -351,10 +355,10 @@ SessionPlaylists::add_state (XMLNode* node, bool full_state)
i != id_sorted_unused_playlists.end (); ++i) {
if (!(*i)->hidden()) {
if (!(*i)->empty()) {
- if (full_state) {
- child->add_child_nocopy ((*i)->get_state());
- } else {
+ if (save_template) {
child->add_child_nocopy ((*i)->get_template());
+ } else {
+ child->add_child_nocopy ((*i)->get_state());
}
}
}
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index 118124a3d9..326a4be546 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -808,7 +808,7 @@ Session::save_state (string snapshot_name, bool pending, bool switch_to_snapshot
mark_as_clean = false;
tree.set_root (&get_template());
} else {
- tree.set_root (&state (true, fork_state));
+ tree.set_root (&state (false, fork_state));
}
if (snapshot_name.empty()) {
@@ -1013,13 +1013,15 @@ Session::save_default_options ()
}
XMLNode&
-Session::get_state()
+Session::get_state ()
{
- return state(true);
+ /* this is not directly called, but required by PBD::Stateful */
+ assert (0);
+ return state (false, NormalSave);
}
XMLNode&
-Session::get_template()
+Session::get_template ()
{
/* if we don't disable rec-enable, diskstreams
will believe they need to store their capture
@@ -1028,7 +1030,7 @@ Session::get_template()
disable_record (false);
- return state(false);
+ return state (true, NormalSave);
}
typedef std::set<boost::shared_ptr<Playlist> > PlaylistSet;
@@ -1117,12 +1119,14 @@ struct route_id_compare {
} // anon namespace
XMLNode&
-Session::state (bool full_state, snapshot_t snapshot_type)
+Session::state (bool save_template, snapshot_t snapshot_type)
{
LocaleGuard lg;
XMLNode* node = new XMLNode("Session");
XMLNode* child;
+ PBD::Unwinder<bool> uw (Automatable::skip_saving_automation, save_template);
+
node->set_property("version", CURRENT_SESSION_FILE_VERSION);
child = node->add_child ("ProgramVersion");
@@ -1133,7 +1137,7 @@ Session::state (bool full_state, snapshot_t snapshot_type)
/* store configuration settings */
- if (full_state) {
+ if (!save_template) {
node->set_property ("name", _name);
node->set_property ("sample-rate", _base_sample_rate);
@@ -1195,7 +1199,7 @@ Session::state (bool full_state, snapshot_t snapshot_type)
}
XMLNode& cfgxml (config.get_variables ());
- if (!full_state) {
+ if (save_template) {
/* exclude search-paths from template */
cfgxml.remove_nodes_and_delete ("name", "audio-search-path");
cfgxml.remove_nodes_and_delete ("name", "midi-search-path");
@@ -1207,7 +1211,7 @@ Session::state (bool full_state, snapshot_t snapshot_type)
child = node->add_child ("Sources");
- if (full_state) {
+ if (!save_template) {
Glib::Threads::Mutex::Lock sl (source_lock);
for (SourceMap::iterator siter = sources.begin(); siter != sources.end(); ++siter) {
@@ -1295,7 +1299,7 @@ Session::state (bool full_state, snapshot_t snapshot_type)
child = node->add_child ("Regions");
- if (full_state) {
+ if (!save_template) {
Glib::Threads::Mutex::Lock rl (region_lock);
const RegionFactory::RegionMap& region_map (RegionFactory::all_regions());
for (RegionFactory::RegionMap::const_iterator i = region_map.begin(); i != region_map.end(); ++i) {
@@ -1324,7 +1328,7 @@ Session::state (bool full_state, snapshot_t snapshot_type)
}
}
- if (full_state) {
+ if (!save_template) {
node->add_child_nocopy (_selection->get_state());
@@ -1384,16 +1388,16 @@ Session::state (bool full_state, snapshot_t snapshot_type)
for (RouteList::const_iterator i = xml_node_order.begin(); i != xml_node_order.end(); ++i) {
if (!(*i)->is_auditioner()) {
- if (full_state) {
- child->add_child_nocopy ((*i)->get_state());
- } else {
+ if (save_template) {
child->add_child_nocopy ((*i)->get_template());
+ } else {
+ child->add_child_nocopy ((*i)->get_state());
}
}
}
}
- playlists->add_state (node, full_state);
+ playlists->add_state (node, save_template, /* include unused*/ true);
child = node->add_child ("RouteGroups");
for (list<RouteGroup *>::iterator i = _route_groups.begin(); i != _route_groups.end(); ++i) {
@@ -1402,18 +1406,18 @@ Session::state (bool full_state, snapshot_t snapshot_type)
if (_click_io) {
XMLNode* gain_child = node->add_child ("Click");
- gain_child->add_child_nocopy (_click_io->state (full_state));
- gain_child->add_child_nocopy (_click_gain->state (full_state));
+ gain_child->add_child_nocopy (_click_io->get_state ());
+ gain_child->add_child_nocopy (_click_gain->get_state ());
}
if (_ltc_input) {
XMLNode* ltc_input_child = node->add_child ("LTC-In");
- ltc_input_child->add_child_nocopy (_ltc_input->state (full_state));
+ ltc_input_child->add_child_nocopy (_ltc_input->get_state ());
}
if (_ltc_input) {
XMLNode* ltc_output_child = node->add_child ("LTC-Out");
- ltc_output_child->add_child_nocopy (_ltc_output->state (full_state));
+ ltc_output_child->add_child_nocopy (_ltc_output->get_state ());
}
node->add_child_nocopy (_speakers->get_state());
diff --git a/libs/ardour/sidechain.cc b/libs/ardour/sidechain.cc
index 9ee902e5d6..f326218453 100644
--- a/libs/ardour/sidechain.cc
+++ b/libs/ardour/sidechain.cc
@@ -45,9 +45,9 @@ SideChain::~SideChain ()
}
XMLNode&
-SideChain::state (bool full)
+SideChain::state ()
{
- XMLNode& node = IOProcessor::state (full);
+ XMLNode& node = IOProcessor::state ();
node.set_property ("type", "sidechain");
return node;
}
diff --git a/libs/ardour/track.cc b/libs/ardour/track.cc
index 4e611211f3..0715eec14d 100644
--- a/libs/ardour/track.cc
+++ b/libs/ardour/track.cc
@@ -139,15 +139,9 @@ Track::input_changed ()
}
XMLNode&
-Track::get_state ()
+Track::state (bool save_template)
{
- return state (true);
-}
-
-XMLNode&
-Track::state (bool full)
-{
- XMLNode& root (Route::state (full));
+ XMLNode& root (Route::state (save_template));
if (_playlists[DataType::AUDIO]) {
root.set_property (X_("audio-playlist"), _playlists[DataType::AUDIO]->id().to_s());
@@ -245,12 +239,6 @@ Track::set_state (const XMLNode& node, int version)
return 0;
}
-XMLNode&
-Track::get_template ()
-{
- return state (false);
-}
-
Track::FreezeRecord::~FreezeRecord ()
{
for (vector<FreezeRecordProcessorInfo*>::iterator i = processor_info.begin(); i != processor_info.end(); ++i) {
diff --git a/libs/ardour/unknown_processor.cc b/libs/ardour/unknown_processor.cc
index 7532d968df..3a5ad42f98 100644
--- a/libs/ardour/unknown_processor.cc
+++ b/libs/ardour/unknown_processor.cc
@@ -59,7 +59,7 @@ UnknownProcessor::~UnknownProcessor () {
}
XMLNode &
-UnknownProcessor::state (bool)
+UnknownProcessor::state ()
{
return *(new XMLNode (_state));
}