rework Stateful::set_state() patch to avoid default version argument

git-svn-id: svn://localhost/ardour2/branches/3.0@5787 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2009-10-15 18:56:11 +00:00
parent 79f91c7a20
commit 8713667ec1
120 changed files with 270 additions and 236 deletions

View file

@ -100,7 +100,7 @@ AudioTimeAxisView::AudioTimeAxisView (PublicEditor& ed, Session& sess, boost::sh
ensure_xml_node ();
set_state (*xml_node);
set_state (*xml_node, Stateful::loading_state_version);
/* if set_state above didn't create a gain automation child, we need to make one */
if (automation_track (GainAutomation) == 0) {

View file

@ -1264,7 +1264,7 @@ int
AutomationLine::set_state (const XMLNode &node, int version)
{
/* function as a proxy for the model */
return alist->set_state (node);
return alist->set_state (node, version);
}
void

View file

@ -125,7 +125,7 @@ class AutomationLine : public sigc::trackable, public PBD::StatefulThingWithGoin
bool is_first_point (ControlPoint &);
XMLNode& get_state (void);
int set_state (const XMLNode&, int version = 3000);
int set_state (const XMLNode&, int version);
void set_colors();
void modify_point_y (ControlPoint&, double);

View file

@ -194,7 +194,7 @@ AutomationTimeAxisView::AutomationTimeAxisView (Session& s, boost::shared_ptr<Ro
_control->parameter());
if (xml_node) {
set_state (*xml_node);
set_state (*xml_node, Stateful::loading_state_version);
}
/* ask for notifications of any new RegionViews */
@ -867,7 +867,7 @@ AutomationTimeAxisView::color_handler ()
int
AutomationTimeAxisView::set_state (const XMLNode& node, int version)
{
TimeAxisView::set_state (node);
TimeAxisView::set_state (node, version);
XMLProperty const * type = node.property ("automation-id");
if (type && type->value () == ARDOUR::EventTypeMap::instance().to_symbol (_control->parameter())) {

View file

@ -90,7 +90,7 @@ class AutomationTimeAxisView : public TimeAxisView {
bool paste (nframes_t, float times, Selection&, size_t nth);
void reset_objects (PointSelection&);
int set_state (const XMLNode&, int version = 3000);
int set_state (const XMLNode&, int version);
guint32 show_at (double y, int& nth, Gtk::VBox *parent);
void hide ();

View file

@ -614,7 +614,7 @@ Editor::Editor ()
set_edit_point_preference (EditAtMouse, true);
XMLNode* node = ARDOUR_UI::instance()->editor_settings();
set_state (*node);
set_state (*node, Stateful::loading_state_version);
_playlist_selector = new PlaylistSelector();
_playlist_selector->signal_delete_event().connect (bind (sigc::ptr_fun (just_hide_it), static_cast<Window *> (_playlist_selector)));
@ -1061,7 +1061,7 @@ Editor::connect_to_session (Session *t)
sensitize_the_right_region_actions (false);
XMLNode* node = ARDOUR_UI::instance()->editor_settings();
set_state (*node);
set_state (*node, Stateful::loading_state_version);
/* catch up with the playhead */
@ -4245,7 +4245,7 @@ Editor::use_visual_state (VisualState& vs)
/* check if the track still exists - it could have been deleted */
if ((t = find (track_views.begin(), track_views.end(), i->first)) != track_views.end()) {
(*t)->set_state (*(i->second));
(*t)->set_state (*(i->second), Stateful::loading_state_version);
}
}

View file

@ -180,7 +180,7 @@ class Editor : public PublicEditor
void redo (uint32_t n = 1);
XMLNode& get_state ();
int set_state (const XMLNode&, int version = 3000);
int set_state (const XMLNode&, int version);
void set_mouse_mode (Editing::MouseMode, bool force=true);
void step_mouse_mode (bool next);

View file

@ -129,7 +129,7 @@ Keyboard::Keyboard ()
snooper_id = gtk_key_snooper_install (_snooper, (gpointer) this);
XMLNode* node = ARDOUR_UI::instance()->keyboard_settings();
set_state (*node);
set_state (*node, Stateful::loading_state_version);
}
Keyboard::~Keyboard ()

View file

@ -40,7 +40,7 @@ class Keyboard : public sigc::trackable, PBD::Stateful
~Keyboard ();
XMLNode& get_state (void);
int set_state (const XMLNode&, int version = 3000);
int set_state (const XMLNode&, int version);
typedef std::vector<uint32_t> State;
typedef uint32_t ModifierMask;

View file

@ -136,7 +136,7 @@ MidiTimeAxisView::MidiTimeAxisView (PublicEditor& ed, Session& sess,
ensure_xml_node ();
set_state (*xml_node);
set_state (*xml_node, Stateful::loading_state_version);
_route->processors_changed.connect (mem_fun(*this, &MidiTimeAxisView::processors_changed));

View file

@ -385,7 +385,7 @@ RouteTimeAxisView::automation_click ()
int
RouteTimeAxisView::set_state (const XMLNode& node, int version)
{
TimeAxisView::set_state (node);
TimeAxisView::set_state (node, version);
XMLNodeList kids = node.children();
XMLNodeConstIterator iter;

View file

@ -114,7 +114,7 @@ public:
void remove_underlay (StreamView*);
void build_underlay_menu(Gtk::Menu*);
int set_state (const XMLNode&, int version = 3000);
int set_state (const XMLNode&, int version);
/* This is a bit nasty to expose :/ */
struct RouteAutomationNode {

View file

@ -709,6 +709,9 @@ SessionMetadataImporter::run ()
return;
}
/* XXX GET VERSION FROM TREE */
int version = 3000;
XMLNode * node = session_tree.root()->child ("Metadata");
if (!node) {
@ -717,7 +720,7 @@ SessionMetadataImporter::run ()
}
ARDOUR::SessionMetadata data;
data.set_state (*node);
data.set_state (*node, version);
init_data ();
load_extra_data (data);

View file

@ -93,7 +93,7 @@ class TimeAxisView : public virtual AxisView, public PBD::Stateful
virtual ~TimeAxisView ();
XMLNode& get_state ();
int set_state (const XMLNode&, int version = 3000);
int set_state (const XMLNode&, int version);
/** @return index of this TimeAxisView within its parent */
int order () const { return _order; }

View file

@ -86,7 +86,7 @@ UIConfiguration::load_defaults ()
return -1;
}
if (set_state (*tree.root())) {
if (set_state (*tree.root(), Stateful::loading_state_version)) {
error << string_compose(_("Ardour: default ui configuration file \"%1\" not loaded successfully."), rcfile) << endmsg;
return -1;
}
@ -116,7 +116,7 @@ UIConfiguration::load_state ()
return -1;
}
if (set_state (*tree.root())) {
if (set_state (*tree.root(), Stateful::loading_state_version)) {
error << string_compose(_("Ardour: default ui configuration file \"%1\" not loaded successfully."), rcfile) << endmsg;
return -1;
}
@ -139,7 +139,7 @@ UIConfiguration::load_state ()
return -1;
}
if (set_state (*tree.root())) {
if (set_state (*tree.root(), Stateful::loading_state_version)) {
error << string_compose(_("Ardour: user ui configuration file \"%1\" not loaded successfully."), rcfile) << endmsg;
return -1;
}

View file

@ -80,7 +80,7 @@ class UIConfiguration : public PBD::Stateful
int save_state ();
int load_defaults ();
int set_state (const XMLNode&, int version = 3000);
int set_state (const XMLNode&, int version);
XMLNode& get_state (void);
XMLNode& get_variables (std::string);
void set_variables (const XMLNode&);

View file

@ -339,7 +339,7 @@ Amp::set_state (const XMLNode& node, int version)
{
const XMLProperty* prop;
Processor::set_state (node);
Processor::set_state (node, version);
prop = node.property ("gain");
if (prop) {

View file

@ -55,7 +55,7 @@ public:
void apply_gain_automation(bool yn) { _apply_gain_automation = yn; }
XMLNode& state (bool full);
int set_state (const XMLNode&, int version = 3000);
int set_state (const XMLNode&, int version);
static void apply_gain (BufferSet& bufs, nframes_t nframes, gain_t initial, gain_t target);
static void apply_simple_gain(BufferSet& bufs, nframes_t nframes, gain_t target);

View file

@ -126,7 +126,7 @@ class AudioDiskstream : public Diskstream
/* stateful */
XMLNode& get_state(void);
int set_state(const XMLNode& node, int version = 3000);
int set_state(const XMLNode& node, int version);
void monitor_input (bool);

View file

@ -55,7 +55,7 @@ class AudioTrack : public Track
boost::shared_ptr<Region> bounce (InterThreadInfo&);
boost::shared_ptr<Region> bounce_range (nframes_t start, nframes_t end, InterThreadInfo&, bool enable_processing);
int set_state(const XMLNode&, int version = 3000);
int set_state(const XMLNode&, int version);
protected:
XMLNode& state (bool full);

View file

@ -72,7 +72,7 @@ public:
int setup_peakfile ();
XMLNode& get_state ();
int set_state (const XMLNode&, int version = 3000);
int set_state (const XMLNode&, int version);
bool can_truncate_peaks() const { return !destructive(); }
bool can_be_analysed() const { return _length > 0; }

View file

@ -50,7 +50,7 @@ class AudioPlaylist : public ARDOUR::Playlist
nframes_t read (Sample *dst, Sample *mixdown, float *gain_buffer, nframes_t start, nframes_t cnt, uint32_t chan_n=0);
int set_state (const XMLNode&, int version = 3000);
int set_state (const XMLNode&, int version);
sigc::signal<void,boost::shared_ptr<Crossfade> > NewCrossfade;

View file

@ -107,7 +107,7 @@ class AudioRegion : public Region
virtual nframes_t read_raw_internal (Sample*, sframes_t, nframes_t, int channel) const;
XMLNode& state (bool);
int set_state (const XMLNode&, int version = 3000);
int set_state (const XMLNode&, int version);
static void set_default_fade (float steepness, nframes_t len);
bool fade_in_is_default () const;
@ -219,7 +219,7 @@ class AudioRegion : public Region
AudioRegion (Session& s, nframes_t, nframes_t, std::string name);
int set_live_state (const XMLNode&, Change&, bool send);
int set_live_state (const XMLNode&, int version, Change&, bool send);
};
} /* namespace ARDOUR */

View file

@ -79,7 +79,7 @@ class AudioSource : virtual public Source,
mutable sigc::signal<void,nframes_t,nframes_t> PeakRangeReady;
XMLNode& get_state ();
int set_state (const XMLNode&, int version = 3000);
int set_state (const XMLNode&, int version);
int rename_peakfile (Glib::ustring newpath);
void touch_peakfile ();

View file

@ -80,7 +80,7 @@ class AutomationList : public PBD::StatefulDestructible, public Evoral::ControlL
bool touching() const { return _touching; }
XMLNode& get_state ();
int set_state (const XMLNode &, int version = 3000);
int set_state (const XMLNode &, int version);
XMLNode& state (bool full);
XMLNode& serialize_events ();

View file

@ -70,7 +70,7 @@ struct ControlProtocolInfo {
void set_protocol_states (const XMLNode&);
int set_state (const XMLNode&, int version = 3000);
int set_state (const XMLNode&, int version);
XMLNode& get_state (void);
private:

View file

@ -75,7 +75,7 @@ class Crossfade : public ARDOUR::AudioRegion
bool operator== (const ARDOUR::Crossfade&);
XMLNode& get_state (void);
int set_state (const XMLNode&, int version = 3000);
int set_state (const XMLNode&, int version);
boost::shared_ptr<ARDOUR::AudioRegion> in() const { return _in; }
boost::shared_ptr<ARDOUR::AudioRegion> out() const { return _out; }

View file

@ -89,7 +89,7 @@ public:
static sigc::signal<void,nframes_t> CycleStart;
XMLNode& state (bool full);
int set_state (const XMLNode&, int version = 3000);
int set_state (const XMLNode&, int version);
/* Panning */

View file

@ -130,7 +130,7 @@ class Diskstream : public SessionObject, public boost::noncopyable
/* Stateful */
virtual XMLNode& get_state(void) = 0;
virtual int set_state(const XMLNode&, int version = 3000) = 0;
virtual int set_state(const XMLNode&, int version) = 0;
virtual void monitor_input (bool) {}

View file

@ -46,7 +46,7 @@ public:
bool is_embedded () const { return _is_embedded; }
uint16_t channel() const { return _channel; }
int set_state (const XMLNode&, int version = 3000);
int set_state (const XMLNode&, int version);
int set_source_name (const Glib::ustring& newname, bool destructive);

View file

@ -38,7 +38,7 @@ class InternalReturn : public Return
XMLNode& state(bool full);
XMLNode& get_state(void);
int set_state(const XMLNode&, int version = 3000);
int set_state(const XMLNode&, int version);
void run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes);
bool configure_io (ChanCount in, ChanCount out);

View file

@ -38,7 +38,7 @@ class InternalSend : public Send
XMLNode& state(bool full);
XMLNode& get_state(void);
int set_state(const XMLNode& node, int version = 3000);
int set_state(const XMLNode& node, int version);
void run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes);
bool feeds (boost::shared_ptr<Route> other) const;

View file

@ -137,7 +137,7 @@ class IO : public SessionObject, public Latent
virtual XMLNode& state (bool full);
XMLNode& get_state (void);
int set_state (const XMLNode&, int version = 3000);
int set_state (const XMLNode&, int version);
int set_state_2X (const XMLNode&, int, bool);
static int disable_connecting (void);

View file

@ -72,7 +72,7 @@ class IOProcessor : public Processor
sigc::signal<void,IOProcessor*,uint32_t> AutomationChanged;
XMLNode& state (bool full_state);
int set_state (const XMLNode&, int version = 3000);
int set_state (const XMLNode&, int version);
protected:
boost::shared_ptr<IO> _input;

View file

@ -99,7 +99,7 @@ class LadspaPlugin : public ARDOUR::Plugin
bool parameter_is_toggled(uint32_t) const;
XMLNode& get_state();
int set_state (const XMLNode&, int version = 3000);
int set_state (const XMLNode&, int version);
bool save_preset(std::string name);
bool has_editor() const { return false; }
@ -133,7 +133,7 @@ class LadspaPlugin : public ARDOUR::Plugin
void init (void *mod, uint32_t index, nframes_t rate);
void run_in_place (nframes_t nsamples);
void latency_compute_run ();
int set_state_2X (const XMLNode&, int version = 3000);
int set_state_2X (const XMLNode&, int version);
};
class LadspaPluginInfo : public PluginInfo {

View file

@ -71,7 +71,7 @@ class Location : public PBD::StatefulDestructible
}
Location (const Location& other);
Location (const XMLNode&, int version = 3000);
Location (const XMLNode&);
Location* operator= (const Location& other);
bool locked() const { return _locked; }
@ -125,7 +125,7 @@ class Location : public PBD::StatefulDestructible
XMLNode& cd_info_node (const std::string &, const std::string &);
XMLNode& get_state (void);
int set_state (const XMLNode&, int version = 3000);
int set_state (const XMLNode&, int version);
private:
std::string _name;
@ -155,7 +155,7 @@ class Locations : public PBD::StatefulDestructible
void clear_ranges ();
XMLNode& get_state (void);
int set_state (const XMLNode&, int version = 3000);
int set_state (const XMLNode&, int version);
Location *get_location_by_id(PBD::ID);
Location* auto_loop_location () const;

View file

@ -115,7 +115,7 @@ class LV2Plugin : public ARDOUR::Plugin
static uint32_t midi_event_type() { return _midi_event_type; }
XMLNode& get_state();
int set_state(const XMLNode& node);
int set_state(const XMLNode& node, int version);
bool save_preset(std::string uri);
bool load_preset(const std::string uri);
virtual std::vector<Plugin::PresetRecord> get_presets();

View file

@ -75,7 +75,7 @@ class MidiDiskstream : public Diskstream
/* stateful */
XMLNode& get_state(void);
int set_state(const XMLNode&, int version = 3000);
int set_state(const XMLNode&, int version);
void monitor_input (bool);

View file

@ -70,7 +70,7 @@ public:
void operator()();
void undo();
int set_state (const XMLNode&, int version = 3000);
int set_state (const XMLNode&, int version);
XMLNode& get_state ();
void add(const boost::shared_ptr< Evoral::Note<TimeType> > note);
@ -114,7 +114,7 @@ public:
void operator()();
void undo();
int set_state (const XMLNode&, int version = 3000);
int set_state (const XMLNode&, int version);
XMLNode& get_state ();
void change (const boost::shared_ptr<Evoral::Note<TimeType> > note,

View file

@ -50,7 +50,7 @@ public:
nframes_t read (MidiRingBuffer<nframes_t>& buf,
nframes_t start, nframes_t cnt, uint32_t chan_n=0);
int set_state (const XMLNode&, int version = 3000);
int set_state (const XMLNode&, int version);
bool destroy_region (boost::shared_ptr<Region>);

View file

@ -68,7 +68,7 @@ class MidiRegion : public Region
NoteMode mode = Sustained) const;
XMLNode& state (bool);
int set_state (const XMLNode&, int version = 3000);
int set_state (const XMLNode&, int version);
int separate_by_channel (ARDOUR::Session&, std::vector< boost::shared_ptr<Region> >&) const;
@ -118,7 +118,7 @@ class MidiRegion : public Region
protected:
int set_live_state (const XMLNode&, Change&, bool send);
int set_live_state (const XMLNode&, int version, Change&, bool send);
};
} /* namespace ARDOUR */

View file

@ -91,7 +91,7 @@ class MidiSource : virtual public Source
mutable sigc::signal<void,sframes_t,nframes_t> ViewDataRangeReady;
XMLNode& get_state ();
int set_state (const XMLNode&, int version = 3000);
int set_state (const XMLNode&, int version);
bool length_mutable() const { return true; }

View file

@ -59,7 +59,7 @@ public:
boost::shared_ptr<Region> bounce_range (
nframes_t start, nframes_t end, InterThreadInfo&, bool enable_processing);
int set_state(const XMLNode&, int version = 3000);
int set_state(const XMLNode&, int version);
void midi_panic(void);
bool write_immediate_event(size_t size, const uint8_t* buf);

View file

@ -65,7 +65,7 @@ class MuteMaster : public AutomationControl
sigc::signal<void> MutePointChanged;
XMLNode& get_state();
int set_state(const XMLNode&, int version = 3000);
int set_state(const XMLNode&, int version);
private:
AutomationList* _automation;

View file

@ -44,7 +44,7 @@ struct NamedSelection : public PBD::Stateful
XMLNode& get_state (void);
int set_state (const XMLNode&, int version = 3000);
int set_state (const XMLNode&, int version);
static sigc::signal<void,NamedSelection*> NamedSelectionCreated;
};

View file

@ -73,7 +73,7 @@ class StreamPanner : public sigc::trackable, public PBD::Stateful
sigc::signal<void> Changed; /* for position */
sigc::signal<void> StateChanged; /* for mute */
int set_state (const XMLNode&, int version = 3000);
int set_state (const XMLNode&, int version);
virtual XMLNode& state (bool full_state) = 0;
Panner & get_parent() { return parent; }
@ -150,7 +150,7 @@ class EqualPowerStereoPanner : public BaseStereoPanner
XMLNode& state (bool full_state);
XMLNode& get_state (void);
int set_state (const XMLNode&, int version = 3000);
int set_state (const XMLNode&, int version);
private:
void update ();
@ -171,7 +171,7 @@ class Multi2dPanner : public StreamPanner
XMLNode& state (bool full_state);
XMLNode& get_state (void);
int set_state (const XMLNode&, int version = 3000);
int set_state (const XMLNode&, int version);
/* old school automation loading */
@ -228,7 +228,7 @@ public:
XMLNode& get_state (void);
XMLNode& state (bool full);
int set_state (const XMLNode&, int version = 3000);
int set_state (const XMLNode&, int version);
static bool equivalent (pan_t a, pan_t b) {
return fabsf (a - b) < 0.002; // about 1 degree of arc for a stereo panner

View file

@ -124,7 +124,7 @@ class Playlist : public SessionObject,
void foreach_region (sigc::slot<void, boost::shared_ptr<Region> >);
XMLNode& get_state ();
int set_state (const XMLNode&, int version = 3000);
int set_state (const XMLNode&, int version);
XMLNode& get_template ();
sigc::signal<void,bool> InUse;

View file

@ -45,14 +45,14 @@ class PluginInsert : public Processor
{
public:
PluginInsert (Session&, boost::shared_ptr<Plugin>);
PluginInsert (Session&, const XMLNode&, int version = 3000);
PluginInsert (Session&, const XMLNode&);
~PluginInsert ();
static const std::string port_automation_node_name;
XMLNode& state(bool);
XMLNode& get_state(void);
int set_state(const XMLNode&, int version = 3000);
int set_state(const XMLNode&, int version);
void run (BufferSet& in, sframes_t start_frame, sframes_t end_frame, nframes_t nframes);
void silence (nframes_t nframes);

View file

@ -44,12 +44,12 @@ class PortInsert : public IOProcessor
{
public:
PortInsert (Session&, boost::shared_ptr<MuteMaster> mm);
PortInsert (Session&, boost::shared_ptr<MuteMaster> mm, const XMLNode&, int version = 3000);
PortInsert (Session&, boost::shared_ptr<MuteMaster> mm, const XMLNode&);
~PortInsert ();
XMLNode& state(bool full);
XMLNode& get_state(void);
int set_state (const XMLNode&, int version = 3000);
int set_state (const XMLNode&, int version);
void run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes);

View file

@ -91,7 +91,7 @@ class Processor : public SessionObject, public AutomatableControls, public Laten
virtual XMLNode& state (bool full);
XMLNode& get_state (void);
int set_state (const XMLNode&, int version = 3000);
int set_state (const XMLNode&, int version);
void *get_gui () const { return _gui; }
void set_gui (void *p) { _gui = p; }

View file

@ -37,7 +37,7 @@ class RCConfiguration : public Configuration
RCConfiguration();
void map_parameters (sigc::slot<void, std::string>);
int set_state (XMLNode const &, int version = 3000);
int set_state (XMLNode const &, int version);
XMLNode& get_state ();
XMLNode& get_variables ();
void set_variables (XMLNode const &);

View file

@ -241,8 +241,8 @@ class Region
XMLNode& get_state ();
virtual XMLNode& state (bool);
virtual int set_state (const XMLNode&, int version = 3000);
virtual int set_live_state (const XMLNode&, Change&, bool send);
virtual int set_state (const XMLNode&, int version);
virtual int set_live_state (const XMLNode&, int version, Change&, bool send);
virtual boost::shared_ptr<Region> get_parent() const;

View file

@ -54,7 +54,7 @@ public:
XMLNode& state(bool full);
XMLNode& get_state(void);
int set_state(const XMLNode&, int version = 3000);
int set_state(const XMLNode&, int version);
uint32_t pans_required() const { return _configured_input.n_audio(); }

View file

@ -66,9 +66,8 @@ class Route : public SessionObject, public AutomatableControls
ControlOut = 0x4
};
Route (Session&, std::string name, Flag flags = Flag(0),
DataType default_type = DataType::AUDIO);
Route (Session&, const XMLNode&, int, DataType default_type = DataType::AUDIO);
Route (Session&, std::string name, Flag flags = Flag(0), DataType default_type = DataType::AUDIO);
Route (Session&, const XMLNode&, DataType default_type = DataType::AUDIO);
virtual ~Route();
boost::shared_ptr<IO> input() const { return _input; }
@ -251,7 +250,7 @@ class Route : public SessionObject, public AutomatableControls
/* stateful */
XMLNode& get_state();
int set_state (const XMLNode&, int version = 3000);
int set_state (const XMLNode&, int version);
virtual XMLNode& get_template();
XMLNode& get_processor_state ();

View file

@ -131,7 +131,7 @@ public:
XMLNode& get_state ();
int set_state (const XMLNode&, int version = 3000);
int set_state (const XMLNode&, int version);
private:
Session& _session;

View file

@ -53,7 +53,7 @@ class Send : public Delivery
XMLNode& state(bool full);
XMLNode& get_state(void);
int set_state(const XMLNode&, int version = 3000);
int set_state(const XMLNode&, int version);
uint32_t pans_required() const { return _configured_input.n_audio(); }

View file

@ -468,7 +468,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
static std::vector<std::string*>* possible_states (std::string path);
XMLNode& get_state();
int set_state(const XMLNode& node, int version = 3000); // not idempotent
int set_state(const XMLNode& node, int version); // not idempotent
XMLNode& get_template();
/// The instant xml file is written to the session directory
@ -849,7 +849,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
public:
GlobalRouteStateCommand (Session&, void*);
GlobalRouteStateCommand (Session&, const XMLNode& node);
int set_state (const XMLNode&, int version = 3000);
int set_state (const XMLNode&, int version);
XMLNode& get_state ();
protected:
@ -899,7 +899,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
void operator()();
void undo();
XMLNode &get_state();
int set_state (const XMLNode&, int version = 3000);
int set_state (const XMLNode&, int version);
void mark();
protected:

View file

@ -30,7 +30,7 @@ public:
SessionConfiguration ();
void map_parameters (sigc::slot<void, std::string>);
int set_state (XMLNode const &, int version = 3000);
int set_state (XMLNode const &, int version);
XMLNode& get_state ();
XMLNode& get_variables ();
void set_variables (XMLNode const &);

View file

@ -107,7 +107,7 @@ class SessionMetadata : public PBD::StatefulDestructible
/*** Serialization ***/
XMLNode & get_state ();
int set_state (const XMLNode &, int version = 3000);
int set_state (const XMLNode &, int version);
private:

View file

@ -58,7 +58,7 @@ public:
void mark_streaming_write_completed ();
XMLNode& get_state ();
int set_state (const XMLNode&, int version = 3000);
int set_state (const XMLNode&, int version);
void load_model (bool lock=true, bool force_reload=false);
void destroy_model ();

View file

@ -76,7 +76,7 @@ class Source : public SessionObject, public boost::noncopyable
virtual void session_saved() {}
XMLNode& get_state ();
int set_state (const XMLNode&, int version = 3000);
int set_state (const XMLNode&, int version);
bool destructive() const { return (_flags & Destructive); }
bool writable () const { return (_flags & Writable); }

View file

@ -212,7 +212,7 @@ class TempoMap : public PBD::StatefulDestructible
void set_length (nframes_t frames);
XMLNode& get_state (void);
int set_state (const XMLNode&, int version = 3000);
int set_state (const XMLNode&, int version);
void dump (std::ostream&) const;
void clear ();

View file

@ -82,7 +82,7 @@ class Track : public Route
XMLNode& get_state();
XMLNode& get_template();
virtual int set_state (const XMLNode&, int version = 3000) = 0;
virtual int set_state (const XMLNode&, int version) = 0;
static void zero_diskstream_id_in_xml (XMLNode&);
boost::shared_ptr<PBD::Controllable> rec_enable_control() { return _rec_enable_control; }
@ -96,7 +96,7 @@ class Track : public Route
sigc::signal<void> FreezeChange;
protected:
Track (Session& sess, const XMLNode& node, int, DataType default_type = DataType::AUDIO);
Track (Session& sess, const XMLNode& node, DataType default_type = DataType::AUDIO);
virtual XMLNode& state (bool full) = 0;

View file

@ -38,7 +38,7 @@ class UserBundle : public Bundle, public PBD::Stateful {
XMLNode& get_state ();
private:
int set_state (XMLNode const &, int version = 3000);
int set_state (XMLNode const &, int version);
};
}

