diff --git a/gtk2_ardour/audio_time_axis.cc b/gtk2_ardour/audio_time_axis.cc index 7f239f4e67..281bedafe1 100644 --- a/gtk2_ardour/audio_time_axis.cc +++ b/gtk2_ardour/audio_time_axis.cc @@ -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) { diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc index 73727ca987..3e89826cad 100644 --- a/gtk2_ardour/automation_line.cc +++ b/gtk2_ardour/automation_line.cc @@ -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 diff --git a/gtk2_ardour/automation_line.h b/gtk2_ardour/automation_line.h index 817f66c1d2..c8c265c307 100644 --- a/gtk2_ardour/automation_line.h +++ b/gtk2_ardour/automation_line.h @@ -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); diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc index 1fffe564fb..e18ab441bc 100644 --- a/gtk2_ardour/automation_time_axis.cc +++ b/gtk2_ardour/automation_time_axis.cc @@ -194,7 +194,7 @@ AutomationTimeAxisView::AutomationTimeAxisView (Session& s, boost::shared_ptrparameter()); 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())) { diff --git a/gtk2_ardour/automation_time_axis.h b/gtk2_ardour/automation_time_axis.h index f6239314ab..f4d71f93c2 100644 --- a/gtk2_ardour/automation_time_axis.h +++ b/gtk2_ardour/automation_time_axis.h @@ -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 (); diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index fec836210c..daeb5aa23f 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -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 (_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); } } diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index f2779d353c..34d402c049 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -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); diff --git a/gtk2_ardour/keyboard.cc b/gtk2_ardour/keyboard.cc index 9333f15b51..635ac8137c 100644 --- a/gtk2_ardour/keyboard.cc +++ b/gtk2_ardour/keyboard.cc @@ -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 () diff --git a/gtk2_ardour/keyboard.h b/gtk2_ardour/keyboard.h index 9f354f38e3..e34c424329 100644 --- a/gtk2_ardour/keyboard.h +++ b/gtk2_ardour/keyboard.h @@ -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 State; typedef uint32_t ModifierMask; diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc index 8460b6ab37..6aaf33854c 100644 --- a/gtk2_ardour/midi_time_axis.cc +++ b/gtk2_ardour/midi_time_axis.cc @@ -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)); diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index 52eceb2058..e21e1f734a 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -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; diff --git a/gtk2_ardour/route_time_axis.h b/gtk2_ardour/route_time_axis.h index 7ca88aefd4..19715fe99d 100644 --- a/gtk2_ardour/route_time_axis.h +++ b/gtk2_ardour/route_time_axis.h @@ -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 { diff --git a/gtk2_ardour/session_metadata_dialog.cc b/gtk2_ardour/session_metadata_dialog.cc index be2e6fe012..62ea31918c 100644 --- a/gtk2_ardour/session_metadata_dialog.cc +++ b/gtk2_ardour/session_metadata_dialog.cc @@ -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); diff --git a/gtk2_ardour/time_axis_view.h b/gtk2_ardour/time_axis_view.h index 1597e32a55..e8860cb907 100644 --- a/gtk2_ardour/time_axis_view.h +++ b/gtk2_ardour/time_axis_view.h @@ -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; } diff --git a/gtk2_ardour/ui_config.cc b/gtk2_ardour/ui_config.cc index 1f1f25f239..d0878073b7 100644 --- a/gtk2_ardour/ui_config.cc +++ b/gtk2_ardour/ui_config.cc @@ -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; } diff --git a/gtk2_ardour/ui_config.h b/gtk2_ardour/ui_config.h index 857df3f7e3..09e8448831 100644 --- a/gtk2_ardour/ui_config.h +++ b/gtk2_ardour/ui_config.h @@ -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&); diff --git a/libs/ardour/amp.cc b/libs/ardour/amp.cc index bf3e7cee68..2100d736a8 100644 --- a/libs/ardour/amp.cc +++ b/libs/ardour/amp.cc @@ -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) { diff --git a/libs/ardour/ardour/amp.h b/libs/ardour/ardour/amp.h index 3cd1bf13dd..724b1095a1 100644 --- a/libs/ardour/ardour/amp.h +++ b/libs/ardour/ardour/amp.h @@ -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); diff --git a/libs/ardour/ardour/audio_diskstream.h b/libs/ardour/ardour/audio_diskstream.h index 507b148d82..ae2176cbab 100644 --- a/libs/ardour/ardour/audio_diskstream.h +++ b/libs/ardour/ardour/audio_diskstream.h @@ -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); diff --git a/libs/ardour/ardour/audio_track.h b/libs/ardour/ardour/audio_track.h index 585d1a1e72..fc5b4255b3 100644 --- a/libs/ardour/ardour/audio_track.h +++ b/libs/ardour/ardour/audio_track.h @@ -55,7 +55,7 @@ class AudioTrack : public Track boost::shared_ptr bounce (InterThreadInfo&); boost::shared_ptr 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); diff --git a/libs/ardour/ardour/audiofilesource.h b/libs/ardour/ardour/audiofilesource.h index 6b93ced905..95c7db4385 100644 --- a/libs/ardour/ardour/audiofilesource.h +++ b/libs/ardour/ardour/audiofilesource.h @@ -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; } diff --git a/libs/ardour/ardour/audioplaylist.h b/libs/ardour/ardour/audioplaylist.h index 25595def8c..277fe5a8e1 100644 --- a/libs/ardour/ardour/audioplaylist.h +++ b/libs/ardour/ardour/audioplaylist.h @@ -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 > NewCrossfade; diff --git a/libs/ardour/ardour/audioregion.h b/libs/ardour/ardour/audioregion.h index 5e9031c897..a8055575f9 100644 --- a/libs/ardour/ardour/audioregion.h +++ b/libs/ardour/ardour/audioregion.h @@ -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 */ diff --git a/libs/ardour/ardour/audiosource.h b/libs/ardour/ardour/audiosource.h index eebd1dd5d9..dd6076630d 100644 --- a/libs/ardour/ardour/audiosource.h +++ b/libs/ardour/ardour/audiosource.h @@ -79,7 +79,7 @@ class AudioSource : virtual public Source, mutable sigc::signal 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 (); diff --git a/libs/ardour/ardour/automation_list.h b/libs/ardour/ardour/automation_list.h index 5f074385a3..69c8e38c95 100644 --- a/libs/ardour/ardour/automation_list.h +++ b/libs/ardour/ardour/automation_list.h @@ -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 (); diff --git a/libs/ardour/ardour/control_protocol_manager.h b/libs/ardour/ardour/control_protocol_manager.h index d1f059dc62..d2b1796b18 100644 --- a/libs/ardour/ardour/control_protocol_manager.h +++ b/libs/ardour/ardour/control_protocol_manager.h @@ -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: diff --git a/libs/ardour/ardour/crossfade.h b/libs/ardour/ardour/crossfade.h index 8a7773c035..5d8e0235fb 100644 --- a/libs/ardour/ardour/crossfade.h +++ b/libs/ardour/ardour/crossfade.h @@ -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 in() const { return _in; } boost::shared_ptr out() const { return _out; } diff --git a/libs/ardour/ardour/delivery.h b/libs/ardour/ardour/delivery.h index ef78c9bd45..beccab73ae 100644 --- a/libs/ardour/ardour/delivery.h +++ b/libs/ardour/ardour/delivery.h @@ -89,7 +89,7 @@ public: static sigc::signal CycleStart; XMLNode& state (bool full); - int set_state (const XMLNode&, int version = 3000); + int set_state (const XMLNode&, int version); /* Panning */ diff --git a/libs/ardour/ardour/diskstream.h b/libs/ardour/ardour/diskstream.h index 5427dc644d..23ba6a713e 100644 --- a/libs/ardour/ardour/diskstream.h +++ b/libs/ardour/ardour/diskstream.h @@ -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) {} diff --git a/libs/ardour/ardour/file_source.h b/libs/ardour/ardour/file_source.h index 5a9c2a9c56..ce34f1c0d4 100644 --- a/libs/ardour/ardour/file_source.h +++ b/libs/ardour/ardour/file_source.h @@ -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); diff --git a/libs/ardour/ardour/internal_return.h b/libs/ardour/ardour/internal_return.h index e896200c93..dfd37a4de5 100644 --- a/libs/ardour/ardour/internal_return.h +++ b/libs/ardour/ardour/internal_return.h @@ -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); diff --git a/libs/ardour/ardour/internal_send.h b/libs/ardour/ardour/internal_send.h index d62be9eafa..3b069af194 100644 --- a/libs/ardour/ardour/internal_send.h +++ b/libs/ardour/ardour/internal_send.h @@ -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 other) const; diff --git a/libs/ardour/ardour/io.h b/libs/ardour/ardour/io.h index 9a13ced942..5d64fae580 100644 --- a/libs/ardour/ardour/io.h +++ b/libs/ardour/ardour/io.h @@ -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); diff --git a/libs/ardour/ardour/io_processor.h b/libs/ardour/ardour/io_processor.h index fdb0429bca..0d564bb00c 100644 --- a/libs/ardour/ardour/io_processor.h +++ b/libs/ardour/ardour/io_processor.h @@ -72,7 +72,7 @@ class IOProcessor : public Processor sigc::signal 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 _input; diff --git a/libs/ardour/ardour/ladspa_plugin.h b/libs/ardour/ardour/ladspa_plugin.h index b08f3e5afa..656c13afae 100644 --- a/libs/ardour/ardour/ladspa_plugin.h +++ b/libs/ardour/ardour/ladspa_plugin.h @@ -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 { diff --git a/libs/ardour/ardour/location.h b/libs/ardour/ardour/location.h index cbc0782a4a..b48db52d92 100644 --- a/libs/ardour/ardour/location.h +++ b/libs/ardour/ardour/location.h @@ -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; diff --git a/libs/ardour/ardour/lv2_plugin.h b/libs/ardour/ardour/lv2_plugin.h index de42512cfe..f2773a3d6c 100644 --- a/libs/ardour/ardour/lv2_plugin.h +++ b/libs/ardour/ardour/lv2_plugin.h @@ -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 get_presets(); diff --git a/libs/ardour/ardour/midi_diskstream.h b/libs/ardour/ardour/midi_diskstream.h index aab752d591..e152989229 100644 --- a/libs/ardour/ardour/midi_diskstream.h +++ b/libs/ardour/ardour/midi_diskstream.h @@ -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); diff --git a/libs/ardour/ardour/midi_model.h b/libs/ardour/ardour/midi_model.h index a5b0e36b26..6c7e26119a 100644 --- a/libs/ardour/ardour/midi_model.h +++ b/libs/ardour/ardour/midi_model.h @@ -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 > 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 > note, diff --git a/libs/ardour/ardour/midi_playlist.h b/libs/ardour/ardour/midi_playlist.h index dc315edb12..c83bf80a28 100644 --- a/libs/ardour/ardour/midi_playlist.h +++ b/libs/ardour/ardour/midi_playlist.h @@ -50,7 +50,7 @@ public: nframes_t read (MidiRingBuffer& 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); diff --git a/libs/ardour/ardour/midi_region.h b/libs/ardour/ardour/midi_region.h index ddb3109ff6..c796ee742b 100644 --- a/libs/ardour/ardour/midi_region.h +++ b/libs/ardour/ardour/midi_region.h @@ -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 >&) 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 */ diff --git a/libs/ardour/ardour/midi_source.h b/libs/ardour/ardour/midi_source.h index 8a09aad6c8..bffcde5192 100644 --- a/libs/ardour/ardour/midi_source.h +++ b/libs/ardour/ardour/midi_source.h @@ -91,7 +91,7 @@ class MidiSource : virtual public Source mutable sigc::signal 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; } diff --git a/libs/ardour/ardour/midi_track.h b/libs/ardour/ardour/midi_track.h index 9f19c6590c..c273395a74 100644 --- a/libs/ardour/ardour/midi_track.h +++ b/libs/ardour/ardour/midi_track.h @@ -59,7 +59,7 @@ public: boost::shared_ptr 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); diff --git a/libs/ardour/ardour/mute_master.h b/libs/ardour/ardour/mute_master.h index 39ad9ffd61..70015f3a35 100644 --- a/libs/ardour/ardour/mute_master.h +++ b/libs/ardour/ardour/mute_master.h @@ -65,7 +65,7 @@ class MuteMaster : public AutomationControl sigc::signal MutePointChanged; XMLNode& get_state(); - int set_state(const XMLNode&, int version = 3000); + int set_state(const XMLNode&, int version); private: AutomationList* _automation; diff --git a/libs/ardour/ardour/named_selection.h b/libs/ardour/ardour/named_selection.h index 4911dd8c50..d41f104e1a 100644 --- a/libs/ardour/ardour/named_selection.h +++ b/libs/ardour/ardour/named_selection.h @@ -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 NamedSelectionCreated; }; diff --git a/libs/ardour/ardour/panner.h b/libs/ardour/ardour/panner.h index 6a435ec235..86cd486113 100644 --- a/libs/ardour/ardour/panner.h +++ b/libs/ardour/ardour/panner.h @@ -73,7 +73,7 @@ class StreamPanner : public sigc::trackable, public PBD::Stateful sigc::signal Changed; /* for position */ sigc::signal 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 diff --git a/libs/ardour/ardour/playlist.h b/libs/ardour/ardour/playlist.h index 01bb12db8d..aa661b8588 100644 --- a/libs/ardour/ardour/playlist.h +++ b/libs/ardour/ardour/playlist.h @@ -124,7 +124,7 @@ class Playlist : public SessionObject, void foreach_region (sigc::slot >); XMLNode& get_state (); - int set_state (const XMLNode&, int version = 3000); + int set_state (const XMLNode&, int version); XMLNode& get_template (); sigc::signal InUse; diff --git a/libs/ardour/ardour/plugin_insert.h b/libs/ardour/ardour/plugin_insert.h index 82111a5a4d..ea8228f5fc 100644 --- a/libs/ardour/ardour/plugin_insert.h +++ b/libs/ardour/ardour/plugin_insert.h @@ -45,14 +45,14 @@ class PluginInsert : public Processor { public: PluginInsert (Session&, boost::shared_ptr); - 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); diff --git a/libs/ardour/ardour/port_insert.h b/libs/ardour/ardour/port_insert.h index 73dacf7d68..3283415e6d 100644 --- a/libs/ardour/ardour/port_insert.h +++ b/libs/ardour/ardour/port_insert.h @@ -44,12 +44,12 @@ class PortInsert : public IOProcessor { public: PortInsert (Session&, boost::shared_ptr mm); - PortInsert (Session&, boost::shared_ptr mm, const XMLNode&, int version = 3000); + PortInsert (Session&, boost::shared_ptr 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); diff --git a/libs/ardour/ardour/processor.h b/libs/ardour/ardour/processor.h index 1e78777edd..473bb97130 100644 --- a/libs/ardour/ardour/processor.h +++ b/libs/ardour/ardour/processor.h @@ -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; } diff --git a/libs/ardour/ardour/rc_configuration.h b/libs/ardour/ardour/rc_configuration.h index d0dc042bb1..555c925a01 100644 --- a/libs/ardour/ardour/rc_configuration.h +++ b/libs/ardour/ardour/rc_configuration.h @@ -37,7 +37,7 @@ class RCConfiguration : public Configuration RCConfiguration(); void map_parameters (sigc::slot); - 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 &); diff --git a/libs/ardour/ardour/region.h b/libs/ardour/ardour/region.h index d341489249..0f1f10eff8 100644 --- a/libs/ardour/ardour/region.h +++ b/libs/ardour/ardour/region.h @@ -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 get_parent() const; diff --git a/libs/ardour/ardour/return.h b/libs/ardour/ardour/return.h index 3232e93295..b3212fe4a0 100644 --- a/libs/ardour/ardour/return.h +++ b/libs/ardour/ardour/return.h @@ -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(); } diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h index ac3c6f89f3..51e4d99335 100644 --- a/libs/ardour/ardour/route.h +++ b/libs/ardour/ardour/route.h @@ -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 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 (); diff --git a/libs/ardour/ardour/route_group.h b/libs/ardour/ardour/route_group.h index 124f3c9b3f..0f71093377 100644 --- a/libs/ardour/ardour/route_group.h +++ b/libs/ardour/ardour/route_group.h @@ -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; diff --git a/libs/ardour/ardour/send.h b/libs/ardour/ardour/send.h index 13b7adbbf2..f9f13ee309 100644 --- a/libs/ardour/ardour/send.h +++ b/libs/ardour/ardour/send.h @@ -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(); } diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index c5b793730c..cc94d3878c 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -468,7 +468,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable static std::vector* 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: @@ -1170,8 +1170,8 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable std::string _current_snapshot_name; - XMLTree* state_tree; - bool state_was_pending; + XMLTree* state_tree; + bool state_was_pending; StateOfTheState _state_of_the_state; void auto_save(); diff --git a/libs/ardour/ardour/session_configuration.h b/libs/ardour/ardour/session_configuration.h index 20e14f37d5..20df86ca4d 100644 --- a/libs/ardour/ardour/session_configuration.h +++ b/libs/ardour/ardour/session_configuration.h @@ -30,7 +30,7 @@ public: SessionConfiguration (); void map_parameters (sigc::slot); - 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 &); diff --git a/libs/ardour/ardour/session_metadata.h b/libs/ardour/ardour/session_metadata.h index 7813788e55..481e21c338 100644 --- a/libs/ardour/ardour/session_metadata.h +++ b/libs/ardour/ardour/session_metadata.h @@ -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: diff --git a/libs/ardour/ardour/smf_source.h b/libs/ardour/ardour/smf_source.h index 3c6364532a..fbaa049d8a 100644 --- a/libs/ardour/ardour/smf_source.h +++ b/libs/ardour/ardour/smf_source.h @@ -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 (); diff --git a/libs/ardour/ardour/source.h b/libs/ardour/ardour/source.h index c34c5a9158..1ffca509fd 100644 --- a/libs/ardour/ardour/source.h +++ b/libs/ardour/ardour/source.h @@ -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); } diff --git a/libs/ardour/ardour/tempo.h b/libs/ardour/ardour/tempo.h index 742919c77a..658330cf82 100644 --- a/libs/ardour/ardour/tempo.h +++ b/libs/ardour/ardour/tempo.h @@ -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 (); diff --git a/libs/ardour/ardour/track.h b/libs/ardour/ardour/track.h index 74cbe399df..02cab70a84 100644 --- a/libs/ardour/ardour/track.h +++ b/libs/ardour/ardour/track.h @@ -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 rec_enable_control() { return _rec_enable_control; } @@ -96,7 +96,7 @@ class Track : public Route sigc::signal 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; diff --git a/libs/ardour/ardour/user_bundle.h b/libs/ardour/ardour/user_bundle.h index f590ec1ebe..c124e2e722 100644 --- a/libs/ardour/ardour/user_bundle.h +++ b/libs/ardour/ardour/user_bundle.h @@ -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); }; } diff --git a/libs/ardour/audio_diskstream.cc b/libs/ardour/audio_diskstream.cc index bb0b715f3b..e43cbd7891 100644 --- a/libs/ardour/audio_diskstream.cc +++ b/libs/ardour/audio_diskstream.cc @@ -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(); } diff --git a/libs/ardour/audio_playlist.cc b/libs/ardour/audio_playlist.cc index 812aa8783b..eb4913e727 100644 --- a/libs/ardour/audio_playlist.cc +++ b/libs/ardour/audio_playlist.cc @@ -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 (); diff --git a/libs/ardour/audio_track.cc b/libs/ardour/audio_track.cc index 600cad6aa2..c1862fb5b0 100644 --- a/libs/ardour/audio_track.cc +++ b/libs/ardour/audio_track.cc @@ -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::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; } } diff --git a/libs/ardour/audiofilesource.cc b/libs/ardour/audiofilesource.cc index 5430d300fb..8de786eb0e 100644 --- a/libs/ardour/audiofilesource.cc +++ b/libs/ardour/audiofilesource.cc @@ -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; } diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc index 47dfc6c902..a5c52ce671 100644 --- a/libs/ardour/audioregion.cc +++ b/libs/ardour/audioregion.cc @@ -236,7 +236,7 @@ AudioRegion::AudioRegion (boost::shared_ptr 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 diff --git a/libs/ardour/audiosource.cc b/libs/ardour/audiosource.cc index d50ad0c6b7..93e201b8c2 100644 --- a/libs/ardour/audiosource.cc +++ b/libs/ardour/audiosource.cc @@ -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(); } } diff --git a/libs/ardour/automation_list.cc b/libs/ardour/automation_list.cc index be3c38f29b..c0a652275c 100644 --- a/libs/ardour/automation_list.cc +++ b/libs/ardour/automation_list.cc @@ -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 */ diff --git a/libs/ardour/control_protocol_manager.cc b/libs/ardour/control_protocol_manager.cc index 8546a41e66..0e687988d2 100644 --- a/libs/ardour/control_protocol_manager.cc +++ b/libs/ardour/control_protocol_manager.cc @@ -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); } } } diff --git a/libs/ardour/crossfade.cc b/libs/ardour/crossfade.cc index 65ad1e25fb..c69eeea21d 100644 --- a/libs/ardour/crossfade.cc +++ b/libs/ardour/crossfade.cc @@ -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(); } } diff --git a/libs/ardour/delivery.cc b/libs/ardour/delivery.cc index 5f264c5b7e..5b063ad566 100644 --- a/libs/ardour/delivery.cc +++ b/libs/ardour/delivery.cc @@ -109,7 +109,7 @@ Delivery::Delivery (Session& s, boost::shared_ptr mm, const XMLNode& { _panner = boost::shared_ptr(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 out, boost::shared_ptr(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 (); diff --git a/libs/ardour/globals.cc b/libs/ardour/globals.cc index acd7da1bc5..d893c1e54b 100644 --- a/libs/ardour/globals.cc +++ b/libs/ardour/globals.cc @@ -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); } } diff --git a/libs/ardour/internal_return.cc b/libs/ardour/internal_return.cc index 9f828ab47b..8a3baf5bda 100644 --- a/libs/ardour/internal_return.cc +++ b/libs/ardour/internal_return.cc @@ -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 diff --git a/libs/ardour/internal_send.cc b/libs/ardour/internal_send.cc index abc6ced05c..d70889a27c 100644 --- a/libs/ardour/internal_send.cc +++ b/libs/ardour/internal_send.cc @@ -49,7 +49,7 @@ InternalSend::InternalSend (Session& s, boost::shared_ptr mm, boost: InternalSend::InternalSend (Session& s, boost::shared_ptr 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) { diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc index f49692a910..5bb51bfa18 100644 --- a/libs/ardour/io.cc +++ b/libs/ardour/io.cc @@ -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 (); } diff --git a/libs/ardour/io_processor.cc b/libs/ardour/io_processor.cc index 2f42c724bf..21a2b10313 100644 --- a/libs/ardour/io_processor.cc +++ b/libs/ardour/io_processor.cc @@ -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) { diff --git a/libs/ardour/location.cc b/libs/ardour/location.cc index 5fb0442eba..7b9e706c36 100644 --- a/libs/ardour/location.cc +++ b/libs/ardour/location.cc @@ -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 (); } } diff --git a/libs/ardour/lv2_plugin.cc b/libs/ardour/lv2_plugin.cc index 0fb766e7d4..38774104af 100644 --- a/libs/ardour/lv2_plugin.cc +++ b/libs/ardour/lv2_plugin.cc @@ -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; diff --git a/libs/ardour/midi_diskstream.cc b/libs/ardour/midi_diskstream.cc index 4cae900074..a1604858e4 100644 --- a/libs/ardour/midi_diskstream.cc +++ b/libs/ardour/midi_diskstream.cc @@ -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(); } diff --git a/libs/ardour/midi_model.cc b/libs/ardour/midi_model.cc index df34d13a24..eb69a2a906 100644 --- a/libs/ardour/midi_model.cc +++ b/libs/ardour/midi_model.cc @@ -112,7 +112,7 @@ MidiModel::DeltaCommand::DeltaCommand(boost::shared_ptr 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 m, const XMLNod : _model(m) { assert(_model); - set_state(node); + set_state(node, Stateful::loading_state_version); } void diff --git a/libs/ardour/midi_playlist.cc b/libs/ardour/midi_playlist.cc index b0fd5de24e..8d030b949e 100644 --- a/libs/ardour/midi_playlist.cc +++ b/libs/ardour/midi_playlist.cc @@ -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--; diff --git a/libs/ardour/midi_region.cc b/libs/ardour/midi_region.cc index f22a1994bf..3ced46df9f 100644 --- a/libs/ardour/midi_region.cc +++ b/libs/ardour/midi_region.cc @@ -91,7 +91,7 @@ MidiRegion::MidiRegion (boost::shared_ptr other) MidiRegion::MidiRegion (boost::shared_ptr 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 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 diff --git a/libs/ardour/midi_source.cc b/libs/ardour/midi_source.cc index e90e90aa32..53b1d2c9a5 100644 --- a/libs/ardour/midi_source.cc +++ b/libs/ardour/midi_source.cc @@ -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(); } } diff --git a/libs/ardour/midi_track.cc b/libs/ardour/midi_track.cc index 6f036f803c..68ff7de1e2 100644 --- a/libs/ardour/midi_track.cc +++ b/libs/ardour/midi_track.cc @@ -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); } } diff --git a/libs/ardour/panner.cc b/libs/ardour/panner.cc index 993cbe39f8..a867130b51 100644 --- a/libs/ardour/panner.cc +++ b/libs/ardour/panner.cc @@ -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); } diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc index aebcb59f3d..a072d4977b 100644 --- a/libs/ardour/playlist.cc +++ b/libs/ardour/playlist.cc @@ -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; } diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc index 14ea464555..2a5ef29a45 100644 --- a/libs/ardour/plugin_insert.cc +++ b/libs/ardour/plugin_insert.cc @@ -81,12 +81,12 @@ PluginInsert::PluginInsert (Session& s, boost::shared_ptr 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) { diff --git a/libs/ardour/port_insert.cc b/libs/ardour/port_insert.cc index 04a145aa52..3b02bf41da 100644 --- a/libs/ardour/port_insert.cc +++ b/libs/ardour/port_insert.cc @@ -48,12 +48,12 @@ PortInsert::PortInsert (Session& s, boost::shared_ptr mm) ProcessorCreated (this); /* EMIT SIGNAL */ } -PortInsert::PortInsert (Session& s, boost::shared_ptr mm, const XMLNode& node, int version) +PortInsert::PortInsert (Session& s, boost::shared_ptr 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; } diff --git a/libs/ardour/processor.cc b/libs/ardour/processor.cc index e1db982fe1..a52db49224 100644 --- a/libs/ardour/processor.cc +++ b/libs/ardour/processor.cc @@ -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; } diff --git a/libs/ardour/rc_configuration.cc b/libs/ardour/rc_configuration.cc index afa9a2a4c3..725225b8d0 100644 --- a/libs/ardour/rc_configuration.cc +++ b/libs/ardour/rc_configuration.cc @@ -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; } diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc index 244312bc0a..903452ca03 100644 --- a/libs/ardour/region.cc +++ b/libs/ardour/region.cc @@ -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 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; } diff --git a/libs/ardour/return.cc b/libs/ardour/return.cc index 69aa2f700e..f5122f3a5f 100644 --- a/libs/ardour/return.cc +++ b/libs/ardour/return.cc @@ -58,7 +58,7 @@ Return::Return (Session& s, const XMLNode& node, bool internal) _amp.reset (new Amp (_session, boost::shared_ptr())); _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; } diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index 7e453653dc..5621f08049 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -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); } } diff --git a/libs/ardour/send.cc b/libs/ardour/send.cc index bd9eccaf54..5a39c3322a 100644 --- a/libs/ardour/send.cc +++ b/libs/ardour/send.cc @@ -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; } diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 79790b5673..d8c5639902 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -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 (); diff --git a/libs/ardour/session_command.cc b/libs/ardour/session_command.cc index ffd68bb5a6..e7c9819d20 100644 --- a/libs/ardour/session_command.cc +++ b/libs/ardour/session_command.cc @@ -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(); } } diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index de99558c16..a0254fab6e 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -6,7 +6,7 @@ the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -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; - if (is_old) { + sscanf (prop->value().c_str(), "%d.%d.%d", &major, &minor, µ); + Stateful::loading_state_version = (major * 1000) + minor; + } + + 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 ret (new Route (*this, node, version)); + boost::shared_ptr ret (new Route (*this, node)); return ret; } } diff --git a/libs/ardour/smf_source.cc b/libs/ardour/smf_source.cc index 358cbb1257..eb8d844949 100644 --- a/libs/ardour/smf_source.cc +++ b/libs/ardour/smf_source.cc @@ -75,7 +75,7 @@ SMFSource::SMFSource (Session& s, const XMLNode& node, bool must_exist) , _last_ev_time_frames(0) , _smf_last_read_end (0) { - if (set_state(node)) { + if (set_state(node, Stateful::loading_state_version)) { throw failed_constructor (); } @@ -331,15 +331,15 @@ SMFSource::get_state () int SMFSource::set_state (const XMLNode& node, int version) { - if (Source::set_state (node)) { + if (Source::set_state (node, version)) { return -1; } - if (MidiSource::set_state (node)) { + if (MidiSource::set_state (node, version)) { return -1; } - if (FileSource::set_state (node)) { + if (FileSource::set_state (node, version)) { return -1; } diff --git a/libs/ardour/source.cc b/libs/ardour/source.cc index 7ed4e584ce..fe8a8a1e0a 100644 --- a/libs/ardour/source.cc +++ b/libs/ardour/source.cc @@ -68,7 +68,7 @@ Source::Source (Session& s, const XMLNode& node) _analysed = false; _in_use = 0; - if (set_state (node) || _type == DataType::NIL) { + if (set_state (node, Stateful::loading_state_version) || _type == DataType::NIL) { throw failed_constructor(); } diff --git a/libs/ardour/tempo_map_importer.cc b/libs/ardour/tempo_map_importer.cc index 1d37383fb5..1f9f518614 100644 --- a/libs/ardour/tempo_map_importer.cc +++ b/libs/ardour/tempo_map_importer.cc @@ -99,5 +99,5 @@ TempoMapImporter::_cancel_move () void TempoMapImporter::_move () { - session.tempo_map().set_state (xml_tempo_map); + session.tempo_map().set_state (xml_tempo_map, Stateful::current_state_version); } diff --git a/libs/ardour/track.cc b/libs/ardour/track.cc index ecd8208282..ce208769f6 100644 --- a/libs/ardour/track.cc +++ b/libs/ardour/track.cc @@ -51,8 +51,8 @@ Track::Track (Session& sess, string name, Route::Flag flag, TrackMode mode, Data _mode = mode; } -Track::Track (Session& sess, const XMLNode& node, int version, DataType default_type) - : Route (sess, node, version, default_type) +Track::Track (Session& sess, const XMLNode& node, DataType default_type) + : Route (sess, node, default_type) , _rec_enable_control (new RecEnableControllable(*this)) { _freeze_record.state = NoFreeze; diff --git a/libs/ardour/user_bundle.cc b/libs/ardour/user_bundle.cc index 73b5960e03..16ecb88c8d 100644 --- a/libs/ardour/user_bundle.cc +++ b/libs/ardour/user_bundle.cc @@ -15,10 +15,10 @@ ARDOUR::UserBundle::UserBundle (std::string const & n) } -ARDOUR::UserBundle::UserBundle (XMLNode const & x, bool i) +ARDOUR::UserBundle::UserBundle (XMLNode const & node, bool i) : Bundle (i) { - if (set_state (x)) { + if (set_state (node, Stateful::loading_state_version)) { throw failed_constructor (); } } diff --git a/libs/ardour/wscript b/libs/ardour/wscript index fd71f2e6a7..3711d631fc 100644 --- a/libs/ardour/wscript +++ b/libs/ardour/wscript @@ -19,6 +19,9 @@ LIBARDOUR_VERSION = "%s.%s.%s" % (MAJOR, MINOR, MICRO) # micro increment <=> no interface changes LIBARDOUR_LIB_VERSION = '3.0.0' +# default state file version for this build +CURRENT_SESSION_FILE_VERSION = 3000 + # Variables for 'waf dist' APPNAME = 'libardour' VERSION = LIBARDOUR_VERSION @@ -224,6 +227,8 @@ def configure(conf): conf.define('HAVE_RUBBERBAND', 1) # controls whether we think we have it conf.define('USE_RUBBERBAND', 1) # controls whether we actually use it + conf.define('CURRENT_SESSION_FILE_VERSION', CURRENT_SESSION_FILE_VERSION) + conf.check(header_name='sys/vfs.h', define_name='HAVE_SYS_VFS_H') conf.check(header_name='wordexp.h', define_name='HAVE_WORDEXP') diff --git a/libs/midi++2/midi++/midnam_patch.h b/libs/midi++2/midi++/midnam_patch.h index 27986bc6e9..316ac8fdb9 100644 --- a/libs/midi++2/midi++/midnam_patch.h +++ b/libs/midi++2/midi++/midnam_patch.h @@ -102,7 +102,7 @@ public: const PatchPrimaryKey& patch_primary_key() const { return _id; } XMLNode& get_state (void); - int set_state (const XMLNode&, int version = 3000); + int set_state (const XMLNode&, int version); private: std::string _number; @@ -129,7 +129,7 @@ public: const PatchPrimaryKey* patch_primary_key() const { return _id; } XMLNode& get_state (void); - int set_state (const XMLNode&, int version = 3000); + int set_state (const XMLNode&, int version); private: std::string _name; @@ -203,7 +203,7 @@ public: } XMLNode& get_state (void); - int set_state (const XMLNode& a_node, int version = 3000); + int set_state (const XMLNode& a_node, int version); private: std::string _name; @@ -227,7 +227,7 @@ public: void set_number(const std::string a_number) { _number = a_number; } XMLNode& get_state (void); - int set_state (const XMLNode&, int version = 3000); + int set_state (const XMLNode&, int version); private: std::string _number; @@ -248,7 +248,7 @@ public: const Notes& notes() const { return _notes; } XMLNode& get_state (void); - int set_state (const XMLNode&, int version = 3000); + int set_state (const XMLNode&, int version); private: std::string _name; @@ -266,7 +266,7 @@ public: XMLNode& get_state (void); - int set_state (const XMLNode&, int version = 3000); + int set_state (const XMLNode&, int version); std::string channel_name_set_name_by_channel(uint8_t channel) { assert(channel <= 15); @@ -317,7 +317,7 @@ public: } XMLNode& get_state (void); - int set_state (const XMLNode&, int version = 3000); + int set_state (const XMLNode&, int version); private: std::string _manufacturer; @@ -334,8 +334,8 @@ public: // Maps Model names to MasterDeviceNames typedef std::map > MasterDeviceNamesList; - MIDINameDocument() {}; - MIDINameDocument(const std::string &filename) : _document(XMLTree(filename)) { set_state(*_document.root()); }; + MIDINameDocument() {} + MIDINameDocument(const std::string &filename); virtual ~MIDINameDocument() {}; const std::string& author() const { return _author; } @@ -346,7 +346,7 @@ public: const MasterDeviceNames::Models& all_models() const { return _all_models; } XMLNode& get_state (void); - int set_state (const XMLNode&, int version = 3000); + int set_state (const XMLNode&, int version); private: std::string _author; diff --git a/libs/midi++2/midnam_patch.cc b/libs/midi++2/midnam_patch.cc index 815ebd4b37..d80e11d81a 100644 --- a/libs/midi++2/midnam_patch.cc +++ b/libs/midi++2/midnam_patch.cc @@ -144,7 +144,7 @@ NoteNameList::set_state (const XMLNode& node, int version) node.find("//Note"); for (XMLSharedNodeList::const_iterator i = notes->begin(); i != notes->end(); ++i) { boost::shared_ptr note(new Note()); - note->set_state(*(*i)); + note->set_state(*(*i), version); _notes.push_back(note); } @@ -184,7 +184,7 @@ PatchBank::set_state (const XMLNode& node, int version) const XMLNodeList patches = patch_name_list->children(); for (XMLNodeList::const_iterator i = patches.begin(); i != patches.end(); ++i) { boost::shared_ptr patch(new Patch(this)); - patch->set_state(*(*i)); + patch->set_state(*(*i), version); _patch_name_list.push_back(patch); } @@ -251,7 +251,7 @@ ChannelNameSet::set_state (const XMLNode& node, int version) if (node->name() == "PatchBank") { // cerr << "got PatchBank" << endl; boost::shared_ptr bank(new PatchBank()); - bank->set_state(*node); + bank->set_state(*node, version); _patch_banks.push_back(bank); const PatchBank::PatchNameList& patches = bank->patch_name_list(); for (PatchBank::PatchNameList::const_iterator patch = patches.begin(); @@ -336,7 +336,7 @@ MasterDeviceNames::set_state(const XMLNode& a_node, int version) i != custom_device_modes->end(); ++i) { boost::shared_ptr custom_device_mode(new CustomDeviceMode()); - custom_device_mode->set_state(*(*i)); + custom_device_mode->set_state(*(*i), version); _custom_device_modes[custom_device_mode->name()] = custom_device_mode; _custom_device_mode_names.push_back(custom_device_mode->name()); @@ -350,7 +350,7 @@ MasterDeviceNames::set_state(const XMLNode& a_node, int version) ++i) { boost::shared_ptr channel_name_set(new ChannelNameSet()); // cerr << "MasterDeviceNames::set_state ChannelNameSet before set_state" << endl; - channel_name_set->set_state(*(*i)); + channel_name_set->set_state(*(*i), version); _channel_name_sets[channel_name_set->name()] = channel_name_set; } @@ -361,7 +361,7 @@ MasterDeviceNames::set_state(const XMLNode& a_node, int version) i != note_name_lists->end(); ++i) { boost::shared_ptr note_name_list(new NoteNameList()); - note_name_list->set_state(*(*i)); + note_name_list->set_state(*(*i), version); _note_name_lists.push_back(note_name_list); } @@ -375,6 +375,12 @@ MasterDeviceNames::get_state(void) return nothing; } +MIDINameDocument::MIDINameDocument (const string& filename) + : _document(XMLTree(filename)) +{ + set_state(*_document.root(), 0); +} + int MIDINameDocument::set_state(const XMLNode& a_node, int version) { @@ -391,7 +397,7 @@ MIDINameDocument::set_state(const XMLNode& a_node, int version) ++i) { boost::shared_ptr master_device_names(new MasterDeviceNames()); // cerr << "MIDINameDocument::set_state before masterdevicenames->set_state" << endl; - master_device_names->set_state(*(*i)); + master_device_names->set_state(*(*i), version); // cerr << "MIDINameDocument::set_state after masterdevicenames->set_state" << endl; for (MasterDeviceNames::Models::const_iterator model = master_device_names->models().begin(); diff --git a/libs/pbd/pbd/command.h b/libs/pbd/pbd/command.h index f913dec5b7..8e85e28882 100644 --- a/libs/pbd/pbd/command.h +++ b/libs/pbd/pbd/command.h @@ -38,7 +38,7 @@ public: virtual void redo() { (*this)(); } virtual XMLNode &get_state(); - virtual int set_state(const XMLNode&, int version = 3000) { /* noop */ return 0; } + virtual int set_state(const XMLNode&, int version) { /* noop */ return 0; } protected: Command() {} diff --git a/libs/pbd/pbd/controllable.h b/libs/pbd/pbd/controllable.h index 4afcb53740..1ab649f8b9 100644 --- a/libs/pbd/pbd/controllable.h +++ b/libs/pbd/pbd/controllable.h @@ -51,7 +51,7 @@ class Controllable : public PBD::StatefulDestructible { sigc::signal Changed; - int set_state (const XMLNode&, int version = 3000); + int set_state (const XMLNode&, int version); XMLNode& get_state (); std::string name() const { return _name; } diff --git a/libs/pbd/pbd/memento_command.h b/libs/pbd/pbd/memento_command.h index b1347c169d..c1e5d75f9c 100644 --- a/libs/pbd/pbd/memento_command.h +++ b/libs/pbd/pbd/memento_command.h @@ -54,13 +54,13 @@ public: void operator() () { if (after) { - obj.set_state(*after); + obj.set_state(*after, Stateful::current_state_version); } } void undo() { if (before) { - obj.set_state(*before); + obj.set_state(*before, Stateful::current_state_version); } } diff --git a/libs/pbd/pbd/stateful.h b/libs/pbd/pbd/stateful.h index 324d9c1222..0204c8084a 100644 --- a/libs/pbd/pbd/stateful.h +++ b/libs/pbd/pbd/stateful.h @@ -38,7 +38,7 @@ class 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; /* Extra XML nodes */ @@ -47,6 +47,9 @@ class Stateful { const PBD::ID& id() const { return _id; } + static int current_state_version; + static int loading_state_version; + protected: void add_instant_xml (XMLNode&, const sys::path& directory_path); diff --git a/libs/pbd/stateful.cc b/libs/pbd/stateful.cc index 12ae4306ed..58be141a27 100644 --- a/libs/pbd/stateful.cc +++ b/libs/pbd/stateful.cc @@ -31,6 +31,9 @@ using namespace std; namespace PBD { +int Stateful::current_state_version = 0; +int Stateful::loading_state_version = 0; + Stateful::Stateful () { _extra_xml = 0; diff --git a/libs/surfaces/generic_midi/generic_midi_control_protocol.cc b/libs/surfaces/generic_midi/generic_midi_control_protocol.cc index b3cd5746a6..af82471a90 100644 --- a/libs/surfaces/generic_midi/generic_midi_control_protocol.cc +++ b/libs/surfaces/generic_midi/generic_midi_control_protocol.cc @@ -371,7 +371,7 @@ GenericMidiControlProtocol::set_state (const XMLNode& node, int version) if (c) { MIDIControllable* mc = new MIDIControllable (*_port, *c); - if (mc->set_state (**niter) == 0) { + if (mc->set_state (**niter, version) == 0) { controllables.insert (mc); } diff --git a/libs/surfaces/generic_midi/generic_midi_control_protocol.h b/libs/surfaces/generic_midi/generic_midi_control_protocol.h index 6a81eda021..6473a869ae 100644 --- a/libs/surfaces/generic_midi/generic_midi_control_protocol.h +++ b/libs/surfaces/generic_midi/generic_midi_control_protocol.h @@ -36,7 +36,7 @@ class GenericMidiControlProtocol : public ARDOUR::ControlProtocol { bool get_feedback () const; XMLNode& get_state (); - int set_state (const XMLNode&, int version = 3000); + int set_state (const XMLNode&, int version); private: MIDI::Port* _port; diff --git a/libs/surfaces/generic_midi/midicontrollable.h b/libs/surfaces/generic_midi/midicontrollable.h index b2805744a3..f0b973f0f0 100644 --- a/libs/surfaces/generic_midi/midicontrollable.h +++ b/libs/surfaces/generic_midi/midicontrollable.h @@ -64,7 +64,7 @@ class MIDIControllable : public PBD::Stateful std::string control_description() const { return _control_description; } XMLNode& get_state (void); - int set_state (const XMLNode&, int version = 3000); + int set_state (const XMLNode&, int version); void bind_midi (MIDI::channel_t, MIDI::eventType, MIDI::byte); MIDI::channel_t get_control_channel () { return control_channel; } diff --git a/libs/surfaces/mackie/mackie_control_protocol.h b/libs/surfaces/mackie/mackie_control_protocol.h index 3d1dea1ed4..12aea1c0ae 100644 --- a/libs/surfaces/mackie/mackie_control_protocol.h +++ b/libs/surfaces/mackie/mackie_control_protocol.h @@ -78,7 +78,7 @@ class MackieControlProtocol int set_active (bool yn); XMLNode& get_state (); - int set_state (const XMLNode&, int version = 3000); + int set_state (const XMLNode&, int version); static bool probe(); diff --git a/libs/surfaces/osc/osc.h b/libs/surfaces/osc/osc.h index a814726b4e..d0bc509f17 100644 --- a/libs/surfaces/osc/osc.h +++ b/libs/surfaces/osc/osc.h @@ -49,7 +49,7 @@ class OSC : public ARDOUR::ControlProtocol virtual ~OSC(); XMLNode& get_state (); - int set_state (const XMLNode&, int version = 3000); + int set_state (const XMLNode&, int version); int set_active (bool yn); bool get_active () const; diff --git a/libs/surfaces/osc/osc_controllable.h b/libs/surfaces/osc/osc_controllable.h index b5021aa397..bb80874e5e 100644 --- a/libs/surfaces/osc/osc_controllable.h +++ b/libs/surfaces/osc/osc_controllable.h @@ -44,7 +44,7 @@ class OSCControllable : public PBD::Stateful lo_address address() const { return addr; } XMLNode& get_state (); - int set_state (const XMLNode& node, int version = 3000); + int set_state (const XMLNode& node, int version); protected: boost::shared_ptr controllable; diff --git a/libs/surfaces/powermate/powermate.h b/libs/surfaces/powermate/powermate.h index d03fb1fce4..b8fd2b5789 100644 --- a/libs/surfaces/powermate/powermate.h +++ b/libs/surfaces/powermate/powermate.h @@ -16,7 +16,7 @@ class PowermateControlProtocol : public ARDOUR::ControlProtocol static bool probe (); XMLNode& get_state (); - int set_state (const XMLNode&, int version = 3000); + int set_state (const XMLNode&, int version); private: