Clean up State API:
authorRobin Gareus <robin@gareus.org>
Tue, 3 Oct 2017 22:35:29 +0000 (00:35 +0200)
committerRobin Gareus <robin@gareus.org>
Tue, 3 Oct 2017 22:54:55 +0000 (00:54 +0200)
* 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

58 files changed:
libs/ardour/amp.cc
libs/ardour/ardour/amp.h
libs/ardour/ardour/audio_track.h
libs/ardour/ardour/automatable.h
libs/ardour/ardour/automation_list.h
libs/ardour/ardour/capturing_processor.h
libs/ardour/ardour/delayline.h
libs/ardour/ardour/delivery.h
libs/ardour/ardour/disk_reader.h
libs/ardour/ardour/disk_writer.h
libs/ardour/ardour/internal_return.h
libs/ardour/ardour/internal_send.h
libs/ardour/ardour/io.h
libs/ardour/ardour/io_processor.h
libs/ardour/ardour/lv2_plugin.h
libs/ardour/ardour/meter.h
libs/ardour/ardour/midi_track.h
libs/ardour/ardour/monitor_processor.h
libs/ardour/ardour/pannable.h
libs/ardour/ardour/plugin_insert.h
libs/ardour/ardour/port_insert.h
libs/ardour/ardour/processor.h
libs/ardour/ardour/region.h
libs/ardour/ardour/return.h
libs/ardour/ardour/route.h
libs/ardour/ardour/send.h
libs/ardour/ardour/session.h
libs/ardour/ardour/session_playlists.h
libs/ardour/ardour/sidechain.h
libs/ardour/ardour/track.h
libs/ardour/ardour/unknown_processor.h
libs/ardour/audio_track.cc
libs/ardour/automatable.cc
libs/ardour/automation_list.cc
libs/ardour/capturing_processor.cc
libs/ardour/delayline.cc
libs/ardour/delivery.cc
libs/ardour/disk_reader.cc
libs/ardour/disk_writer.cc
libs/ardour/internal_return.cc
libs/ardour/internal_send.cc
libs/ardour/io.cc
libs/ardour/io_processor.cc
libs/ardour/meter.cc
libs/ardour/midi_track.cc
libs/ardour/monitor_processor.cc
libs/ardour/pannable.cc
libs/ardour/plugin_insert.cc
libs/ardour/port_insert.cc
libs/ardour/processor.cc
libs/ardour/return.cc
libs/ardour/route.cc
libs/ardour/send.cc
libs/ardour/session_playlists.cc
libs/ardour/session_state.cc
libs/ardour/sidechain.cc
libs/ardour/track.cc
libs/ardour/unknown_processor.cc

index 94d3f4617d1a36216cdea6b07ce5b661293604b4..cd55514fc18e29c75ed3e55187c94831a6e4742b 100644 (file)
@@ -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());
 
index c0ff59d9e7535333ccf6bf71bf96f2b7e12a6112..9ca2b9a4047f423c71e481881acaa3cfcae5bef7 100644 (file)
@@ -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);
index 96cea7e1fe84b427c1f7dbb905b0ce17d57520ab..aecf5d2c9f3e0bb881d31e38649543c107da3b89 100644 (file)
@@ -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 ();
index 84164568c5680033c3d97201ff3c3ef4334954f5..c7db1c7a218021f94c92b66dd85f470fecbec614 100644 (file)
@@ -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;
index d6de3decdafcba54b4b053dff8324f4ffdb00396..5ef92735f886f3d34a06cd90a886afb7fee75a88 100644 (file)
@@ -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 ();
index fe548d7bbcfe7f90e8fd645bfb47b2005671af7c..12d999c0c3ec3b4843cf528a503885504b669bbd 100644 (file)
@@ -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;
index 80a032374ea93b0ab896cd15b0a41fa5209df69d..0618374295346860a939a5f42c141bba5f6da7f0 100644 (file)
@@ -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);
index ce5b050982e801c6d1e4c51da60be11ac06ba521..451d7bdd0ceb8635007020c2b3e62d0240b6706f 100644 (file)
@@ -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;
 
index 4bc78cbd6794c934c6bf43f5faa74c6a911fed57..cb37bc6cb1fa671028b5ffabfed9fda0ecb1e247 100644 (file)
@@ -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.
        */
index 59267f5f8f08e0516700f61d142219a23aab028c..11d795c11aed36aa454f24b6cc071c12cf3745b9 100644 (file)
@@ -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 ();
index dbc9bab3f29235523f02a3570411c017a86b6677..71b8fc354d20d38042ab9481760513ac7fa725f1 100644 (file)
@@ -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 */
index c46236c5599baf6ccc8cd7014304945afc55e300..8547f73b08ce4c404205ee56f79db15ca85b206d 100644 (file)
@@ -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;
index 0eacaa973aacc29ddbd615586194740ee6710c25..48f3653c2b9e002320a1e10ac51b93c46efa42b8 100644 (file)
@@ -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;
 
index f17c338155295c24c88e80f70e5503553d22f027..7dcbb630ab56f63e2ce38b5ef946856e484d55d0 100644 (file)
@@ -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);
index 9e432c1180528578ca7059f45f2de5f84c3d5c92..25fda7400a448227a7217bd331f67fadd7d7572b 100644 (file)
@@ -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;
index 52ca751932e9073416467bd7e8d3bd9c35992531..1f7ad30216a0f2e2173544726642f551ac7dd0be 100644 (file)
@@ -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;
 
index 417d7688f60e560345ec391254f36f8eae0eea29..abee445e010ffd8df9fa012d108c32ab4146cd2d 100644 (file)
@@ -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);
index 1d537c09378bfa34ac738969ba895d4470c911e5..63e153e48e29512ab442eca189d0a730c516835e 100644 (file)
@@ -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);
index f96670afecdbf2bcb5bab9d03d01f3dc9937a1d1..afdb51234258325c285301643ca62bec776d4b7f 100644 (file)
@@ -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 ();
 };
 
index 1076c5198f31b6869765fd82c121313bb924e6c3..e13986c2c7d81056738e98535e95f6b8356f93b1 100644 (file)
@@ -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&);
 
index 2461f8a90fff89fd6be1f48ffa3e8c4181297de0..e96779c63e65f984362147d4e8eaf2052a3d0924 100644 (file)
@@ -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&);
 
index 8dfc1494d348455a78ada14588839e8d62575c89..f3325a11944c9c01bdf13aed662d6200ffe260a4 100644 (file)
@@ -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;
index 1ae75d14699a594c134b2a0785b838359ede2fcf..a147a6163acfeb67bbe132f58c8a798311d3c974 100644 (file)
@@ -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);
index 18845f9815ff047bec23885155c5170e7cfb2a4e..0dbf5eb1d38151f27a6efdf0abb86479902c3ff4 100644 (file)
@@ -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;
index 830ef4bab37ea82b677276fe165bd0fa7c46f9ff..8500232c27c27a94cf79e89998e157bc89ae0650 100644 (file)
@@ -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*);
 
index 8d9cdaa0afe42e4335bd04be0bfdfe4fb8566b62..c37055cd9465a0a1bd6efb7697ac882afec888ec 100644 (file)
@@ -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&);
 
index 88195e626a8e9e10d41af4547622742dd2c92f1f..d7c621d51f32aa5f77d9128b9f0a671869b8a672 100644 (file)
@@ -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;
index 273b12d040cd549329efd481ca7ba9b2d0f529c0..66f4f2c5373b6ae9a808b3321e91fb6e21eb54a8 100644 (file)
@@ -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&);
index f3755496c2fbf71296aa4d118fa2f0b3541aa5b0..dd608c8951942d72cbe5c7f23bdc5998162b3c9e 100644 (file)
@@ -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 */
index 7b21a775917aa12deee7fe228d7321f2069fa09c..6b024274f0fe1f258f429f2ffffb04f19ae23ecb 100644 (file)
@@ -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];
 
index 33d32f5b3409f92c43f900516684c7ba10bfff4b..c329da201e5b2a7f2b7cbcf2759b04dc363d668e 100644 (file)
@@ -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;
index cfcb1fbf147088e439f3d44dde972dd42921f6c3..12c2f1975b5c44a4b63cf7226e15ae7a9e549d1f 100644 (file)
@@ -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) {
index 26961f633ccf225a32a62a79084649cc1a4d0cd8..65b83b4b6ea03fb4a701f4017074df2a60f34b79 100644 (file)
@@ -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)
index b3a727ff9e5c818e0b9913799520cf695415f20c..cb09786c649f448b20ce948c66d0427ef74bbc01 100644 (file)
@@ -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
                */
index 496bfc53f23090938b2bc2c2e94c15463fce0a68..6e9049472af02f98c4ee2348e8fd6732813c6534 100644 (file)
@@ -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;
index 0416a9a0bb5ce9634ad1905d9b1ec93df5a3eab5..19ef460fd0f05b1e61c783fd5f262b6a84d3b40c 100644 (file)
@@ -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;
 }
index 88d735bd5e81331631157bb103d7dbc11db26850..27a12dbc29cdb77ad13dc20e91c69d7759c8d985 100644 (file)
@@ -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");
index 9bd433718e05929f880dc63e485542bd50d610f4..98643f8ebdbda22dea8240eac044e944edf16c4f 100644 (file)
@@ -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;
 }
index f9ff34728074466d8516d8a95a3020d0cfedfc35..0efc2e28114769baad804ddc30e157520c3ac0ac 100644 (file)
@@ -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;
index 0f7eb295d600a88f7a23e34b3b71e34ec74f7420..a162628853afd323afa70f39b1ad31af89989ed7 100644 (file)
@@ -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)
 {
index 72e58b605694f9e8381ac298650bcc3350083fd2..9749dab7603aacb0c84aa4404f6a4dcbea7c8ab0 100644 (file)
@@ -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)
 {
index a2a46270c8a80a80b948102002c08243e5a5479e..3628ec9b48ff92be87bcb2f08d82a36d6aa1c534 100644 (file)
@@ -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;
index 85ae6f90f352f0cb17bb1e1338ebf83cd2f4183a..a7e13fecb411395b8dc6d99e5c9e817bacb4b3b7 100644 (file)
@@ -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 ());
index c0b029a1589b455cb3a865982368cd4b1831a9be..da97041657f4380171fe49cc22540ef571a288eb 100644 (file)
@@ -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;
 }
index 11e6bec41b463582ea5f04c0bdb8b0bee0441cc4..a6a3b9f6f8b69268a99c80f3e77e463185a2afcd 100644 (file)
@@ -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];
 
index e035d6a346921e488d2a01d9f215d61e755b9ebf..56d8f879d62e4e9c9d0135e579c6b3b252921489 100644 (file)
@@ -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 */
 
index 32bf2fe33f25f04d9fa66ea8e22d568722365221..09a63cca3f83fa77f6b9ef1d3fe6b2e64ad6532d 100644 (file)
@@ -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"));
 
index 6094b963bbe8fc575803cea965af82374a30beb3..21bc6b5d3d3d2b67cfb058bc7abfb31896add240 100644 (file)
@@ -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());
index ed165a698889baee7ffa7baa5779f7f736971d6f..a6a05cede7998de8218131d548bbd808e25db036 100644 (file)
@@ -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);
index 03510130a2ad6881aa9a63d7ce4282fe3e409630..c6e6c2136044084c637f5013a8c0e3d72a86387b 100644 (file)
@@ -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);
index 5bc0a695a56dbdf59e15c0007d02ca7fc8290eab..74b1cbeb32e4295045b6442fb54b252d4f2fb3fb 100644 (file)
@@ -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);
 
index 236f2d7c0cb580a551c689028f7f865920ba4688..368ec50eae680ced52aaf3fc0c3037ff085bf32b 100644 (file)
@@ -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;
index 7fd88aebac20644bf5ebfc458630ea22e2241abb..dcea3fd5102b1e9eb1cef7d7e0b017769234eef3 100644 (file)
@@ -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;
 }
index d7780ea9b545be76e9ce867eb9167d78df3fbe3b..50bc710347ab4935a7940437dd40455402f9e01c 100644 (file)
@@ -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());
                                }
                        }
                }
index 118124a3d9467c78801b1639b59c06a59f945f89..326a4be546f727adedb8caec0f8b397903430d0a 100644 (file)
@@ -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());
index 9ee902e5d6d3076023ec9cfa9164e6524724afe0..f326218453ce23bb0a732ae042cca57b29191639 100644 (file)
@@ -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;
 }
index 4e611211f306cc3167146a875b3fbeba647b79c1..0715eec14d686b7b0821cdd31b6e56a030f53468 100644 (file)
@@ -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) {
index 7532d968df739160363f2ca74dd86481c0469c0e..3a5ad42f98f1f3b96f91f872ad306391bd7715c7 100644 (file)
@@ -59,7 +59,7 @@ UnknownProcessor::~UnknownProcessor () {
 }
 
 XMLNode &
-UnknownProcessor::state (bool)
+UnknownProcessor::state ()
 {
        return *(new XMLNode (_state));
 }