View file

@ -90,7 +90,7 @@ AudioDiskstream::AudioDiskstream (Session& sess, const XMLNode& node)
in_set_state = true;
init (Recordable);
if (set_state (node)) {
if (set_state (node, Stateful::loading_state_version)) {
in_set_state = false;
throw failed_constructor();
}

View file

@ -46,7 +46,7 @@ AudioPlaylist::AudioPlaylist (Session& session, const XMLNode& node, bool hidden
assert(!prop || DataType(prop->value()) == DataType::AUDIO);
in_set_state++;
set_state (node);
set_state (node, Stateful::loading_state_version);
in_set_state--;
}
@ -566,7 +566,7 @@ AudioPlaylist::set_state (const XMLNode& node, int version)
in_set_state++;
Playlist::set_state (node);
Playlist::set_state (node, version);
freeze ();

View file

@ -57,9 +57,9 @@ AudioTrack::AudioTrack (Session& sess, string name, Route::Flag flag, TrackMode
}
AudioTrack::AudioTrack (Session& sess, const XMLNode& node, int version)
: Track (sess, node, version)
: Track (sess, node)
{
_set_state (node, version, false);
_set_state (node, Stateful::loading_state_version, false);
}
AudioTrack::~AudioTrack ()
@ -300,7 +300,7 @@ AudioTrack::_set_state (const XMLNode& node, int version, bool call_base)
child = *niter;
if (child->name() == X_("recenable")) {
_rec_enable_control->set_state (*child);
_rec_enable_control->set_state (*child, version);
_session.add_controllable (_rec_enable_control);
}
}
@ -809,7 +809,7 @@ AudioTrack::unfreeze ()
for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) {
for (vector<FreezeRecordProcessorInfo*>::iterator ii = _freeze_record.processor_info.begin(); ii != _freeze_record.processor_info.end(); ++ii) {
if ((*ii)->id == (*i)->id()) {
(*i)->set_state (((*ii)->state));
(*i)->set_state (((*ii)->state), Stateful::current_state_version);
break;
}
}

View file

@ -121,7 +121,7 @@ AudioFileSource::AudioFileSource (Session& s, const XMLNode& node, bool must_exi
, AudioSource (s, node)
, FileSource (s, node, must_exist)
{
if (set_state (node)) {
if (set_state (node, Stateful::loading_state_version)) {
throw failed_constructor ();
}
@ -260,15 +260,15 @@ AudioFileSource::get_state ()
int
AudioFileSource::set_state (const XMLNode& node, int version)
{
if (Source::set_state (node)) {
if (Source::set_state (node, version)) {
return -1;
}
if (AudioSource::set_state (node)) {
if (AudioSource::set_state (node, version)) {
return -1;
}
if (FileSource::set_state (node)) {
if (FileSource::set_state (node, version)) {
return -1;
}

View file

@ -236,7 +236,7 @@ AudioRegion::AudioRegion (boost::shared_ptr<AudioSource> src, const XMLNode& nod
init ();
if (set_state (node)) {
if (set_state (node, Stateful::loading_state_version)) {
throw failed_constructor();
}
@ -255,7 +255,7 @@ AudioRegion::AudioRegion (SourceList& srcs, const XMLNode& node)
{
init ();
if (set_state (node)) {
if (set_state (node, Stateful::loading_state_version)) {
throw failed_constructor();
}
@ -634,13 +634,13 @@ AudioRegion::state (bool full)
}
int
AudioRegion::set_live_state (const XMLNode& node, Change& what_changed, bool send)
AudioRegion::set_live_state (const XMLNode& node, int version, Change& what_changed, bool send)
{
const XMLNodeList& nlist = node.children();
const XMLProperty *prop;
LocaleGuard lg (X_("POSIX"));
Region::set_live_state (node, what_changed, false);
Region::set_live_state (node, version, what_changed, false);
uint32_t old_flags = _flags;
@ -691,7 +691,7 @@ AudioRegion::set_live_state (const XMLNode& node, Change& what_changed, bool sen
_envelope->clear ();
if ((prop = child->property ("default")) != 0 || _envelope->set_state (*child)) {
if ((prop = child->property ("default")) != 0 || _envelope->set_state (*child, version)) {
set_default_envelope ();
}
@ -707,7 +707,7 @@ AudioRegion::set_live_state (const XMLNode& node, Change& what_changed, bool sen
} else {
XMLNode* grandchild = child->child ("AutomationList");
if (grandchild) {
_fade_in->set_state (*grandchild);
_fade_in->set_state (*grandchild, version);
}
}
@ -728,7 +728,7 @@ AudioRegion::set_live_state (const XMLNode& node, Change& what_changed, bool sen
} else {
XMLNode* grandchild = child->child ("AutomationList");
if (grandchild) {
_fade_out->set_state (*grandchild);
_fade_out->set_state (*grandchild, version);
}
}
@ -758,7 +758,7 @@ AudioRegion::set_state (const XMLNode& node, int version)
to handle the relevant stuff.
*/
return Region::set_state (node);
return Region::set_state (node, version);
}
void

View file

@ -85,7 +85,7 @@ AudioSource::AudioSource (Session& s, const XMLNode& node)
peak_leftover_size = 0;
peak_leftovers = 0;
if (set_state (node)) {
if (set_state (node, Stateful::loading_state_version)) {
throw failed_constructor();
}
}

View file

@ -100,7 +100,7 @@ AutomationList::AutomationList (const XMLNode& node, Evoral::Parameter id)
_state = Off;
_style = Absolute;
set_state (node);
set_state (node, Stateful::loading_state_version);
if (id) {
_parameter = id;
@ -368,7 +368,7 @@ AutomationList::set_state (const XMLNode& node, int version)
if ((nsos = node.child (X_("AutomationList")))) {
/* new school in old school clothing */
return set_state (*nsos);
return set_state (*nsos, version);
}
/* old school */

View file

@ -74,7 +74,7 @@ ControlProtocolManager::set_session (Session& s)
(*i)->requested = false;
if ((*i)->protocol && (*i)->state) {
(*i)->protocol->set_state (*(*i)->state);
(*i)->protocol->set_state (*(*i)->state, Stateful::loading_state_version);
}
}
}

View file

@ -157,7 +157,7 @@ Crossfade::Crossfade (const Playlist& playlist, XMLNode& node)
initialize();
_active = true;
if (set_state (node)) {
if (set_state (node, Stateful::loading_state_version)) {
throw failed_constructor();
}
}

View file

@ -109,7 +109,7 @@ Delivery::Delivery (Session& s, boost::shared_ptr<MuteMaster> mm, const XMLNode&
{
_panner = boost::shared_ptr<Panner>(new Panner (_name, _session));
if (set_state (node)) {
if (set_state (node, Stateful::loading_state_version)) {
throw failed_constructor ();
}
@ -136,7 +136,7 @@ Delivery::Delivery (Session& s, boost::shared_ptr<IO> out, boost::shared_ptr<Mut
{
_panner = boost::shared_ptr<Panner>(new Panner (_name, _session));
if (set_state (node)) {
if (set_state (node, Stateful::loading_state_version)) {
throw failed_constructor ();
}
@ -376,7 +376,7 @@ Delivery::set_state (const XMLNode& node, int version)
{
const XMLProperty* prop;
if (IOProcessor::set_state (node)) {
if (IOProcessor::set_state (node, version)) {
return -1;
}
@ -390,7 +390,7 @@ Delivery::set_state (const XMLNode& node, int version)
XMLNode* pan_node = node.child (X_("Panner"));
if (pan_node) {
_panner->set_state (*pan_node);
_panner->set_state (*pan_node, version);
}
reset_panner ();

View file

@ -298,6 +298,12 @@ ARDOUR::init (bool use_vst, bool try_optimization)
(void) bindtextdomain(PACKAGE, LOCALEDIR);
/* provide a state version for the few cases that need it and are not
driven by reading state from disk (e.g. undo/redo)
*/
Stateful::current_state_version = CURRENT_SESSION_FILE_VERSION;
setup_enum_writer ();
// allow ardour the absolute maximum number of open files
@ -360,7 +366,7 @@ ARDOUR::init_post_engine ()
XMLNode* node;
if ((node = Config->control_protocol_state()) != 0) {
ControlProtocolManager::instance().set_state (*node);
ControlProtocolManager::instance().set_state (*node, Stateful::loading_state_version);
}
}

View file

@ -133,7 +133,7 @@ InternalReturn::get_state()
int
InternalReturn::set_state (const XMLNode& node, int version)
{
return Return::set_state (node);
return Return::set_state (node, version);
}
bool

View file

@ -49,7 +49,7 @@ InternalSend::InternalSend (Session& s, boost::shared_ptr<MuteMaster> mm, boost:
InternalSend::InternalSend (Session& s, boost::shared_ptr<MuteMaster> mm, const XMLNode& node)
: Send (s, mm, node, Delivery::Aux /* will be reset in set_state() */)
{
set_state (node);
set_state (node, Stateful::loading_state_version);
}
InternalSend::~InternalSend ()
@ -175,7 +175,7 @@ InternalSend::set_state (const XMLNode& node, int version)
{
const XMLProperty* prop;
Send::set_state (node);
Send::set_state (node, version);
if ((prop = node.property ("target")) != 0) {

View file

@ -93,7 +93,7 @@ IO::IO (Session& s, const XMLNode& node, DataType dt)
_active = true;
pending_state_node = 0;
set_state (node);
set_state (node, Stateful::loading_state_version);
setup_bundles ();
}

View file

@ -152,7 +152,7 @@ IOProcessor::set_state (const XMLNode& node, int version)
const XMLProperty *prop;
const XMLNode *io_node = 0;
Processor::set_state(node);
Processor::set_state(node, version);
if ((prop = node.property ("own-input")) != 0) {
_own_input = string_is_affirmative (prop->value());
@ -176,7 +176,7 @@ IOProcessor::set_state (const XMLNode& node, int version)
}
if (io_node) {
_input->set_state(*io_node);
_input->set_state(*io_node, version);
// legacy sessions: use IO name
if ((prop = node.property ("name")) == 0) {
@ -198,7 +198,7 @@ IOProcessor::set_state (const XMLNode& node, int version)
}
if (io_node) {
_output->set_state(*io_node);
_output->set_state(*io_node, version);
// legacy sessions: use IO name
if ((prop = node.property ("name")) == 0) {

View file

@ -59,9 +59,9 @@ Location::Location (const Location& other)
_locked = false;
}
Location::Location (const XMLNode& node, int version)
Location::Location (const XMLNode& node)
{
if (set_state (node)) {
if (set_state (node, Stateful::loading_state_version)) {
throw failed_constructor ();
}
}

View file

@ -354,7 +354,7 @@ LV2Plugin::has_editor() const
}
int
LV2Plugin::set_state(const XMLNode& node)
LV2Plugin::set_state(const XMLNode& node, int version)
{
XMLNodeList nodes;
XMLProperty *prop;

View file

@ -98,7 +98,7 @@ MidiDiskstream::MidiDiskstream (Session& sess, const XMLNode& node)
in_set_state = true;
init (Recordable);
if (set_state (node)) {
if (set_state (node, Stateful::loading_state_version)) {
in_set_state = false;
throw failed_constructor();
}

View file

@ -112,7 +112,7 @@ MidiModel::DeltaCommand::DeltaCommand(boost::shared_ptr<MidiModel> m, const XMLN
: _model(m)
{
assert(_model);
set_state(node);
set_state(node, Stateful::loading_state_version);
}
void
@ -321,7 +321,7 @@ MidiModel::DiffCommand::DiffCommand(boost::shared_ptr<MidiModel> m, const XMLNod
: _model(m)
{
assert(_model);
set_state(node);
set_state(node, Stateful::loading_state_version);
}
void

View file

@ -48,7 +48,7 @@ MidiPlaylist::MidiPlaylist (Session& session, const XMLNode& node, bool hidden)
assert(prop && DataType(prop->value()) == DataType::MIDI);
in_set_state++;
set_state (node);
set_state (node, Stateful::loading_state_version);
in_set_state--;
}
@ -192,7 +192,7 @@ MidiPlaylist::set_state (const XMLNode& node, int version)
in_set_state++;
freeze ();
Playlist::set_state (node);
Playlist::set_state (node, version);
thaw();
in_set_state--;

View file

@ -91,7 +91,7 @@ MidiRegion::MidiRegion (boost::shared_ptr<const MidiRegion> other)
MidiRegion::MidiRegion (boost::shared_ptr<MidiSource> src, const XMLNode& node)
: Region (src, node)
{
if (set_state (node)) {
if (set_state (node, Stateful::loading_state_version)) {
throw failed_constructor();
}
@ -103,7 +103,7 @@ MidiRegion::MidiRegion (boost::shared_ptr<MidiSource> src, const XMLNode& node)
MidiRegion::MidiRegion (const SourceList& srcs, const XMLNode& node)
: Region (srcs, node)
{
if (set_state (node)) {
if (set_state (node, Stateful::loading_state_version)) {
throw failed_constructor();
}
@ -249,12 +249,12 @@ MidiRegion::state (bool full)
}
int
MidiRegion::set_live_state (const XMLNode& node, Change& what_changed, bool send)
MidiRegion::set_live_state (const XMLNode& node, int version, Change& what_changed, bool send)
{
const XMLProperty *prop;
LocaleGuard lg (X_("POSIX"));
Region::set_live_state (node, what_changed, false);
Region::set_live_state (node, version, what_changed, false);
uint32_t old_flags = _flags;
@ -292,7 +292,7 @@ MidiRegion::set_state (const XMLNode& node, int version)
to handle the relevant stuff.
*/
return Region::set_state (node);
return Region::set_state (node, version);
}
void

View file

@ -72,7 +72,7 @@ MidiSource::MidiSource (Session& s, const XMLNode& node)
_read_data_count = 0;
_write_data_count = 0;
if (set_state (node)) {
if (set_state (node, Stateful::loading_state_version)) {
throw failed_constructor();
}
}

View file

@ -67,7 +67,7 @@ MidiTrack::MidiTrack (Session& sess, string name, Route::Flag flag, TrackMode mo
}
MidiTrack::MidiTrack (Session& sess, const XMLNode& node, int version)
: Track (sess, node, version, DataType::MIDI)
: Track (sess, node, DataType::MIDI)
, _immediate_events(1024) // FIXME: size?
, _step_edit_ring_buffer(64) // FIXME: size?
, _note_mode(Sustained)
@ -75,7 +75,7 @@ MidiTrack::MidiTrack (Session& sess, const XMLNode& node, int version)
, _default_channel (0)
, _midi_thru (true)
{
_set_state (node, version, false);
_set_state (node, Stateful::loading_state_version, false);
}
MidiTrack::~MidiTrack ()
@ -232,7 +232,7 @@ MidiTrack::_set_state (const XMLNode& node, int version, bool call_base)
child = *niter;
if (child->name() == X_("recenable")) {
_rec_enable_control->set_state (*child);
_rec_enable_control->set_state (*child, version);
_session.add_controllable (_rec_enable_control);
}
}

View file

@ -496,18 +496,18 @@ EqualPowerStereoPanner::set_state (const XMLNode& node, int version)
set_position (pos, true);
}
StreamPanner::set_state (node);
StreamPanner::set_state (node, version);
for (XMLNodeConstIterator iter = node.children().begin(); iter != node.children().end(); ++iter) {
if ((*iter)->name() == X_("Controllable")) {
if ((prop = (*iter)->property("name")) != 0 && prop->value() == "panner") {
_control->set_state (**iter);
_control->set_state (**iter, version);
}
} else if ((*iter)->name() == X_("Automation")) {
_control->alist()->set_state (*((*iter)->children().front()));
_control->alist()->set_state (*((*iter)->children().front()), version);
if (_control->alist()->automation_state() != Off) {
set_position (_control->list()->eval (parent.session().transport_frame()));
@ -1154,7 +1154,7 @@ Panner::set_state (const XMLNode& node, int version)
sp = pan_plugins[i].factory (*this, Evoral::Parameter(PanAutomation, 0, num_panners));
num_panners++;
if (sp->set_state (**niter) == 0) {
if (sp->set_state (**niter, version) == 0) {
_streampanners.push_back (sp);
}

View file

@ -1845,7 +1845,7 @@ Playlist::set_state (const XMLNode& node, int version)
Change what_changed = Change (0);
if (region->set_live_state (*child, what_changed, true)) {
if (region->set_live_state (*child, version, what_changed, true)) {
error << _("Playlist: cannot reset region state from XML") << endmsg;
continue;
}

View file

@ -81,12 +81,12 @@ PluginInsert::PluginInsert (Session& s, boost::shared_ptr<Plugin> plug)
ProcessorCreated (this); /* EMIT SIGNAL */
}
PluginInsert::PluginInsert (Session& s, const XMLNode& node, int version)
PluginInsert::PluginInsert (Session& s, const XMLNode& node)
: Processor (s, "unnamed plugin insert"),
_signal_analysis_collected_nframes(0),
_signal_analysis_collect_nframes_max(0)
{
if (set_state (node, version)) {
if (set_state (node, Stateful::loading_state_version)) {
throw failed_constructor();
}
@ -836,7 +836,7 @@ PluginInsert::set_state(const XMLNode& node, int version)
data().control(Evoral::Parameter(PluginAutomation, 0, port_id), true));
if (!child->children().empty()) {
c->alist()->set_state (*child->children().front());
c->alist()->set_state (*child->children().front(), version);
} else {
if ((cprop = child->property("auto")) != 0) {

View file

@ -48,12 +48,12 @@ PortInsert::PortInsert (Session& s, boost::shared_ptr<MuteMaster> mm)
ProcessorCreated (this); /* EMIT SIGNAL */
}
PortInsert::PortInsert (Session& s, boost::shared_ptr<MuteMaster> mm, const XMLNode& node, int version)
PortInsert::PortInsert (Session& s, boost::shared_ptr<MuteMaster> mm, const XMLNode& node)
: IOProcessor (s, true, true, "unnamed port insert")
, _out (new Delivery (s, _output, mm, _name, Delivery::Insert))
{
if (set_state (node, version)) {
if (set_state (node, Stateful::loading_state_version)) {
throw failed_constructor();
}
@ -138,7 +138,7 @@ PortInsert::set_state (const XMLNode& node, int version)
}
}
Processor::set_state (*insert_node);
Processor::set_state (*insert_node, version);
return 0;
}

View file

@ -82,7 +82,7 @@ Processor::Processor (Session& session, const XMLNode& node)
, _configured(false)
, _gui(0)
{
set_state (node);
set_state (node, Stateful::loading_state_version);
_pending_active = _active;
}

View file

@ -97,7 +97,7 @@ RCConfiguration::load_state ()
return -1;
}
if (set_state (*tree.root())) {
if (set_state (*tree.root(), Stateful::current_state_version)) {
error << string_compose(_("Ardour: system configuration file \"%1\" not loaded successfully."), rcfile) << endmsg;
return -1;
}
@ -132,7 +132,7 @@ RCConfiguration::load_state ()
return -1;
}
if (set_state (*tree.root())) {
if (set_state (*tree.root(), Stateful::current_state_version)) {
error << string_compose(_("Ardour: user configuration file \"%1\" not loaded successfully."), rcfile) << endmsg;
return -1;
}

View file

@ -298,7 +298,7 @@ Region::Region (const SourceList& srcs, const XMLNode& node)
{
use_sources (srcs);
if (set_state (node)) {
if (set_state (node, Stateful::loading_state_version)) {
throw failed_constructor();
}
@ -328,7 +328,7 @@ Region::Region (boost::shared_ptr<Source> src, const XMLNode& node)
{
_sources.push_back (src);
if (set_state (node)) {
if (set_state (node, Stateful::loading_state_version)) {
throw failed_constructor();
}
@ -1172,7 +1172,7 @@ Region::get_state ()
}
int
Region::set_live_state (const XMLNode& node, Change& what_changed, bool send)
Region::set_live_state (const XMLNode& node, int version, Change& what_changed, bool send)
{
const XMLNodeList& nlist = node.children();
const XMLProperty *prop;
@ -1355,7 +1355,7 @@ Region::set_state (const XMLNode& node, int version)
_first_edit = EditChangesNothing;
set_live_state (node, what_changed, true);
set_live_state (node, version, what_changed, true);
return 0;
}

View file

@ -58,7 +58,7 @@ Return::Return (Session& s, const XMLNode& node, bool internal)
_amp.reset (new Amp (_session, boost::shared_ptr<MuteMaster>()));
_meter.reset (new PeakMeter (_session));
if (set_state (node)) {
if (set_state (node, Stateful::loading_state_version)) {
throw failed_constructor();
}
@ -114,7 +114,7 @@ Return::set_state (const XMLNode& node, int version)
}
}
IOProcessor::set_state (*insert_node);
IOProcessor::set_state (*insert_node, version);
return 0;
}

View file

@ -96,7 +96,7 @@ Route::Route (Session& sess, string name, Flag flg, DataType default_type)
_meter_connection = Metering::connect (mem_fun (*this, &Route::meter));
}
Route::Route (Session& sess, const XMLNode& node, int version, DataType default_type)
Route::Route (Session& sess, const XMLNode& node, DataType default_type)
: SessionObject (sess, "toBeReset")
, AutomatableControls (sess)
, _solo_control (new SoloControllable (X_("solo"), *this))
@ -105,7 +105,7 @@ Route::Route (Session& sess, const XMLNode& node, int version, DataType default_
{
init ();
_set_state (node, version, false);
_set_state (node, Stateful::loading_state_version, false);
/* now that we have _meter, its safe to connect to this */
@ -748,7 +748,7 @@ Route::add_processor_from_xml (const XMLNode& node, ProcessorList::iterator iter
} else if (prop->value() == "meter") {
if (_meter) {
if (_meter->set_state (node)) {
if (_meter->set_state (node, Stateful::loading_state_version)) {
return false;
} else {
return true;
@ -763,7 +763,7 @@ Route::add_processor_from_xml (const XMLNode& node, ProcessorList::iterator iter
/* amp always exists */
processor = _amp;
if (processor->set_state (node)) {
if (processor->set_state (node, Stateful::loading_state_version)) {
return false;
} else {
/* never any reason to add it */
@ -777,7 +777,7 @@ Route::add_processor_from_xml (const XMLNode& node, ProcessorList::iterator iter
} else if (prop->value() == "intreturn") {
if (_intreturn) {
if (_intreturn->set_state (node)) {
if (_intreturn->set_state (node, Stateful::loading_state_version)) {
return false;
} else {
return true;
@ -789,7 +789,7 @@ Route::add_processor_from_xml (const XMLNode& node, ProcessorList::iterator iter
} else if (prop->value() == "main-outs") {
if (_main_outs) {
if (_main_outs->set_state (node)) {
if (_main_outs->set_state (node, Stateful::loading_state_version)) {
return false;
} else {
return true;
@ -848,11 +848,11 @@ Route::add_processor_from_xml_2X (const XMLNode& node, int version, ProcessorLis
prop->value() == "vst" ||
prop->value() == "audiounit") {
processor.reset (new PluginInsert (_session, node, version));
processor.reset (new PluginInsert (_session, node));
} else {
processor.reset (new PortInsert (_session, _mute_master, node, version));
processor.reset (new PortInsert (_session, _mute_master, node));
}
}
@ -1710,9 +1710,9 @@ Route::_set_state (const XMLNode& node, int version, bool /*call_base*/)
}
if (prop->value() == "Input") {
_input->set_state (*child);
_input->set_state (*child, version);
} else if (prop->value() == "Output") {
_output->set_state (*child);
_output->set_state (*child, version);
}
}
@ -1815,7 +1815,7 @@ Route::_set_state (const XMLNode& node, int version, bool /*call_base*/)
} else if (child->name() == X_("Controllable") && (prop = child->property("name")) != 0) {
if (prop->value() == "solo") {
_solo_control->set_state (*child);
_solo_control->set_state (*child, version);
_session.add_controllable (_solo_control);
}
@ -1827,7 +1827,7 @@ Route::_set_state (const XMLNode& node, int version, bool /*call_base*/)
}
} else if (child->name() == X_("MuteMaster")) {
_mute_master->set_state (*child);
_mute_master->set_state (*child, version);
}
}
@ -1887,6 +1887,11 @@ Route::_set_state_2X (const XMLNode& node, int version)
child = *niter;
if (child->name() == IO::state_node_name) {
/* there is a note in IO::set_state_2X() about why we have to call
this directly.
*/
_input->set_state_2X (*child, version, true);
_output->set_state_2X (*child, version, false);
@ -2011,7 +2016,7 @@ Route::_set_state_2X (const XMLNode& node, int version)
} else if (child->name() == X_("Controllable") && (prop = child->property("name")) != 0) {
if (prop->value() == "solo") {
_solo_control->set_state (*child);
_solo_control->set_state (*child, version);
_session.add_controllable (_solo_control);
}
@ -2144,7 +2149,7 @@ Route::set_processor_state (const XMLNode& node)
// and make it (just) so
(*i)->set_state (**niter);
(*i)->set_state (**niter, Stateful::current_state_version);
}
}

View file

@ -167,7 +167,7 @@ Send::set_state (const XMLNode& node, int version)
/* XXX need to load automation state & data for amp */
Delivery::set_state (*insert_node);
Delivery::set_state (*insert_node, version);
return 0;
}

View file

@ -353,6 +353,10 @@ Session::destroy ()
delete state_tree;
/* reset dynamic state version back to default */
Stateful::loading_state_version = 0;
terminate_butler_thread ();
//terminate_midi_thread ();
@ -547,7 +551,7 @@ Session::when_engine_running ()
/* existing state for Click */
if (_click_io->set_state (*child->children().front()) == 0) {
if (_click_io->set_state (*child->children().front(), Stateful::loading_state_version) == 0) {
_clicking = Config->get_clicking ();

View file

@ -164,7 +164,7 @@ Session::GlobalRouteStateCommand::GlobalRouteStateCommand (Session& s, void* p)
Session::GlobalRouteStateCommand::GlobalRouteStateCommand (Session& s, const XMLNode& node)
: sess (s), src (this)
{
if (set_state (node)) {
if (set_state (node, Stateful::loading_state_version)) {
throw failed_constructor ();
}
}
@ -389,7 +389,7 @@ Session::GlobalMeteringStateCommand::GlobalMeteringStateCommand(Session &s, void
Session::GlobalMeteringStateCommand::GlobalMeteringStateCommand (Session& s, const XMLNode& node)
: sess (s), src (this)
{
if (set_state (node)) {
if (set_state (node, Stateful::loading_state_version)) {
throw failed_constructor();
}
}

View file

@ -311,7 +311,7 @@ Session::second_stage_init (bool new_session)
// to call setup_raid_path() here.
if (state_tree) {
if (set_state (*state_tree->root())) {
if (set_state (*state_tree->root(), Stateful::loading_state_version)) {
return -1;
}
} else {
@ -756,7 +756,7 @@ int
Session::restore_state (string snapshot_name)
{
if (load_state (snapshot_name) == 0) {
set_state (*state_tree->root());
set_state (*state_tree->root(), Stateful::loading_state_version);
}
return 0;
@ -824,20 +824,20 @@ Session::load_state (string snapshot_name)
}
const XMLProperty* prop;
bool is_old = false; // session is _very_ old (pre-2.0)
if ((prop = root.property ("version")) == 0) {
/* no version implies very old version of Ardour */
is_old = true;
Stateful::loading_state_version = 1000;
} else {
int major_version;
major_version = atoi (prop->value().c_str()); // grab just the first number before the period
if (major_version < 2) {
is_old = true;
}
int major;
int minor;
int micro;
sscanf (prop->value().c_str(), "%d.%d.%d", &major, &minor, &micro);
Stateful::loading_state_version = (major * 1000) + minor;
}
if (is_old) {
if (Stateful::loading_state_version < CURRENT_SESSION_FILE_VERSION) {
sys::path backup_path(_session_dir->root_path());
@ -1212,7 +1212,7 @@ Session::set_state (const XMLNode& node, int version)
if (version >= 3000) {
if ((child = find_named_node (node, "Metadata")) == 0) {
warning << _("Session: XML state has no metadata section") << endmsg;
} else if (_metadata->set_state (*child)) {
} else if (_metadata->set_state (*child, version)) {
goto out;
}
}
@ -1220,7 +1220,7 @@ Session::set_state (const XMLNode& node, int version)
if ((child = find_named_node (node, "Locations")) == 0) {
error << _("Session: XML state has no locations section") << endmsg;
goto out;
} else if (_locations.set_state (*child)) {
} else if (_locations.set_state (*child, version)) {
goto out;
}
@ -1331,7 +1331,7 @@ Session::set_state (const XMLNode& node, int version)
if ((child = find_named_node (node, "TempoMap")) == 0) {
error << _("Session: XML state has no Tempo Map section") << endmsg;
goto out;
} else if (_tempo_map->set_state (*child)) {
} else if (_tempo_map->set_state (*child, version)) {
goto out;
}
@ -1345,7 +1345,7 @@ Session::set_state (const XMLNode& node, int version)
if ((child = find_named_node (node, "Click")) == 0) {
warning << _("Session: XML state has no click section") << endmsg;
} else if (_click_io) {
_click_io->set_state (*child);
_click_io->set_state (*child, version);
}
if ((child = find_named_node (node, "ControlProtocols")) != 0) {
@ -1419,7 +1419,7 @@ Session::XMLRouteFactory (const XMLNode& node, int version)
return ret;
}
} else {
boost::shared_ptr<Route> ret (new Route (*this, node, version));
boost::shared_ptr<Route> ret (new Route (*this, node));
return ret;
}
}

Some files were not shown because too many files have changed in this diff Show more