Part 1 of loading 2.X sessions; some things work, some things don't, hacks a-plenty.
authorCarl Hetherington <carl@carlh.net>
Thu, 15 Oct 2009 00:57:55 +0000 (00:57 +0000)
committerCarl Hetherington <carl@carlh.net>
Thu, 15 Oct 2009 00:57:55 +0000 (00:57 +0000)
LOADING 2.X SESSIONS WITH THIS COMMIT IN PLACE WILL (PROBABLY) CORRUPT THE .ardour FILE,
MAKING THE SESSION UNLOADABLE ON 2.X AND LOSING INFORMATION.

So don't do that unless you make a backup of the session file first.

git-svn-id: svn://localhost/ardour2/branches/3.0@5786 d708f5d6-7413-0410-9779-e7cbd77b26cf

131 files changed:
gtk2_ardour/ardour_ui.cc
gtk2_ardour/automation_line.cc
gtk2_ardour/automation_line.h
gtk2_ardour/automation_time_axis.cc
gtk2_ardour/automation_time_axis.h
gtk2_ardour/editor.cc
gtk2_ardour/editor.h
gtk2_ardour/keyboard.cc
gtk2_ardour/keyboard.h
gtk2_ardour/opts.cc
gtk2_ardour/opts.h
gtk2_ardour/panner_ui.cc
gtk2_ardour/route_time_axis.cc
gtk2_ardour/route_time_axis.h
gtk2_ardour/time_axis_view.cc
gtk2_ardour/time_axis_view.h
gtk2_ardour/ui_config.cc
gtk2_ardour/ui_config.h
libs/ardour/amp.cc
libs/ardour/ardour/amp.h
libs/ardour/ardour/audio_diskstream.h
libs/ardour/ardour/audio_track.h
libs/ardour/ardour/audiofilesource.h
libs/ardour/ardour/audioplaylist.h
libs/ardour/ardour/audioregion.h
libs/ardour/ardour/audiosource.h
libs/ardour/ardour/automation_list.h
libs/ardour/ardour/configuration.h
libs/ardour/ardour/control_protocol_manager.h
libs/ardour/ardour/crossfade.h
libs/ardour/ardour/delivery.h
libs/ardour/ardour/diskstream.h
libs/ardour/ardour/file_source.h
libs/ardour/ardour/internal_return.h
libs/ardour/ardour/internal_send.h
libs/ardour/ardour/io.h
libs/ardour/ardour/io_processor.h
libs/ardour/ardour/ladspa_plugin.h
libs/ardour/ardour/location.h
libs/ardour/ardour/midi_diskstream.h
libs/ardour/ardour/midi_model.h
libs/ardour/ardour/midi_playlist.h
libs/ardour/ardour/midi_region.h
libs/ardour/ardour/midi_source.h
libs/ardour/ardour/midi_track.h
libs/ardour/ardour/mute_master.h
libs/ardour/ardour/named_selection.h
libs/ardour/ardour/panner.h
libs/ardour/ardour/playlist.h
libs/ardour/ardour/plugin_insert.h
libs/ardour/ardour/port_insert.h
libs/ardour/ardour/processor.h
libs/ardour/ardour/rc_configuration.h
libs/ardour/ardour/region.h
libs/ardour/ardour/return.h
libs/ardour/ardour/route.h
libs/ardour/ardour/route_group.h
libs/ardour/ardour/send.h
libs/ardour/ardour/session.h
libs/ardour/ardour/session_configuration.h
libs/ardour/ardour/session_metadata.h
libs/ardour/ardour/smf_source.h
libs/ardour/ardour/source.h
libs/ardour/ardour/tempo.h
libs/ardour/ardour/track.h
libs/ardour/ardour/user_bundle.h
libs/ardour/audio_diskstream.cc
libs/ardour/audio_playlist.cc
libs/ardour/audio_track.cc
libs/ardour/audio_track_importer.cc
libs/ardour/audiofilesource.cc
libs/ardour/audioregion.cc
libs/ardour/audiosource.cc
libs/ardour/automation_list.cc
libs/ardour/control_protocol_manager.cc
libs/ardour/crossfade.cc
libs/ardour/delivery.cc
libs/ardour/file_source.cc
libs/ardour/internal_return.cc
libs/ardour/internal_send.cc
libs/ardour/io.cc
libs/ardour/io_processor.cc
libs/ardour/ladspa_plugin.cc
libs/ardour/location.cc
libs/ardour/midi_diskstream.cc
libs/ardour/midi_model.cc
libs/ardour/midi_playlist.cc
libs/ardour/midi_region.cc
libs/ardour/midi_source.cc
libs/ardour/midi_track.cc
libs/ardour/mute_master.cc
libs/ardour/named_selection.cc
libs/ardour/panner.cc
libs/ardour/playlist.cc
libs/ardour/plugin_insert.cc
libs/ardour/port_insert.cc
libs/ardour/processor.cc
libs/ardour/rc_configuration.cc
libs/ardour/region.cc
libs/ardour/return.cc
libs/ardour/route.cc
libs/ardour/route_group.cc
libs/ardour/send.cc
libs/ardour/session.cc
libs/ardour/session_command.cc
libs/ardour/session_configuration.cc
libs/ardour/session_metadata.cc
libs/ardour/session_state.cc
libs/ardour/smf_source.cc
libs/ardour/source.cc
libs/ardour/tempo.cc
libs/ardour/track.cc
libs/ardour/user_bundle.cc
libs/midi++2/midi++/midnam_patch.h
libs/midi++2/midnam_patch.cc
libs/pbd/controllable.cc
libs/pbd/pbd/command.h
libs/pbd/pbd/controllable.h
libs/pbd/pbd/stateful.h
libs/surfaces/generic_midi/generic_midi_control_protocol.cc
libs/surfaces/generic_midi/generic_midi_control_protocol.h
libs/surfaces/generic_midi/midicontrollable.cc
libs/surfaces/generic_midi/midicontrollable.h
libs/surfaces/mackie/mackie_control_protocol.cc
libs/surfaces/mackie/mackie_control_protocol.h
libs/surfaces/osc/osc.cc
libs/surfaces/osc/osc.h
libs/surfaces/osc/osc_controllable.cc
libs/surfaces/osc/osc_controllable.h
libs/surfaces/powermate/powermate.cc
libs/surfaces/powermate/powermate.h

index 423f9de14a9fa4bbed2fcd1c2e01c51ca6a3fe0b..875228da9ff032c69773a5c29d8794c6da2206b5 100644 (file)
@@ -2356,6 +2356,10 @@ ARDOUR_UI::get_session_parameters (bool should_be_new)
                } else {
 
                        ret = load_session (session_path, session_name, template_name);
+                       if (!ARDOUR_COMMAND_LINE::immediate_save.empty()) {
+                               session->save_state (ARDOUR_COMMAND_LINE::immediate_save, false);
+                               exit (1);
+                       }
                }
        }
 
index 61687c79dd35f53b31237c728fcbf2c44ba4eb24..73727ca987ad87649a46438f0ae687a833bdd945 100644 (file)
@@ -1260,8 +1260,8 @@ AutomationLine::get_state (void)
        return alist->get_state();
 }
 
-int
-AutomationLine::set_state (const XMLNode &node)
+int 
+AutomationLine::set_state (const XMLNode &node, int version)
 {
        /* function as a proxy for the model */
        return alist->set_state (node);
index a171be15121edcdbd9cc91586819c06bb5424404..817f66c1d2cadb2e992cf2805c53601e9dc4985d 100644 (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 set_state (const XMLNode&, int version = 3000);
        void set_colors();
 
        void modify_point_y (ControlPoint&, double);
index 00bba2ba1b15698756f6e653695f335bdd0f0233..1fffe564fb00249c9971582a8b69cffe111f68b4 100644 (file)
@@ -865,7 +865,7 @@ AutomationTimeAxisView::color_handler ()
 }
 
 int
-AutomationTimeAxisView::set_state (const XMLNode& node)
+AutomationTimeAxisView::set_state (const XMLNode& node, int version)
 {
        TimeAxisView::set_state (node);
 
index f67603423700b4db1da85f2c4b7da255a5fdf805..f6239314abdfde6381f93c50a47ed17fcc048883 100644 (file)
@@ -90,8 +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  set_state (const XMLNode&, int version = 3000);
        guint32 show_at (double y, int& nth, Gtk::VBox *parent);
        void hide ();
 
index a68f51af4933753373a7f85f5b6e19477d2d6430..fec836210c65c4c332f319cd2b38ead7596079ab 100644 (file)
@@ -2226,7 +2226,7 @@ Editor::set_edit_point_preference (EditPoint ep, bool force)
 }
 
 int
-Editor::set_state (const XMLNode& node)
+Editor::set_state (const XMLNode& node, int version)
 {
        const XMLProperty* prop;
        XMLNode* geometry;
index bd092d264005e8169287e64d942625741c61d316..f2779d353c7522d974aa553057d174385b86a2fc 100644 (file)
@@ -180,7 +180,7 @@ class Editor : public PublicEditor
        void redo (uint32_t n = 1);
 
        XMLNode& get_state ();
-       int set_state (const XMLNode& );
+       int set_state (const XMLNode&, int version = 3000);
 
        void set_mouse_mode (Editing::MouseMode, bool force=true);
        void step_mouse_mode (bool next);
index a368b6a8debf0fc74de54c2cede7e81267950bbe..9333f15b5127991c96e99e72c5257e69dbc89c01 100644 (file)
@@ -157,8 +157,8 @@ Keyboard::get_state (void)
        return *node;
 }
 
-int
-Keyboard::set_state (const XMLNode& node)
+int 
+Keyboard::set_state (const XMLNode& node, int version)
 {
        const XMLProperty* prop;
 
index db55b08b5e12cc44ea7206a6124dc1eb02daff1f..9f354f38e38d015f372bff5a365d7da765fabea4 100644 (file)
@@ -40,7 +40,7 @@ class Keyboard : public sigc::trackable, PBD::Stateful
        ~Keyboard ();
 
        XMLNode& get_state (void);
-       int set_state (const XMLNode&);
+       int set_state (const XMLNode&, int version = 3000);
 
        typedef std::vector<uint32_t> State;
        typedef uint32_t ModifierMask;
index 4f702f64869c2ca1095cbe3a4f5237977b717e62..5d95c4e8a96f8eaf2c702279b563418106fff2ec 100644 (file)
@@ -41,6 +41,7 @@ bool ARDOUR_COMMAND_LINE::try_hw_optimization = true;
 string ARDOUR_COMMAND_LINE::keybindings_path = ""; /* empty means use builtin default */
 Glib::ustring ARDOUR_COMMAND_LINE::menus_file = "ardour.menus";
 bool ARDOUR_COMMAND_LINE::finder_invoked_ardour = false;
+string ARDOUR_COMMAND_LINE::immediate_save;
 
 using namespace ARDOUR_COMMAND_LINE;
 
@@ -51,7 +52,7 @@ print_help (const char *execname)
             << _("  -v, --version                    Show version information\n")
             << _("  -h, --help                       Print this message\n")
             << _("  -b, --bindings                   Print all possible keyboard binding names\n")
-            << _("  -c, --name  name                 Use a specific jack client name, default is ardour\n")
+            << _("  -c, --name <name>                Use a specific jack client name, default is ardour\n")
             << _("  -d, --disable-plugins            Disable all plugins in an existing session\n")
             << _("  -n, --show-splash                Show splash screen\n")
             << _("  -m, --menus file                 Use \"file\" for Ardour menus\n")
@@ -61,6 +62,7 @@ print_help (const char *execname)
 #ifdef VST_SUPPORT
             << _("  -V, --novst                      Do not use VST support\n")
 #endif
+            << _("  -E, --save <file>                Load the specified session, save it to <file> and then quit\n")
             << _("  [session-name]                   Name of session to load\n")
             << _("  -C, --curvetest filename         Curve algorithm debugger\n")
             << _("  -k, --keybindings filename       Name of key bindings to load (default is ~/.ardour3/ardour.bindings)\n")
@@ -71,9 +73,8 @@ print_help (const char *execname)
 
 int
 ARDOUR_COMMAND_LINE::parse_opts (int argc, char *argv[])
-
 {
-       const char *optstring = "U:hSbvVnOdc:C:m:N:k:p:";
+       const char *optstring = "U:hSbvVnOdc:C:m:N:k:p:E:";
        const char *execname = strrchr (argv[0], '/');
 
        if (getenv ("ARDOUR_SAE")) {
@@ -99,6 +100,7 @@ ARDOUR_COMMAND_LINE::parse_opts (int argc, char *argv[])
                { "no-hw-optimizations", 0, 0, 'O' },
                { "sync", 0, 0, 'S' },
                { "curvetest", 1, 0, 'C' },
+               { "save", 1, 0, 'E' },
                { 0, 0, 0, 0 }
        };
 
@@ -176,6 +178,10 @@ ARDOUR_COMMAND_LINE::parse_opts (int argc, char *argv[])
                        keybindings_path = optarg;
                        break;
 
+               case 'E':
+                       immediate_save = optarg;
+                       break;
+
                default:
                        return print_help(execname);
                }
@@ -189,7 +195,6 @@ ARDOUR_COMMAND_LINE::parse_opts (int argc, char *argv[])
                session_name = argv[optind++];
        }
 
-
        return 0;
 }
 
index 3b3f08816f051a1c16ed0104425fcb177baed234..826fc53880e616430c79c562fd47070c48b933f5 100644 (file)
@@ -38,6 +38,7 @@ extern bool   use_gtk_theme;
 extern std::string keybindings_path;
 extern Glib::ustring menus_file;
 extern bool   finder_invoked_ardour;
+extern std::string immediate_save;
 
 extern int32_t parse_opts (int argc, char *argv[]);
 
index 8b4830f4849303bc2eeacffb66620e62ec381480..31403220fe503e382274219e0a5890ba4a9ff37f 100644 (file)
@@ -344,7 +344,7 @@ PannerUI::setup_pan ()
        uint32_t const nouts = _panner->nouts();
        uint32_t const npans = _panner->npanners();
 
-       if (int32_t (nouts) == _current_nouts && npans == _current_npans) {
+       if (int32_t (nouts) == _current_nouts && int32_t (npans) == _current_npans) {
                return;
        }
 
index 954841a163e23ce68af6fc505676efa42a3949d1..52eceb2058f4089b6a37f5fa0b37d0d1fb4d4391 100644 (file)
@@ -383,7 +383,7 @@ RouteTimeAxisView::automation_click ()
 }
 
 int
-RouteTimeAxisView::set_state (const XMLNode& node)
+RouteTimeAxisView::set_state (const XMLNode& node, int version)
 {
        TimeAxisView::set_state (node);
 
index 5970c31226bd56ef5661134409430b0446490724..7ca88aefd4a35f38856b9f306cdd2ca5466058aa 100644 (file)
@@ -113,9 +113,9 @@ public:
        void add_underlay (StreamView*, bool update_xml = true);
        void remove_underlay (StreamView*);
        void build_underlay_menu(Gtk::Menu*);
-
-       int set_state (const XMLNode&);
-
+       
+       int set_state (const XMLNode&, int version = 3000);
+       
        /* This is a bit nasty to expose :/ */
        struct RouteAutomationNode {
                Evoral::Parameter                         param;
index 3d747b33d496258f8e815f07b1fdee803704c53d..21c5bd9f1111938372a7daa454b9feaeeb94ae13 100644 (file)
@@ -1001,7 +1001,7 @@ TimeAxisView::get_state ()
 }
 
 int
-TimeAxisView::set_state (const XMLNode& node)
+TimeAxisView::set_state (const XMLNode& node, int version)
 {
        const XMLProperty *prop;
 
index e32913dbb24d4f31c220c4fd96e879fb33faaa86..1597e32a5549761c514838c2e2b1167fc0c1a814 100644 (file)
@@ -93,7 +93,7 @@ class TimeAxisView : public virtual AxisView, public PBD::Stateful
        virtual ~TimeAxisView ();
 
        XMLNode& get_state ();
-       int set_state (const XMLNode&);
+       int set_state (const XMLNode&, int version = 3000);
 
        /** @return index of this TimeAxisView within its parent */
        int order () const { return _order; }
index 0602b07a0e222ffdbd5d111e8649c940a6a231eb..1f1f25f239f9ccf6533a4ad474a43a97868cdeb1 100644 (file)
@@ -221,7 +221,7 @@ UIConfiguration::get_variables (std::string which_node)
 }
 
 int
-UIConfiguration::set_state (const XMLNode& root)
+UIConfiguration::set_state (const XMLNode& root, int version)
 {
        if (root.name() != "Ardour") {
                return -1;
index 4a099fbc8d0ba92be7dd599cd732a0dd47407640..857df3f7e3b70b799f19ec6bcb33d6795eb0bd07 100644 (file)
@@ -80,7 +80,7 @@ class UIConfiguration : public PBD::Stateful
        int save_state ();
        int load_defaults ();
 
-       int set_state (const XMLNode&);
+       int set_state (const XMLNode&, int version = 3000);
        XMLNode& get_state (void);
        XMLNode& get_variables (std::string);
        void set_variables (const XMLNode&);
index 99a6587dcfb85e1998cd5c5ad48497d70e3c42f2..bf3e7cee6854b075988e323ee223bbc2b9b38c54 100644 (file)
@@ -335,7 +335,7 @@ Amp::state (bool full_state)
 }
 
 int
-Amp::set_state (const XMLNode& node)
+Amp::set_state (const XMLNode& node, int version)
 {
        const XMLProperty* prop;
 
index f0a65c4ef5e3be503754274e5127a3844e6fb325..3cd1bf13ddc57aae1f81437edf0fe9eb75631e16 100644 (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 set_state (const XMLNode&, int version = 3000);
 
        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);
index a8072695ffb65d2fe53765c43ee2d02a42d70e74..507b148d8253d69b7263df98c966918d194144e9 100644 (file)
@@ -126,7 +126,7 @@ class AudioDiskstream : public Diskstream
        /* stateful */
 
        XMLNode& get_state(void);
-       int      set_state(const XMLNode& node);
+       int      set_state(const XMLNode& node, int version = 3000);
 
        void monitor_input (bool);
 
index bdbc4b816507534e0d8a429599e4b50da87abbc2..585d1a1e725d7aff096d9c433ae6cb177cfcb13d 100644 (file)
@@ -33,7 +33,7 @@ class AudioTrack : public Track
 {
   public:
        AudioTrack (Session&, std::string name, Route::Flag f = Route::Flag (0), TrackMode m = Normal);
-       AudioTrack (Session&, const XMLNode&);
+       AudioTrack (Session&, const XMLNode&, int);
        ~AudioTrack ();
 
        int set_mode (TrackMode m);
@@ -55,12 +55,12 @@ 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& node);
+       int set_state(const XMLNode&, int version = 3000);
 
   protected:
        XMLNode& state (bool full);
-
-       int _set_state (const XMLNode&, bool call_base);
+       
+       int _set_state (const XMLNode&, int, bool call_base);
 
   private:
        int  set_diskstream (boost::shared_ptr<AudioDiskstream>, void *);
index 4da7943a2dac2f70bcfaea79aab02ac26d5e380f..6b93ced9057f7c0bdf6d4f4c672c5f356ad9455c 100644 (file)
@@ -72,7 +72,7 @@ public:
        int setup_peakfile ();
 
        XMLNode& get_state ();
-       int set_state (const XMLNode&);
+       int set_state (const XMLNode&, int version = 3000);
 
        bool can_truncate_peaks() const { return !destructive(); }
        bool can_be_analysed() const    { return _length > 0; }
index 32fc77f2d655d1c7b35ddf47bf15b94314d3a859..25595def8c466ef5415b11405dadbf04b0c0bfff 100644 (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 set_state (const XMLNode&, int version = 3000);
 
        sigc::signal<void,boost::shared_ptr<Crossfade> > NewCrossfade;
 
index ff718bb4b0b055116bb5755453dc8a9d69ba665b..5e9031c8971f2d8bd71633ec9b48f4462ebfd442 100644 (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      set_state (const XMLNode&, int version = 3000);
 
        static void set_default_fade (float steepness, nframes_t len);
        bool fade_in_is_default () const;
index bc06642c3306dfbf464d405a10d8da5201ec2c23..eebd1dd5d9d437055b1f7477a7916a9157309184 100644 (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 set_state (const XMLNode&, int version = 3000);
 
        int rename_peakfile (Glib::ustring newpath);
        void touch_peakfile ();
index 9b899e8cd1b025982fee03cd7156e33c51fcd6a5..5f074385a30ae4497126a7e3c061911347a3e17e 100644 (file)
@@ -79,8 +79,8 @@ class AutomationList : public PBD::StatefulDestructible, public Evoral::ControlL
        void stop_touch ();
        bool touching() const { return _touching; }
 
-       XMLNode& get_state(void);
-       int set_state (const XMLNode &s);
+       XMLNode& get_state (); 
+       int set_state (const XMLNode &, int version = 3000);
        XMLNode& state (bool full);
        XMLNode& serialize_events ();
 
index d00cadb179763d3eab7840bfde1907a7516087b7..bd164a08e914a9f128451e47fca74400dcc25a3a 100644 (file)
@@ -34,7 +34,7 @@ class Configuration : public PBD::Stateful
        virtual ~Configuration();
 
        virtual void map_parameters (sigc::slot<void, std::string> s) = 0;
-       virtual int set_state (XMLNode const &) = 0;
+       virtual int set_state (XMLNode const &, int) = 0;
        virtual XMLNode & get_state () = 0;
        virtual XMLNode & get_variables () = 0;
        virtual void set_variables (XMLNode const &) = 0;
index bceece9adf47d8a99089ac30f958de9ae49f143a..d1f059dc6263b35b5f25edbc460183972dd9658c 100644 (file)
@@ -70,7 +70,7 @@ struct ControlProtocolInfo {
 
        void set_protocol_states (const XMLNode&);
 
-       int set_state (const XMLNode&);
+       int set_state (const XMLNode&, int version = 3000);
        XMLNode& get_state (void);
 
   private:
index 577bee8257d911f6d8c71816a6d8f37194c853d8..8a7773c0350371579cff1bc6871ca8dccf18701a 100644 (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 set_state (const XMLNode&, int version = 3000);
 
        boost::shared_ptr<ARDOUR::AudioRegion> in() const { return _in; }
        boost::shared_ptr<ARDOUR::AudioRegion> out() const { return _out; }
index 9224d2755c6bb11e5bd2f4785aa2e7f0eee58e58..ef78c9bd45c9d8c0c9319609c7e3d34757ac899d 100644 (file)
@@ -89,7 +89,7 @@ public:
        static sigc::signal<void,nframes_t> CycleStart;
 
        XMLNode& state (bool full);
-       int set_state (const XMLNode&);
+       int set_state (const XMLNode&, int version = 3000);
 
        /* Panning */
 
index 69329139580dc9a85732d25b62bd1dfa25f08668..5427dc644dc4c2cf8d0bd5a89dd0d54f9a17dd40 100644 (file)
@@ -130,8 +130,8 @@ class Diskstream : public SessionObject, public boost::noncopyable
 
        /* Stateful */
        virtual XMLNode& get_state(void) = 0;
-       virtual int      set_state(const XMLNode& node) = 0;
-
+       virtual int      set_state(const XMLNode&, int version = 3000) = 0;
+       
        virtual void monitor_input (bool) {}
 
        nframes_t    capture_offset() const { return _capture_offset; }
index 7844bb513a60208cf9fe928627b1bef31130d0ae..5a9c2a9c56ff4529b3afd82d85f638b209a89bdc 100644 (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 set_state (const XMLNode&, int version = 3000);
 
        int set_source_name (const Glib::ustring& newname, bool destructive);
 
index 4d2839cb120d00ae46407bd8fde57180fb41b5a5..e896200c938d0fa38ce7f15485f9a462d73c614b 100644 (file)
@@ -38,7 +38,7 @@ class InternalReturn : public Return
 
        XMLNode& state(bool full);
        XMLNode& get_state(void);
-       int set_state(const XMLNode& node);
+       int set_state(const XMLNode&, int version = 3000);
 
        void run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes);
        bool configure_io (ChanCount in, ChanCount out);
index ef7d3d3d54ec0ede430f6b950c2e86c7465bae0c..d62be9eafa25f005b2f82cd8da6f01fd4d99b9ca 100644 (file)
@@ -38,8 +38,8 @@ class InternalSend : public Send
 
        XMLNode& state(bool full);
        XMLNode& get_state(void);
-       int set_state(const XMLNode& node);
-
+       int set_state(const XMLNode& node, int version = 3000);
+       
        void run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes);
        bool feeds (boost::shared_ptr<Route> other) const;
        bool can_support_io_configuration (const ChanCount& in, ChanCount& out) const;
index 0be1493dbb4eeaa0162e8159a15a7cbcfda681bd..9a13ced942471f5e9aaf1bda7bde63c604e64dda 100644 (file)
@@ -137,7 +137,8 @@ class IO : public SessionObject, public Latent
 
        virtual XMLNode& state (bool full);
        XMLNode& get_state (void);
-       int set_state (const XMLNode&);
+       int set_state (const XMLNode&, int version = 3000);
+       int set_state_2X (const XMLNode&, int, bool);
 
        static int  disable_connecting (void);
        static int  enable_connecting (void);
@@ -156,6 +157,8 @@ class IO : public SessionObject, public Latent
        static bool              connecting_legal;
 
        XMLNode *pending_state_node;
+       int pending_state_node_version;
+       bool pending_state_node_in;
 
        /* three utility functions - this just seems to be simplest place to put them */
 
@@ -203,9 +206,11 @@ class IO : public SessionObject, public Latent
        void bundle_changed (Bundle::Change);
 
 
-       int get_port_counts (const XMLNode& node, ChanCount& n, boost::shared_ptr<Bundle>& c);
-       int create_ports (const XMLNode&);
-       int make_connections (const XMLNode&);
+       int get_port_counts (const XMLNode& node, int version, ChanCount& n, boost::shared_ptr<Bundle>& c);
+       int get_port_counts_2X (const XMLNode& node, int version, ChanCount& n, boost::shared_ptr<Bundle>& c);
+       int create_ports (const XMLNode&, int version);
+       int make_connections (const XMLNode&, int, bool);
+       int make_connections_2X (const XMLNode &, int, bool);
 
        boost::shared_ptr<Bundle> find_possible_bundle (const std::string &desired_name);
 
index dc376b9a429af1b055b8b0d5225859e534c5f3d8..fdb0429bca1e1258cc36e83a7ee46a54ffacb54a 100644 (file)
@@ -72,8 +72,8 @@ class IOProcessor : public Processor
        sigc::signal<void,IOProcessor*,uint32_t> AutomationChanged;
 
        XMLNode& state (bool full_state);
-       int set_state (const XMLNode&);
-
+       int set_state (const XMLNode&, int version = 3000);
+       
   protected:
        boost::shared_ptr<IO> _input;
        boost::shared_ptr<IO> _output;
index 8128fccf941f6c70236cdb792dd9264ec7623d3a..b08f3e5afadba4a9aa5211d58b753720d8586bc9 100644 (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& node);
+       int      set_state (const XMLNode&, int version = 3000);
        bool     save_preset(std::string name);
 
        bool has_editor() const { return false; }
@@ -133,6 +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);
 };
 
 class LadspaPluginInfo : public PluginInfo {
index 2a583719cce34e6502b9d0ffd7f5605fa948cd74..cbc0782a4ae9cea2935770bff9446e371058fe9a 100644 (file)
@@ -71,7 +71,7 @@ class Location : public PBD::StatefulDestructible
        }
 
        Location (const Location& other);
-       Location (const XMLNode&);
+       Location (const XMLNode&, int version = 3000);
        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 set_state (const XMLNode&, int version = 3000);
 
   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 set_state (const XMLNode&, int version = 3000);
         Location *get_location_by_id(PBD::ID);
 
        Location* auto_loop_location () const;
index 7035cdfd0231a400b3811dfb9b74902349b6cdab..aab752d591db7355a0f985d1fa4765d4cb1a3bb1 100644 (file)
@@ -75,7 +75,7 @@ class MidiDiskstream : public Diskstream
 
        /* stateful */
        XMLNode& get_state(void);
-       int set_state(const XMLNode& node);
+       int set_state(const XMLNode&, int version = 3000);
 
        void monitor_input (bool);
 
index 6ea4a4cd30904b53acbbb15b660078a89d02cc02..a5b0e36b261fae08f0423b4a780935f0a394608e 100644 (file)
@@ -69,8 +69,8 @@ public:
 
                void operator()();
                void undo();
-
-               int set_state (const XMLNode&);
+               
+               int set_state (const XMLNode&, int version = 3000);
                XMLNode& get_state ();
 
                void add(const boost::shared_ptr< Evoral::Note<TimeType> > note);
@@ -113,8 +113,8 @@ public:
 
                void operator()();
                void undo();
-
-               int set_state (const XMLNode&);
+               
+               int set_state (const XMLNode&, int version = 3000);
                XMLNode& get_state ();
 
                void change (const boost::shared_ptr<Evoral::Note<TimeType> > note,
index 11c1288e92d907ebee801e651f02ba298204bb41..dc315edb12f08606362140dae6e4661c9e00810c 100644 (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 set_state (const XMLNode&, int version = 3000);
 
        bool destroy_region (boost::shared_ptr<Region>);
 
index 50fc1516df1d3dc6503ff87458de8068b9f9d5cb..ddb3109ff66af45acca915c4701e3b2a647aabea 100644 (file)
@@ -68,7 +68,7 @@ class MidiRegion : public Region
                        NoteMode  mode = Sustained) const;
 
        XMLNode& state (bool);
-       int      set_state (const XMLNode&);
+       int      set_state (const XMLNode&, int version = 3000);
 
        int separate_by_channel (ARDOUR::Session&, std::vector< boost::shared_ptr<Region> >&) const;
 
index 705674878680d57f08ebd0bcd0f55c63af01c687..8a09aad6c8ec007e10423ada379f24085b49a19c 100644 (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 set_state (const XMLNode&, int version = 3000);
 
        bool length_mutable() const { return true; }
 
index a4054e6b00aac5bc657b14c9daf0a7a90618e6d6..9f19c6590ce3bb36a31b4166324bd03ec4077f70 100644 (file)
@@ -35,7 +35,7 @@ class MidiTrack : public Track
 {
 public:
        MidiTrack (Session&, string name, Route::Flag f = Route::Flag (0), TrackMode m = Normal);
-       MidiTrack (Session&, const XMLNode&);
+       MidiTrack (Session&, const XMLNode&, int);
        ~MidiTrack ();
 
        int roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame,
@@ -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& node);
+       int set_state(const XMLNode&, int version = 3000);
 
        void midi_panic(void);
        bool write_immediate_event(size_t size, const uint8_t* buf);
@@ -92,8 +92,8 @@ public:
 
 protected:
        XMLNode& state (bool full);
-
-       int _set_state (const XMLNode&, bool call_base);
+       
+       int _set_state (const XMLNode&, int, bool call_base);
 
 private:
        void write_out_of_band_data (
index 1b06b4bf7c5baad0196f09e8a5646d4570aff385..39ad9ffd615f1eb19dbdf7fe990ca03296cc007d 100644 (file)
@@ -65,7 +65,7 @@ class MuteMaster : public AutomationControl
        sigc::signal<void> MutePointChanged;
 
        XMLNode& get_state();
-       int set_state(const XMLNode& node);
+       int set_state(const XMLNode&, int version = 3000);
 
   private:
        AutomationList* _automation;
index 2dcfbd131cd5f2c0dd7f52318c216b4f27e8f387..4911dd8c50139b16b657b8eb6dca54bea58c69b3 100644 (file)
@@ -44,7 +44,7 @@ struct NamedSelection : public PBD::Stateful
 
     XMLNode& get_state (void);
 
-    int set_state (const XMLNode&);
+    int set_state (const XMLNode&, int version = 3000);
 
     static sigc::signal<void,NamedSelection*> NamedSelectionCreated;
 };
index c211aafc8c8d82616d111cbef08df9857ceef214..6a435ec235f6ddbd74c405c474bcf6762eff04f0 100644 (file)
@@ -36,7 +36,6 @@
 
 namespace ARDOUR {
 
-class Route;
 class Session;
 class Panner;
 class BufferSet;
@@ -74,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 set_state (const XMLNode&, int version = 3000);
        virtual XMLNode& state (bool full_state) = 0;
 
        Panner & get_parent() { return parent; }
@@ -149,9 +148,9 @@ class EqualPowerStereoPanner : public BaseStereoPanner
        static StreamPanner* factory (Panner&, Evoral::Parameter param);
        static std::string name;
 
-       XMLNode& state (bool full_state);
-       XMLNode& get_state (void);
-       int      set_state (const XMLNode&);
+       XMLNode& state (bool full_state); 
+       XMLNode& get_state (void); 
+       int      set_state (const XMLNode&, int version = 3000);
 
   private:
        void update ();
@@ -172,7 +171,7 @@ class Multi2dPanner : public StreamPanner
 
        XMLNode& state (bool full_state);
        XMLNode& get_state (void);
-       int set_state (const XMLNode&);
+       int set_state (const XMLNode&, int version = 3000);
 
        /* old school automation loading */
 
@@ -229,7 +228,7 @@ public:
 
        XMLNode& get_state (void);
        XMLNode& state (bool full);
-       int      set_state (const XMLNode&);
+       int      set_state (const XMLNode&, int version = 3000);
 
        static bool equivalent (pan_t a, pan_t b) {
                return fabsf (a - b) < 0.002; // about 1 degree of arc for a stereo panner
index 56c755bebb9e1458822fd0a340aea675c52d05c5..01bb12db8d810bcfdd75e02ed1e1b14492a02d5c 100644 (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 set_state (const XMLNode&, int version = 3000);
        XMLNode& get_template ();
 
        sigc::signal<void,bool> InUse;
index 69b4ab1f8f703767d25c3cfec27b7b0412a075a0..82111a5a4df180e661989d9e2e116b27793f87d4 100644 (file)
@@ -45,14 +45,14 @@ class PluginInsert : public Processor
 {
   public:
        PluginInsert (Session&, boost::shared_ptr<Plugin>);
-       PluginInsert (Session&, const XMLNode&);
+       PluginInsert (Session&, const XMLNode&, int version = 3000);
        ~PluginInsert ();
 
        static const std::string port_automation_node_name;
 
        XMLNode& state(bool);
        XMLNode& get_state(void);
-       int set_state(const XMLNode&);
+       int set_state(const XMLNode&, int version = 3000);
 
        void run (BufferSet& in, sframes_t start_frame, sframes_t end_frame, nframes_t nframes);
        void silence (nframes_t nframes);
index 18f54b021621009d022084d334fd06470912524f..73dacf7d6887481dfc5fd167f603b98186b26a24 100644 (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&);
+       PortInsert (Session&, boost::shared_ptr<MuteMaster> mm, const XMLNode&, int version = 3000);
        ~PortInsert ();
 
        XMLNode& state(bool full);
        XMLNode& get_state(void);
-       int set_state(const XMLNode&);
+       int set_state (const XMLNode&, int version = 3000);
 
        void run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes);
 
index 21b7966fbad79b258e5d834d63c4e5d8758279c1..1e78777eddfb2dbc3d6fa07574b5cdc937ca4f9a 100644 (file)
@@ -91,8 +91,8 @@ class Processor : public SessionObject, public AutomatableControls, public Laten
 
        virtual XMLNode& state (bool full);
        XMLNode& get_state (void);
-       int set_state (const XMLNode&);
-
+       int set_state (const XMLNode&, int version = 3000);
+       
        void *get_gui () const { return _gui; }
        void  set_gui (void *p) { _gui = p; }
 
@@ -109,6 +109,9 @@ protected:
        ChanCount _configured_input;
        ChanCount _configured_output;
        void*     _gui;  /* generic, we don't know or care what this is */
+
+private:
+       int set_state_2X (const XMLNode&, int version);
 };
 
 } // namespace ARDOUR
index d12a9c63e7224c9932026456f2aac415fb08f81c..d0dc042bb16a7b0b1962dad9ac8b10a7cc812d92 100644 (file)
@@ -37,7 +37,7 @@ class RCConfiguration : public Configuration
        RCConfiguration();
 
        void map_parameters (sigc::slot<void, std::string>);
-       int set_state (XMLNode const &);
+       int set_state (XMLNode const &, int version = 3000);
        XMLNode& get_state ();
        XMLNode& get_variables ();
        void set_variables (XMLNode const &);
index dab4f5df6fa25ab6842a90bf42dc45fc8f5987be..d3414892495dac084f30498b3590b02642d24849 100644 (file)
@@ -241,7 +241,7 @@ class Region
 
        XMLNode&         get_state ();
        virtual XMLNode& state (bool);
-       virtual int      set_state (const XMLNode&);
+       virtual int      set_state (const XMLNode&, int version = 3000);
        virtual int      set_live_state (const XMLNode&, Change&, bool send);
 
        virtual boost::shared_ptr<Region> get_parent() const;
index 1a33795a37aae402bf865c32e4a85094bd3c4b36..3232e932955370d4ed6f7fcb955cb2105700dc78 100644 (file)
@@ -54,7 +54,7 @@ public:
 
        XMLNode& state(bool full);
        XMLNode& get_state(void);
-       int      set_state(const XMLNode& node);
+       int      set_state(const XMLNode&, int version = 3000);
 
        uint32_t pans_required() const { return _configured_input.n_audio(); }
 
index 1ecdb5148886bcd7f82f5183d3544aee175aa018..ac3c6f89f3fff4a410034ff8e25927b64acfe13a 100644 (file)
@@ -68,7 +68,7 @@ class Route : public SessionObject, public AutomatableControls
 
        Route (Session&, std::string name, Flag flags = Flag(0),
               DataType default_type = DataType::AUDIO);
-       Route (Session&, const XMLNode&, DataType default_type = DataType::AUDIO);
+       Route (Session&, const XMLNode&, int, DataType default_type = DataType::AUDIO);
        virtual ~Route();
 
        boost::shared_ptr<IO> input() const { return _input; }
@@ -251,7 +251,7 @@ class Route : public SessionObject, public AutomatableControls
        /* stateful */
 
        XMLNode& get_state();
-       int set_state(const XMLNode& node);
+       int set_state (const XMLNode&, int version = 3000);
        virtual XMLNode& get_template();
 
        XMLNode& get_processor_state ();
@@ -384,8 +384,8 @@ class Route : public SessionObject, public AutomatableControls
 
        uint32_t pans_required() const;
        ChanCount n_process_buffers ();
-
-       virtual int  _set_state (const XMLNode&, bool call_base);
+       
+       virtual int  _set_state (const XMLNode&, int, bool call_base);
 
        boost::shared_ptr<Amp>       _amp;
        boost::shared_ptr<PeakMeter> _meter;
@@ -393,6 +393,8 @@ class Route : public SessionObject, public AutomatableControls
 
   private:
        void init ();
+       int _set_state_2X (const XMLNode&, int);
+       void set_processor_state_2X (XMLNodeList const &, int);
 
        static uint32_t order_key_cnt;
 
@@ -407,7 +409,8 @@ class Route : public SessionObject, public AutomatableControls
        int configure_processors (ProcessorStreams*);
        int configure_processors_unlocked (ProcessorStreams*);
 
-       bool add_processor_from_xml (const XMLNode&, ProcessorList::iterator iter);
+       bool add_processor_from_xml (const XMLNode&, ProcessorList::iterator iter);     
+       bool add_processor_from_xml_2X (const XMLNode&, int, ProcessorList::iterator iter);     
 
        void placement_range (Placement p, ProcessorList::iterator& start, ProcessorList::iterator& end);
 };
index 194aa84582a88c202ed33ad961c86fb92fd5285b..124f3c9b3f04806ff5bcc3ad355a94ed7ff69f24 100644 (file)
@@ -130,9 +130,9 @@ public:
        sigc::signal<void,void*> FlagsChanged;
 
        XMLNode& get_state ();
-
-       int set_state (const XMLNode&);
-
+       
+       int set_state (const XMLNode&, int version = 3000);
+       
 private:
        Session& _session;
        std::list<Route *> routes;
@@ -142,6 +142,7 @@ private:
        Property _properties;
 
        void remove_when_going_away (Route*);
+       int set_state_2X (const XMLNode&, int);
 };
 
 } /* namespace */
index 6b872df9fe0d65657560be02a2253a1fca4e3f71..13b7adbbf2ba8fe35673e9f135fda2fb2eb8858f 100644 (file)
@@ -38,7 +38,7 @@ class Send : public Delivery
 {
   public:
        Send (Session&, boost::shared_ptr<MuteMaster>, Delivery::Role r = Delivery::Send);
-       Send (Session&, boost::shared_ptr<MuteMaster>, const XMLNode&, Delivery::Role r = Delivery::Send);
+       Send (Session&, boost::shared_ptr<MuteMaster>, const XMLNode&, int version = 3000, Delivery::Role r = Delivery::Send);
        virtual ~Send ();
 
        uint32_t bit_slot() const { return _bitslot; }
@@ -53,7 +53,7 @@ class Send : public Delivery
 
        XMLNode& state(bool full);
        XMLNode& get_state(void);
-       int set_state(const XMLNode& node);
+       int set_state(const XMLNode&, int version = 3000);
 
        uint32_t pans_required() const { return _configured_input.n_audio(); }
 
index 5055ebc7098a633c6e25e8b6826a0ddf5000e977..c5b793730c6e8777dc7aaaaada38677212f075e0 100644 (file)
@@ -305,7 +305,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
 
        typedef std::list<boost::shared_ptr<Diskstream> > DiskstreamList;
 
-       int load_routes (const XMLNode&);
+       int load_routes (const XMLNode&, int);
        boost::shared_ptr<RouteList> get_routes() const {
                return routes.reader ();
        }
@@ -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); // not idempotent
+       int      set_state(const XMLNode& node, int version = 3000); // 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 set_state (const XMLNode&, int version = 3000);
                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 set_state (const XMLNode&, int version = 3000);
                void mark();
 
        protected:
@@ -1439,7 +1439,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
 
        /* edit/mix groups */
 
-       int load_route_groups (const XMLNode&);
+       int load_route_groups (const XMLNode&, int);
 
        std::list<RouteGroup *> _route_groups;
 
@@ -1458,7 +1458,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
        void add_routes (RouteList&, bool save);
        uint32_t destructive_index;
 
-       boost::shared_ptr<Route> XMLRouteFactory (const XMLNode&);
+       boost::shared_ptr<Route> XMLRouteFactory (const XMLNode&, int);
 
        /* mixer stuff */
 
index fc7af8c4502d54f78b34045b9c3b4bbbe697f5e1..20e14f37d55c5907d898e884db90e70721ec12a4 100644 (file)
@@ -30,7 +30,7 @@ public:
        SessionConfiguration ();
 
        void map_parameters (sigc::slot<void, std::string>);
-       int set_state (XMLNode const &);
+       int set_state (XMLNode const &, int version = 3000);
        XMLNode& get_state ();
        XMLNode& get_variables ();
        void set_variables (XMLNode const &);
index cfa1fb6f29187fb0c4d6481ab431e3f4d789c9fd..7813788e55f251869d170485ecefda8cfdd01325 100644 (file)
@@ -107,7 +107,7 @@ class SessionMetadata : public PBD::StatefulDestructible
 
        /*** Serialization ***/
        XMLNode & get_state ();
-       int set_state (const XMLNode &);
+       int set_state (const XMLNode &, int version = 3000);
 
   private:
 
index 993a340a7010040a4c2d6a343d90b20cb4f67d40..3c6364532a6f368343b400ca69aeb18f667aea06 100644 (file)
@@ -58,7 +58,7 @@ public:
        void mark_streaming_write_completed ();
 
        XMLNode& get_state ();
-       int set_state (const XMLNode&);
+       int set_state (const XMLNode&, int version = 3000);
 
        void load_model (bool lock=true, bool force_reload=false);
        void destroy_model ();
index ae581f760d9354d09fe547e99fdc8a65cda6b0b9..c34c5a91582ac161ba6d8be6b7c386d1359f681f 100644 (file)
@@ -76,8 +76,8 @@ class Source : public SessionObject, public boost::noncopyable
        virtual void session_saved() {}
 
        XMLNode& get_state ();
-       int set_state (const XMLNode&);
-
+       int set_state (const XMLNode&, int version = 3000);
+       
        bool         destructive() const       { return (_flags & Destructive); }
        bool         writable () const         { return (_flags & Writable); }
        virtual bool set_destructive (bool /*yn*/) { return false; }
index 69b7198408ee63596f3148a4f4acd89fe3404d6b..742919c77af98f5134f23f765e90d875fb9703fd 100644 (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 set_state (const XMLNode&, int version = 3000);
 
        void dump (std::ostream&) const;
        void clear ();
index 1b191a1d3e9bde90672ea8a4a582e72ae164d623..74cbe399df4729710d948de03e44d9fb9d8c2d26 100644 (file)
@@ -82,7 +82,7 @@ class Track : public Route
 
        XMLNode&    get_state();
        XMLNode&    get_template();
-       virtual int set_state(const XMLNode& node) = 0;
+       virtual int set_state (const XMLNode&, int version = 3000) = 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, DataType default_type = DataType::AUDIO);
+       Track (Session& sess, const XMLNode& node, int, DataType default_type = DataType::AUDIO);
 
        virtual XMLNode& state (bool full) = 0;
 
index fa37392fc0fe769938d882aedc09810affbd162b..f590ec1ebef4182d27896f7ea115daa72b35849a 100644 (file)
@@ -38,7 +38,7 @@ class UserBundle : public Bundle, public PBD::Stateful {
        XMLNode& get_state ();
 
   private:
-       int set_state (XMLNode const &);
+       int set_state (XMLNode const &, int version = 3000);
 };
 
 }
index 55664eb352fe4cc2ba4627791271ce309f4f38b1..bb0b715f3b5a79321c8c065083c319e522af307e 100644 (file)
@@ -1909,7 +1909,7 @@ AudioDiskstream::get_state ()
 }
 
 int
-AudioDiskstream::set_state (const XMLNode& node)
+AudioDiskstream::set_state (const XMLNode& node, int version)
 {
        const XMLProperty* prop;
        XMLNodeList nlist = node.children();
index a140d19da1f6585ee606e612b392077af354aedd..812aa8783ba301f22989ae9da79d7d29da3af484 100644 (file)
@@ -558,7 +558,7 @@ AudioPlaylist::crossfade_invalidated (boost::shared_ptr<Region> r)
 }
 
 int
-AudioPlaylist::set_state (const XMLNode& node)
+AudioPlaylist::set_state (const XMLNode& node, int version)
 {
        XMLNode *child;
        XMLNodeList nlist;
index 1d4412b950319d53d6db8b52fa17d23d1bdf663c..600cad6aa2898d4fd982c658f4ffb1e6641fe770 100644 (file)
@@ -56,10 +56,10 @@ AudioTrack::AudioTrack (Session& sess, string name, Route::Flag flag, TrackMode
        use_new_diskstream ();
 }
 
-AudioTrack::AudioTrack (Session& sess, const XMLNode& node)
-       : Track (sess, node)
+AudioTrack::AudioTrack (Session& sess, const XMLNode& node, int version)
+       : Track (sess, node, version)
 {
-       _set_state (node, false);
+       _set_state (node, version, false);
 }
 
 AudioTrack::~AudioTrack ()
@@ -233,19 +233,19 @@ AudioTrack::audio_diskstream() const
 }
 
 int
-AudioTrack::set_state (const XMLNode& node)
+AudioTrack::set_state (const XMLNode& node, int version)
 {
-       return _set_state (node, true);
+       return _set_state (node, version, true);
 }
 
 int
-AudioTrack::_set_state (const XMLNode& node, bool call_base)
+AudioTrack::_set_state (const XMLNode& node, int version, bool call_base)
 {
        const XMLProperty *prop;
        XMLNodeConstIterator iter;
 
        if (call_base) {
-               if (Route::_set_state (node, call_base)) {
+               if (Route::_set_state (node, version, call_base)) {
                        return -1;
                }
        }
index 364d681217a2dd4eb94952c3bdf2d5ea2dd51ccd..146722b3c0bdc398891e47325047674dda20add1 100644 (file)
@@ -290,7 +290,7 @@ AudioTrackImporter::_move ()
 
        XMLNode routes ("Routes");
        routes.add_child_copy (xml_track);
-       session.load_routes (routes);
+       session.load_routes (routes, 3000);
 }
 
 bool
index 0412ee09665360ed5c86f9625241b51b481b7ece..5430d300fbfd281e989137359ecc03a68568e8e1 100644 (file)
@@ -258,7 +258,7 @@ AudioFileSource::get_state ()
 }
 
 int
-AudioFileSource::set_state (const XMLNode& node)
+AudioFileSource::set_state (const XMLNode& node, int version)
 {
        if (Source::set_state (node)) {
                return -1;
index 38fede7c51e22e1dd795e7c539d7662778a6aaf4..47dfc6c902ecc2afb797816f470c7e40dc38bb44 100644 (file)
@@ -751,7 +751,7 @@ AudioRegion::set_live_state (const XMLNode& node, Change& what_changed, bool sen
 }
 
 int
-AudioRegion::set_state (const XMLNode& node)
+AudioRegion::set_state (const XMLNode& node, int version)
 {
        /* Region::set_state() calls the virtual set_live_state(),
           which will get us back to AudioRegion::set_live_state()
index f9864d69b3e77f42673b5f2ef00837bd5fa07db4..d50ad0c6b7794148eba53d68aa63e3f6f4d218e8 100644 (file)
@@ -118,7 +118,7 @@ AudioSource::get_state ()
 }
 
 int
-AudioSource::set_state (const XMLNode& node)
+AudioSource::set_state (const XMLNode& node, int version)
 {
        const XMLProperty* prop;
 
index 2f06f267c1647abad2c9920bdf298bd7fd06a167..be3c38f29b232b5bedc792d613e7db798e5f5566 100644 (file)
@@ -352,7 +352,7 @@ AutomationList::deserialize_events (const XMLNode& node)
 }
 
 int
-AutomationList::set_state (const XMLNode& node)
+AutomationList::set_state (const XMLNode& node, int version)
 {
        XMLNodeList nlist = node.children();
        XMLNode* nsos;
index 18e6534c8488dfe70f0ab9ed16533a1a16ed8071..8546a41e6652cfda426bd1a10c24dcd32f3bcbaa 100644 (file)
@@ -288,7 +288,7 @@ ControlProtocolManager::cpi_by_name (string name)
 }
 
 int
-ControlProtocolManager::set_state (const XMLNode& node)
+ControlProtocolManager::set_state (const XMLNode& node, int version)
 {
        XMLNodeList clist;
        XMLNodeConstIterator citer;
index f12b32228d558bd9a4051092db094c22fa7fdcad..65ad1e25fbbe4d008aaf8f893737bf98f535aa21 100644 (file)
@@ -720,7 +720,7 @@ Crossfade::get_state ()
 }
 
 int
-Crossfade::set_state (const XMLNode& node)
+Crossfade::set_state (const XMLNode& node, int version)
 {
        XMLNodeConstIterator i;
        XMLNodeList children;
index b132a48960b1ad3771aef3d2589ae9c6fd55faed..5f264c5b7ee1d3bd8fd70cab6c243e2ee90f43c1 100644 (file)
@@ -372,7 +372,7 @@ Delivery::state (bool full_state)
 }
 
 int
-Delivery::set_state (const XMLNode& node)
+Delivery::set_state (const XMLNode& node, int version)
 {
        const XMLProperty* prop;
 
index f5b06ee046bfeb516f716e43034de40e853d309d..22e9061d9c6d9652a1d8a53ce94941f17e33ae6d 100644 (file)
@@ -104,7 +104,7 @@ FileSource::init (const ustring& pathstr, bool must_exist)
 }
 
 int
-FileSource::set_state (const XMLNode& node)
+FileSource::set_state (const XMLNode& node, int version)
 {
        const XMLProperty* prop;
 
index b9efaf9a188ad36a280ce25c76c5b936c3629a91..9f828ab47ba1813ba5b369e2a421f74a94a7c810 100644 (file)
@@ -131,7 +131,7 @@ InternalReturn::get_state()
 }
 
 int
-InternalReturn::set_state (const XMLNode& node)
+InternalReturn::set_state (const XMLNode& node, int version)
 {
        return Return::set_state (node);
 }
index 7d1f316c78f9a292031ed0390f78024a55d1b541..abc6ced05cd2995c1d2249780f76296c0c1ff3bc 100644 (file)
@@ -171,7 +171,7 @@ InternalSend::get_state()
 }
 
 int
-InternalSend::set_state (const XMLNode& node)
+InternalSend::set_state (const XMLNode& node, int version)
 {
        const XMLProperty* prop;
 
index 9811cfed3a04c9dcb84d397df2bb6e5790d717e7..f49692a910b9fd4e1449d87fdd1841d8db5d3482 100644 (file)
@@ -515,8 +515,14 @@ IO::state (bool /*full_state*/)
 }
 
 int
-IO::set_state (const XMLNode& node)
+IO::set_state (const XMLNode& node, int version)
 {
+       /* callers for version < 3000 need to call set_state_2X directly, as A3 IOs
+        * are input OR output, not both, so the direction needs to be specified
+        * by the caller.
+        */
+       assert (version >= 3000);
+       
        const XMLProperty* prop;
        XMLNodeConstIterator iter;
        LocaleGuard lg (X_("POSIX"));
@@ -547,19 +553,21 @@ IO::set_state (const XMLNode& node)
                _direction = (Direction) string_2_enum (prop->value(), _direction);
        }
 
-       if (create_ports (node)) {
+       if (create_ports (node, version)) {
                return -1;
        }
 
        if (connecting_legal) {
 
-               if (make_connections (node)) {
+               if (make_connections (node, version, false)) {
                        return -1;
                }
 
        } else {
 
                pending_state_node = new XMLNode (node);
+               pending_state_node_version = version;
+               pending_state_node_in = false;
                connection_legal_c = ConnectingLegal.connect (mem_fun (*this, &IO::connecting_became_legal));
        }
 
@@ -567,6 +575,58 @@ IO::set_state (const XMLNode& node)
        return 0;
 }
 
+int
+IO::set_state_2X (const XMLNode& node, int version, bool in)
+{
+       const XMLProperty* prop;
+       XMLNodeConstIterator iter;
+       LocaleGuard lg (X_("POSIX"));
+
+       /* force use of non-localized representation of decimal point,
+          since we use it a lot in XML files and so forth.
+       */
+
+       if (node.name() != state_node_name) {
+               error << string_compose(_("incorrect XML node \"%1\" passed to IO object"), node.name()) << endmsg;
+               return -1;
+       }
+       
+       if ((prop = node.property ("name")) != 0) {
+               set_name (prop->value());
+       }
+
+       if ((prop = node.property (X_("default-type"))) != 0) {
+               _default_type = DataType(prop->value());
+               assert(_default_type != DataType::NIL);
+       }
+
+       if ((prop = node.property ("id")) != 0) {
+               _id = prop->value ();
+       }
+
+       _direction = in ? Input : Output;
+
+       if (create_ports (node, version)) {
+               return -1;
+       }
+
+       if (connecting_legal) {
+               
+               if (make_connections_2X (node, version, in)) {
+                       return -1;
+               }
+
+       } else {
+
+               pending_state_node = new XMLNode (node);
+               pending_state_node_version = version;
+               pending_state_node_in = in;
+               connection_legal_c = ConnectingLegal.connect (mem_fun (*this, &IO::connecting_became_legal));
+       }
+
+       return 0;
+}
+
 int
 IO::connecting_became_legal ()
 {
@@ -576,7 +636,7 @@ IO::connecting_became_legal ()
 
        connection_legal_c.disconnect ();
 
-       ret = make_connections (*pending_state_node);
+       ret = make_connections (*pending_state_node, pending_state_node_version, pending_state_node_in);
 
        delete pending_state_node;
        pending_state_node = 0;
@@ -679,8 +739,36 @@ IO::find_possible_bundle (const string &desired_name)
 }
 
 int
-IO::get_port_counts (const XMLNode& node, ChanCount& n, boost::shared_ptr<Bundle>& c)
+IO::get_port_counts_2X (XMLNode const & node, int version, ChanCount& n, boost::shared_ptr<Bundle>& c)
+{
+       XMLProperty const * prop;
+       XMLNodeList children = node.children ();
+
+       uint32_t n_audio = 0;
+       
+       for (XMLNodeIterator i = children.begin(); i != children.end(); ++i) {
+
+               if ((prop = node.property ("inputs")) != 0 && _direction == Input) {
+                       n_audio = count (prop->value().begin(), prop->value().end(), '{');
+               } else if ((prop = node.property ("outputs")) != 0 && _direction == Output) {
+                       n_audio = count (prop->value().begin(), prop->value().end(), '{');
+               }
+       }
+
+       ChanCount cnt;
+       cnt.set_audio (n_audio);
+       n = ChanCount::max (n, cnt);
+
+       return 0;
+}
+
+int
+IO::get_port_counts (const XMLNode& node, int version, ChanCount& n, boost::shared_ptr<Bundle>& c)
 {
+       if (version < 3000) {
+               return get_port_counts_2X (node, version, n, c);
+       }
+       
        XMLProperty const * prop;
        XMLNodeConstIterator iter;
        uint32_t n_audio = 0;
@@ -728,13 +816,13 @@ IO::get_port_counts (const XMLNode& node, ChanCount& n, boost::shared_ptr<Bundle
 }
 
 int
-IO::create_ports (const XMLNode& node)
+IO::create_ports (const XMLNode& node, int version)
 {
        ChanCount n;
        boost::shared_ptr<Bundle> c;
-
-       get_port_counts (node, n, c);
-
+       
+       get_port_counts (node, version, n, c);
+       
        if (ensure_ports (n, true, true, this)) {
                error << string_compose(_("%1: cannot create I/O ports"), _name) << endmsg;
                return -1;
@@ -746,8 +834,12 @@ IO::create_ports (const XMLNode& node)
 }
 
 int
-IO::make_connections (const XMLNode& node)
+IO::make_connections (const XMLNode& node, int version, bool in)
 {
+       if (version < 3000) {
+               return make_connections_2X (node, version, in);
+       }
+                       
        const XMLProperty* prop;
 
        for (XMLNodeConstIterator i = node.children().begin(); i != node.children().end(); ++i) {
@@ -798,6 +890,101 @@ IO::make_connections (const XMLNode& node)
        return 0;
 }
 
+
+int
+IO::make_connections_2X (const XMLNode& node, int version, bool in)
+{
+       const XMLProperty* prop;
+
+       /* XXX: bundles ("connections" as was) */
+       
+       if ((prop = node.property ("inputs")) != 0 && in) {
+
+               string::size_type ostart = 0;
+               string::size_type start = 0;
+               string::size_type end = 0;
+               int i = 0;
+               int n;
+               vector<string> ports;
+
+               string const str = prop->value ();
+               
+               while ((start = str.find_first_of ('{', ostart)) != string::npos) {
+                       start += 1;
+                       
+                       if ((end = str.find_first_of ('}', start)) == string::npos) {
+                               error << string_compose(_("IO: badly formed string in XML node for inputs \"%1\""), str) << endmsg;
+                               return -1;
+                       }
+                       
+                       if ((n = parse_io_string (str.substr (start, end - start), ports)) < 0) {
+                               error << string_compose(_("bad input string in XML node \"%1\""), str) << endmsg;
+                               
+                               return -1;
+                               
+                       } else if (n > 0) {
+
+
+                               for (int x = 0; x < n; ++x) {
+                                       /* XXX: this is a bit of a hack; need to check if it's always valid */
+                                       string::size_type const p = ports[x].find ("/out");
+                                       if (p != string::npos) {
+                                               ports[x].replace (p, 4, "/audio_out");
+                                       }
+                                       nth(i)->connect (ports[x]);
+                               }
+                       }
+                       
+                       ostart = end+1;
+                       i++;
+               }
+
+       }
+
+       if ((prop = node.property ("outputs")) != 0 && !in) {
+
+               string::size_type ostart = 0;
+               string::size_type start = 0;
+               string::size_type end = 0;
+               int i = 0;
+               int n;
+               vector<string> ports;
+       
+               string const str = prop->value ();
+               
+               while ((start = str.find_first_of ('{', ostart)) != string::npos) {
+                       start += 1;
+                       
+                       if ((end = str.find_first_of ('}', start)) == string::npos) {
+                               error << string_compose(_("IO: badly formed string in XML node for outputs \"%1\""), str) << endmsg;
+                               return -1;
+                       }
+                       
+                       if ((n = parse_io_string (str.substr (start, end - start), ports)) < 0) {
+                               error << string_compose(_("IO: bad output string in XML node \"%1\""), str) << endmsg;
+                               
+                               return -1;
+                               
+                       } else if (n > 0) {
+                               
+                               for (int x = 0; x < n; ++x) {
+                                       /* XXX: this is a bit of a hack; need to check if it's always valid */
+                                       string::size_type const p = ports[x].find ("/in");
+                                       if (p != string::npos) {
+                                               ports[x].replace (p, 3, "/audio_in");
+                                       }
+                                       nth(i)->connect (ports[x]);
+                               }
+                       }
+                       
+                       ostart = end+1;
+                       i++;
+               }
+       }
+
+       return 0;
+}
+
 int
 IO::set_ports (const string& str)
 {
index af07f7242a9c4b3c08fa6c789d67360c4ba43f87..2f42c724bf2716d0f2089e7bb063ac7a632a6917 100644 (file)
@@ -147,7 +147,7 @@ IOProcessor::state (bool full_state)
 }
 
 int
-IOProcessor::set_state (const XMLNode& node)
+IOProcessor::set_state (const XMLNode& node, int version)
 {
        const XMLProperty *prop;
        const XMLNode *io_node = 0;
index 70a8390de1a4126a3f2c5df5cdabb925baadb6bb..6e2acfbe096d066f89499fc9713d8e1c51bda39f 100644 (file)
@@ -378,8 +378,12 @@ LadspaPlugin::save_preset (string name)
 }
 
 int
-LadspaPlugin::set_state(const XMLNode& node)
+LadspaPlugin::set_state (const XMLNode& node, int version)
 {
+       if (version < 3000) {
+               return set_state_2X (node, version);
+       }
+       
        XMLNodeList nodes;
        XMLProperty *prop;
        XMLNodeConstIterator iter;
@@ -389,6 +393,9 @@ LadspaPlugin::set_state(const XMLNode& node)
        uint32_t port_id;
        LocaleGuard lg (X_("POSIX"));
 
+       cout << "LADSPA Plugin set state " << version << "\n";
+       cout << "- node " << node.name() << "\n";
+
        if (node.name() != state_node_name()) {
                error << _("Bad node sent to LadspaPlugin::set_state") << endmsg;
                return -1;
@@ -422,6 +429,54 @@ LadspaPlugin::set_state(const XMLNode& node)
        return 0;
 }
 
+int
+LadspaPlugin::set_state_2X (const XMLNode& node, int version)
+{
+       XMLNodeList nodes;
+       XMLProperty *prop;
+       XMLNodeConstIterator iter;
+       XMLNode *child;
+       const char *port;
+       const char *data;
+       uint32_t port_id;
+       LocaleGuard lg (X_("POSIX"));
+
+       cout << "LADSPA Plugin set state " << version << "\n";
+       cout << "- node " << node.name() << "\n";
+
+       if (node.name() != state_node_name()) {
+               error << _("Bad node sent to LadspaPlugin::set_state") << endmsg;
+               return -1;
+       }
+
+       nodes = node.children ("port");
+
+       for(iter = nodes.begin(); iter != nodes.end(); ++iter){
+
+               child = *iter;
+
+               if ((prop = child->property("number")) != 0) {
+                       port = prop->value().c_str();
+               } else {
+                       warning << _("LADSPA: no ladspa port number") << endmsg;
+                       continue;
+               }
+               if ((prop = child->property("value")) != 0) {
+                       data = prop->value().c_str();
+               } else {
+                       warning << _("LADSPA: no ladspa port data") << endmsg;
+                       continue;
+               }
+
+               sscanf (port, "%" PRIu32, &port_id);
+               set_parameter (port_id, atof(data));
+       }
+
+       latency_compute_run ();
+
+       return 0;
+}
+
 int
 LadspaPlugin::get_parameter_descriptor (uint32_t which, ParameterDescriptor& desc) const
 {
index 4db398e5347df90e31a0e377f00f0b020d14e57b..5fb0442eba118033fa729ebd30b53215a1220388 100644 (file)
@@ -59,7 +59,7 @@ Location::Location (const Location& other)
        _locked = false;
 }
 
-Location::Location (const XMLNode& node)
+Location::Location (const XMLNode& node, int version)
 {
        if (set_state (node)) {
                throw failed_constructor ();
@@ -347,7 +347,7 @@ Location::get_state (void)
 }
 
 int
-Location::set_state (const XMLNode& node)
+Location::set_state (const XMLNode& node, int version)
 {
        const XMLProperty *prop;
 
@@ -674,7 +674,7 @@ Locations::get_state ()
 }
 
 int
-Locations::set_state (const XMLNode& node)
+Locations::set_state (const XMLNode& node, int version)
 {
        XMLNodeList nlist;
        XMLNodeConstIterator niter;
index dd221e103b9954e5dfac0b1532cc4292983c43e3..4cae90007456aedb6a72265f78f30e56526893fd 100644 (file)
@@ -1381,7 +1381,7 @@ MidiDiskstream::get_state ()
 }
 
 int
-MidiDiskstream::set_state (const XMLNode& node)
+MidiDiskstream::set_state (const XMLNode& node, int version)
 {
        const XMLProperty* prop;
        XMLNodeList nlist = node.children();
index fb09cda60f865c33b9ef7af63882c4bc792c8974..df34d13a244d3de9c509e2f28c89389794bf35e3 100644 (file)
@@ -260,7 +260,7 @@ MidiModel::DeltaCommand::unmarshal_note(XMLNode *xml_note)
 #define DELTA_COMMAND_ELEMENT "DeltaCommand"
 
 int
-MidiModel::DeltaCommand::set_state(const XMLNode& delta_command)
+MidiModel::DeltaCommand::set_state (const XMLNode& delta_command, int version)
 {
        if (delta_command.name() != string(DELTA_COMMAND_ELEMENT)) {
                return 1;
@@ -646,7 +646,7 @@ MidiModel::DiffCommand::unmarshal_change(XMLNode *xml_change)
 }
 
 int
-MidiModel::DiffCommand::set_state(const XMLNode& diff_command)
+MidiModel::DiffCommand::set_state(const XMLNode& diff_command, int version)
 {
        if (diff_command.name() != string(DIFF_COMMAND_ELEMENT)) {
                return 1;
index cc72a630bad96ec6070794fb503a307554938a76..b0fd5de24eabddbcafefbe8fc73d5734465bade6 100644 (file)
@@ -187,7 +187,7 @@ MidiPlaylist::check_dependents (boost::shared_ptr<Region> /*r*/, bool /*norefres
 
 
 int
-MidiPlaylist::set_state (const XMLNode& node)
+MidiPlaylist::set_state (const XMLNode& node, int version)
 {
        in_set_state++;
        freeze ();
index 87c7d656e711b3828a473570b883c6225708c468..f22a1994bf65c70b2fcabc2f1b905d93c5ddec86 100644 (file)
@@ -285,7 +285,7 @@ MidiRegion::set_live_state (const XMLNode& node, Change& what_changed, bool send
 }
 
 int
-MidiRegion::set_state (const XMLNode& node)
+MidiRegion::set_state (const XMLNode& node, int version)
 {
        /* Region::set_state() calls the virtual set_live_state(),
           which will get us back to AudioRegion::set_live_state()
index f92d6a2a4fe784c17e39a3bc18b16417eace367f..e90e90aa320e4f10cbd738a46a45a8624d043a66 100644 (file)
@@ -94,7 +94,7 @@ MidiSource::get_state ()
 }
 
 int
-MidiSource::set_state (const XMLNode& node)
+MidiSource::set_state (const XMLNode& node, int version)
 {
        const XMLProperty* prop;
 
index ce466343eae21f25af471705585113cec7db96b1..6f036f803c4076b8df4c5183c5000c4fe76dc6be 100644 (file)
@@ -66,8 +66,8 @@ MidiTrack::MidiTrack (Session& sess, string name, Route::Flag flag, TrackMode mo
        _mode = mode;
 }
 
-MidiTrack::MidiTrack (Session& sess, const XMLNode& node)
-       : Track (sess, node, DataType::MIDI )
+MidiTrack::MidiTrack (Session& sess, const XMLNode& node, int version)
+       : Track (sess, node, version, 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)
        , _default_channel (0)
        , _midi_thru (true)
 {
-       _set_state(node, false);
+       _set_state (node, version, false);
 }
 
 MidiTrack::~MidiTrack ()
@@ -155,18 +155,18 @@ MidiTrack::midi_diskstream() const
 }
 
 int
-MidiTrack::set_state (const XMLNode& node)
+MidiTrack::set_state (const XMLNode& node, int version)
 {
-       return _set_state (node, true);
+       return _set_state (node, version, true);
 }
 
 int
-MidiTrack::_set_state (const XMLNode& node, bool call_base)
+MidiTrack::_set_state (const XMLNode& node, int version, bool call_base)
 {
        const XMLProperty *prop;
        XMLNodeConstIterator iter;
 
-       if (Route::_set_state (node, call_base)) {
+       if (Route::_set_state (node, version, call_base)) {
                return -1;
        }
 
index 9aea8f981ad76ac2db9b6c500769216b24b86d36..dd507aacebeed4f2f28b45013ab35584de2f6453 100644 (file)
@@ -103,7 +103,7 @@ MuteMaster::get_value () const
 }
 
 int
-MuteMaster::set_state (const XMLNode& node)
+MuteMaster::set_state (const XMLNode& node, int version)
 {
        const XMLProperty* prop;
 
index d2cf1c03a8074442d6fb984982029d854b8fbce3..0c6b3699b6830f1bd67643735a3c21b75b091968 100644 (file)
@@ -106,7 +106,7 @@ NamedSelection::~NamedSelection ()
 }
 
 int
-NamedSelection::set_state (const XMLNode& /*node*/)
+NamedSelection::set_state (const XMLNode& /*node*/, int /*version*/)
 {
        return 0;
 }
index a8d30954cce3944af91865368eee9b28e2a73029..993cbe39f84c39e9072a70744d58dae789f787d2 100644 (file)
@@ -162,7 +162,7 @@ StreamPanner::set_position (float xpos, float ypos, float zpos, bool link_call)
 }
 
 int
-StreamPanner::set_state (const XMLNode& node)
+StreamPanner::set_state (const XMLNode& node, int version)
 {
        const XMLProperty* prop;
        XMLNodeConstIterator iter;
@@ -485,7 +485,7 @@ EqualPowerStereoPanner::state (bool /*full_state*/)
 }
 
 int
-EqualPowerStereoPanner::set_state (const XMLNode& node)
+EqualPowerStereoPanner::set_state (const XMLNode& node, int version)
 {
        const XMLProperty* prop;
        float pos;
@@ -673,7 +673,7 @@ Multi2dPanner::state (bool /*full_state*/)
 }
 
 int
-Multi2dPanner::set_state (const XMLNode& node)
+Multi2dPanner::set_state (const XMLNode& node, int version)
 {
        const XMLProperty* prop;
        float newx,newy;
@@ -830,6 +830,8 @@ Panner::reset (uint32_t nouts, uint32_t npans)
        bool changed = false;
        bool do_not_and_did_not_need_panning = ((nouts < 2) && (outputs.size() < 2));
 
+       cout << "Reset panner for " << nouts << " " << npans << "\n";
+
        /* if new and old config don't need panning, or if
           the config hasn't changed, we're done.
        */
@@ -1085,7 +1087,7 @@ Panner::state (bool full)
 }
 
 int
-Panner::set_state (const XMLNode& node)
+Panner::set_state (const XMLNode& node, int version)
 {
        XMLNodeList nlist;
        XMLNodeConstIterator niter;
index ce9f0335b8f91c250d869f02a111484410022691..aebcb59f3d69135845976e111f34b54fe09f9a80 100644 (file)
@@ -1789,7 +1789,7 @@ Playlist::mark_session_dirty ()
 }
 
 int
-Playlist::set_state (const XMLNode& node)
+Playlist::set_state (const XMLNode& node, int version)
 {
        XMLNode *child;
        XMLNodeList nlist;
index 1fff176713f2dac97e1dcd00c7797ca177ba922b..14ea464555740f2c5c92e5937345af86379bd9d0 100644 (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)
+PluginInsert::PluginInsert (Session& s, const XMLNode& node, int version)
        : Processor (s, "unnamed plugin insert"),
           _signal_analysis_collected_nframes(0),
           _signal_analysis_collect_nframes_max(0)
 {
-       if (set_state (node)) {
+       if (set_state (node, version)) {
                throw failed_constructor();
        }
 
@@ -716,7 +716,7 @@ PluginInsert::state (bool full)
 }
 
 int
-PluginInsert::set_state(const XMLNode& node)
+PluginInsert::set_state(const XMLNode& node, int version)
 {
        XMLNodeList nlist = node.children();
        XMLNodeIterator niter;
@@ -730,6 +730,7 @@ PluginInsert::set_state(const XMLNode& node)
        }
 
        if (prop->value() == X_("ladspa") || prop->value() == X_("Ladspa")) { /* handle old school sessions */
+               cout << "- LADSPA\n";
                type = ARDOUR::LADSPA;
        } else if (prop->value() == X_("lv2")) {
                type = ARDOUR::LV2;
@@ -743,6 +744,7 @@ PluginInsert::set_state(const XMLNode& node)
        }
 
        prop = node.property ("unique-id");
+       cout << "- ID " << prop->value() << "\n";
        if (prop == 0) {
                error << _("Plugin has no unique ID field") << endmsg;
                return -1;
@@ -777,7 +779,7 @@ PluginInsert::set_state(const XMLNode& node)
        for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
                if ((*niter)->name() == plugin->state_node_name()) {
                        for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i) {
-                               (*i)->set_state (**niter);
+                               (*i)->set_state (**niter, version);
                        }
                        break;
                }
@@ -792,8 +794,8 @@ PluginInsert::set_state(const XMLNode& node)
                        break;
                }
        }
-
-       Processor::set_state (*insert_node);
+       
+       Processor::set_state (*insert_node, version);
 
        /* look for port automation node */
 
index 61ae4d37e858130cb661bc60dc2d17ee7420dd86..04a145aa52af11fba94a047273e93d4ec68097ea 100644 (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)
+PortInsert::PortInsert (Session& s, boost::shared_ptr<MuteMaster> mm, const XMLNode& node, int version)
        : IOProcessor (s, true, true, "unnamed port insert")
        , _out (new Delivery (s, _output, mm, _name, Delivery::Insert))
 
 {
-       if (set_state (node)) {
+       if (set_state (node, version)) {
                throw failed_constructor();
        }
 
@@ -104,7 +104,7 @@ PortInsert::state (bool full)
 }
 
 int
-PortInsert::set_state(const XMLNode& node)
+PortInsert::set_state (const XMLNode& node, int version)
 {
        XMLNodeList nlist = node.children();
        XMLNodeIterator niter;
index c8f7a136bb28473b69f261ace5f2923a202be4a7..e1db982fe119a1771cf83b02824fe35667e01022 100644 (file)
@@ -145,8 +145,43 @@ Processor::state (bool full_state)
 }
 
 int
-Processor::set_state (const XMLNode& node)
+Processor::set_state_2X (const XMLNode & node, int version)
 {
+       XMLProperty const * prop;
+
+       XMLNodeList children = node.children ();
+
+       for (XMLNodeIterator i = children.begin(); i != children.end(); ++i) {
+
+               if ((*i)->name() == X_("IO")) {
+
+                       if ((prop = (*i)->property ("name")) != 0) {
+                               set_name (prop->value ());
+                       }
+
+                       if ((prop = (*i)->property ("id")) != 0) {
+                               _id = prop->value ();
+                       }
+
+                       if ((prop = (*i)->property ("active")) != 0) {
+                               if (_active != string_is_affirmative (prop->value())) {
+                                       _active = !_active;
+                                       ActiveChanged (); /* EMIT_SIGNAL */
+                               }
+                       }
+               }
+       }
+
+       return 0;
+}
+
+int
+Processor::set_state (const XMLNode& node, int version)
+{
+       if (version < 3000) {
+               return set_state_2X (node, version);
+       }
+       
        const XMLProperty *prop;
        const XMLProperty *legacy_active = 0;
 
index ba9389eec854553730a1b418510052cbc2458d1d..afa9a2a4c360f5101d03358a2799327853cd8c32 100644 (file)
@@ -240,7 +240,7 @@ RCConfiguration::get_variables ()
 }
 
 int
-RCConfiguration::set_state (const XMLNode& root)
+RCConfiguration::set_state (const XMLNode& root, int version)
 {
        if (root.name() != "Ardour") {
                return -1;
index e1bc5c088348a3a2b838a197c446480d7c066185..244312bc0ab59659a576e6389c509f0bfc8ba74f 100644 (file)
@@ -1339,7 +1339,7 @@ Region::set_live_state (const XMLNode& node, Change& what_changed, bool send)
 }
 
 int
-Region::set_state (const XMLNode& node)
+Region::set_state (const XMLNode& node, int version)
 {
        const XMLProperty *prop;
        Change what_changed = Change (0);
index 858d658c9c2b07e43d6a5b0738e854031619058b..69aa2f700e071c3e337a06521ae1140244184c4f 100644 (file)
@@ -89,7 +89,7 @@ Return::state(bool full)
 }
 
 int
-Return::set_state(const XMLNode& node)
+Return::set_state (const XMLNode& node, int version)
 {
        XMLNodeList nlist = node.children();
        XMLNodeIterator niter;
index 95b651b6caab57376de160658cef13e0df589c3b..7e453653dc900d8290b87190f875ccee2d6ed37e 100644 (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, DataType default_type)
+Route::Route (Session& sess, const XMLNode& node, int version, 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, DataType default_type)
 {
        init ();
 
-       _set_state (node, false);
+       _set_state (node, version, false);
 
        /* now that we have _meter, its safe to connect to this */
 
@@ -684,7 +684,6 @@ Route::add_processor (boost::shared_ptr<Processor> processor, ProcessorList::ite
                // Set up processor list channels.  This will set processor->[input|output]_streams(),
                // configure redirect ports properly, etc.
 
-
                if (configure_processors_unlocked (err)) {
                        ProcessorList::iterator ploc = loc;
                        --ploc;
@@ -831,6 +830,64 @@ Route::add_processor_from_xml (const XMLNode& node, ProcessorList::iterator iter
        }
 }
 
+
+bool
+Route::add_processor_from_xml_2X (const XMLNode& node, int version, ProcessorList::iterator iter)
+{
+       const XMLProperty *prop;
+
+       try {
+               boost::shared_ptr<Processor> processor;
+                                       
+               if (node.name() == "Insert") {
+
+                       if ((prop = node.property ("type")) != 0) {
+                               
+                               if (prop->value() == "ladspa" || prop->value() == "Ladspa" || 
+                                   prop->value() == "lv2" ||
+                                   prop->value() == "vst" ||
+                                   prop->value() == "audiounit") {
+                                       
+                                       processor.reset (new PluginInsert (_session, node, version));
+                                       
+                               } else {
+                                       
+                                       processor.reset (new PortInsert (_session, _mute_master, node, version));
+                               }
+
+                       }
+                               
+               } else if (node.name() == "Send") {
+                       
+                       processor.reset (new Send (_session, _mute_master, node, version));
+                       
+               } else {
+                       
+                       error << string_compose(_("unknown Processor type \"%1\"; ignored"), node.name()) << endmsg;
+                       return false;
+               }
+                               
+               if (iter == _processors.end() && processor->visible() && !_processors.empty()) {
+                       /* check for invisible processors stacked at the end and leave them there */
+                       ProcessorList::iterator p;
+                       p = _processors.end();
+                       --p;
+                       while (!(*p)->visible() && p != _processors.begin()) {
+                               --p;
+                       }
+                       ++p;
+                       iter = p;
+               }
+               
+               return (add_processor (processor, iter) == 0);
+       }
+
+       catch (failed_constructor &err) {
+               warning << _("processor could not be created. Ignored.") << endmsg;
+               return false;
+       }
+}
+
 int
 Route::add_processors (const ProcessorList& others, boost::shared_ptr<Processor> before, ProcessorStreams* err)
 {
@@ -1326,6 +1383,7 @@ Route::configure_processors_unlocked (ProcessorStreams* err)
        uint32_t index = 0;
 
        for (ProcessorList::iterator p = _processors.begin(); p != _processors.end(); ++p, ++index) {
+
                if ((*p)->can_support_io_configuration(in, out)) {
                        configuration.push_back(make_pair(in, out));
                        in = out;
@@ -1600,15 +1658,18 @@ Route::state(bool full_state)
 }
 
 int
-Route::set_state (const XMLNode& node)
+Route::set_state (const XMLNode& node, int version)
 {
-       return _set_state (node, true);
+       return _set_state (node, version, true);
 }
 
 int
-Route::_set_state (const XMLNode& node, bool /*call_base*/)
+Route::_set_state (const XMLNode& node, int version, bool /*call_base*/)
 {
-
+       if (version < 3000) {
+               return _set_state_2X (node, version);
+       }
+       
        XMLNodeList nlist;
        XMLNodeConstIterator niter;
        XMLNode *child;
@@ -1773,6 +1834,200 @@ Route::_set_state (const XMLNode& node, bool /*call_base*/)
        return 0;
 }
 
+int
+Route::_set_state_2X (const XMLNode& node, int version)
+{
+       XMLNodeList nlist;
+       XMLNodeConstIterator niter;
+       XMLNode *child;
+       XMLPropertyList plist;
+       const XMLProperty *prop;
+
+       /* 2X things which still remain to be handled:
+        * default-type 
+        * muted
+        * mute-affects-pre-fader
+        * mute-affects-post-fader
+        * mute-affects-control-outs
+        * mute-affects-main-outs
+        * automation
+        * controlouts
+        */
+
+       if (node.name() != "Route") {
+               error << string_compose(_("Bad node sent to Route::set_state() [%1]"), node.name()) << endmsg;
+               return -1;
+       }
+
+       if ((prop = node.property (X_("flags"))) != 0) {
+               _flags = Flag (string_2_enum (prop->value(), _flags));
+       } else {
+               _flags = Flag (0);
+       }
+
+       /* add standard processors */
+
+       _meter.reset (new PeakMeter (_session));
+       add_processor (_meter, PreFader);
+
+       if (_flags & ControlOut) {
+               /* where we listen to tracks */
+               _intreturn.reset (new InternalReturn (_session));
+               add_processor (_intreturn, PreFader);
+       }
+       
+       _main_outs.reset (new Delivery (_session, _output, _mute_master, _name, Delivery::Main));
+       add_processor (_main_outs, PostFader);
+
+       /* IOs */
+
+       nlist = node.children ();
+       for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
+
+               child = *niter;
+
+               if (child->name() == IO::state_node_name) {
+                       _input->set_state_2X (*child, version, true);
+                       _output->set_state_2X (*child, version, false);
+
+                       if ((prop = child->property (X_("name"))) != 0) {
+                               set_name (prop->value ());
+                       }
+
+                       if ((prop = child->property (X_("id"))) != 0) {
+                               _id = prop->value ();
+                       }
+
+                       if ((prop = child->property (X_("active"))) != 0) {
+                               bool yn = string_is_affirmative (prop->value());
+                               _active = !yn; // force switch
+                               set_active (yn);
+                       }
+               }
+                       
+               /* XXX: panners? */
+       }
+       
+       if ((prop = node.property (X_("phase-invert"))) != 0) {
+               set_phase_invert (string_is_affirmative (prop->value()));
+       }
+
+       if ((prop = node.property (X_("denormal-protection"))) != 0) {
+               set_denormal_protection (string_is_affirmative (prop->value()));
+       }
+
+       if ((prop = node.property (X_("soloed"))) != 0) {
+               bool yn = string_is_affirmative (prop->value());
+
+               /* XXX force reset of solo status */
+
+               set_solo (yn, this);
+       }
+
+       if ((prop = node.property (X_("meter-point"))) != 0) {
+               _meter_point = MeterPoint (string_2_enum (prop->value (), _meter_point));
+       }
+
+       /* XXX: if the route was in both a mix group and an edit group, it'll end up
+          just in the edit group. */
+
+       if ((prop = node.property (X_("mix-group"))) != 0) {
+               RouteGroup* route_group = _session.route_group_by_name(prop->value());
+               if (route_group == 0) {
+                       error << string_compose(_("Route %1: unknown route group \"%2 in saved state (ignored)"), _name, prop->value()) << endmsg;
+               } else {
+                       set_route_group (route_group, this);
+               }
+       }
+       
+       if ((prop = node.property (X_("edit-group"))) != 0) {
+               RouteGroup* route_group = _session.route_group_by_name(prop->value());
+               if (route_group == 0) {
+                       error << string_compose(_("Route %1: unknown route group \"%2 in saved state (ignored)"), _name, prop->value()) << endmsg;
+               } else {
+                       set_route_group (route_group, this);
+               }
+       }
+
+       if ((prop = node.property (X_("order-keys"))) != 0) {
+
+               long n;
+
+               string::size_type colon, equal;
+               string remaining = prop->value();
+
+               while (remaining.length()) {
+
+                       if ((equal = remaining.find_first_of ('=')) == string::npos || equal == remaining.length()) {
+                               error << string_compose (_("badly formed order key string in state file! [%1] ... ignored."), remaining)
+                                     << endmsg;
+                       } else {
+                               if (sscanf (remaining.substr (equal+1).c_str(), "%ld", &n) != 1) {
+                                       error << string_compose (_("badly formed order key string in state file! [%1] ... ignored."), remaining)
+                                             << endmsg;
+                               } else {
+                                       set_order_key (remaining.substr (0, equal), n);
+                               }
+                       }
+
+                       colon = remaining.find_first_of (':');
+
+                       if (colon != string::npos) {
+                               remaining = remaining.substr (colon+1);
+                       } else {
+                               break;
+                       }
+               }
+       }
+
+       XMLNodeList redirect_nodes;
+       
+       for (niter = nlist.begin(); niter != nlist.end(); ++niter){
+               
+               child = *niter;
+               
+               if (child->name() == X_("Send") || child->name() == X_("Insert")) {
+                       redirect_nodes.push_back(child);
+               }
+               
+       }
+
+       set_processor_state_2X (redirect_nodes, version);
+
+       for (niter = nlist.begin(); niter != nlist.end(); ++niter){
+               child = *niter;
+
+               if (child->name() == X_("Comment")) {
+
+                       /* XXX this is a terrible API design in libxml++ */
+
+                       XMLNode *cmt = *(child->children().begin());
+                       _comment = cmt->content();
+
+               } else if (child->name() == X_("Extra")) {
+
+                       _extra_xml = new XMLNode (*child);
+
+               } else if (child->name() == X_("Controllable") && (prop = child->property("name")) != 0) {
+                       
+                       if (prop->value() == "solo") {
+                               _solo_control->set_state (*child);
+                               _session.add_controllable (_solo_control);
+                       } 
+
+               } else if (child->name() == X_("RemoteControl")) {
+                       if ((prop = child->property (X_("id"))) != 0) {
+                               int32_t x;
+                               sscanf (prop->value().c_str(), "%d", &x);
+                               set_remote_control_id (x);
+                       }
+
+               } 
+       }
+
+       return 0;
+}
+
 XMLNode&
 Route::get_processor_state ()
 {
@@ -1784,6 +2039,20 @@ Route::get_processor_state ()
        return *root;
 }
 
+void
+Route::set_processor_state_2X (XMLNodeList const & nList, int version)
+{
+       /* We don't bother removing existing processors not in nList, as this
+          method will only be called when creating a Route from scratch, not
+          for undo purposes.  Just put processors in at the appropriate place
+          in the list.
+       */
+
+       for (XMLNodeConstIterator i = nList.begin(); i != nList.end(); ++i) {
+               add_processor_from_xml_2X (**i, version, _processors.begin ());
+       }
+}
+
 void
 Route::set_processor_state (const XMLNode& node)
 {
index 5cfc1fb3d08e7b3d82ebbd557e5f78d5ad64e096..3d7ac3ef70df961afcc1205bc5b9b8e88fb924ff 100644 (file)
@@ -136,9 +136,13 @@ RouteGroup::get_state (void)
        return *node;
 }
 
-int
-RouteGroup::set_state (const XMLNode& node)
+int 
+RouteGroup::set_state (const XMLNode& node, int version)
 {
+       if (version < 3000) {
+               return set_state_2X (node, version);
+       }
+
        const XMLProperty *prop;
 
        if ((prop = node.property ("name")) != 0) {
@@ -156,6 +160,28 @@ RouteGroup::set_state (const XMLNode& node)
        return 0;
 }
 
+int
+RouteGroup::set_state_2X (const XMLNode& node, int version)
+{
+       XMLProperty const * prop;
+       
+       if ((prop = node.property ("name")) != 0) {
+               _name = prop->value();
+       }
+       
+       if ((prop = node.property ("flags")) != 0) {
+               _flags = Flag (string_2_enum (prop->value(), _flags));
+       }
+
+       if (node.name() == "MixGroup") {
+               _properties = Property (Gain | Mute | Solo | RecEnable);
+       } else if (node.name() == "EditGroup") {
+               _properties = Property (Select | Edit);
+       }
+
+       return 0;
+}
+
 void
 RouteGroup::set_active (bool yn, void *src)
 {
index f01512332e76aca23b7b6fea6bb8e40ff74f0233..bd9eccaf542ddabe1aa56cdfd69b03e8cd0cbd6e 100644 (file)
@@ -46,14 +46,14 @@ Send::Send (Session& s, boost::shared_ptr<MuteMaster> mm, Role r)
        ProcessorCreated (this); /* EMIT SIGNAL */
 }
 
-Send::Send (Session& s, boost::shared_ptr<MuteMaster> mm, const XMLNode& node, Role r)
+Send::Send (Session& s, boost::shared_ptr<MuteMaster> mm, const XMLNode& node, int version, Role r)
         : Delivery (s, mm, "send", r)
        , _metering (false)
 {
        _amp.reset (new Amp (_session, _mute_master));
        _meter.reset (new PeakMeter (_session));
 
-       if (set_state (node)) {
+       if (set_state (node, version)) {
                throw failed_constructor();
        }
 
@@ -150,7 +150,7 @@ Send::state(bool full)
 }
 
 int
-Send::set_state(const XMLNode& node)
+Send::set_state (const XMLNode& node, int version)
 {
        XMLNodeList nlist = node.children();
        XMLNodeIterator niter;
index 96bd69eca34da25f8a857a8623c6f54dce45e395..79790b5673c69b213211ae6bc334d6a1ed4ed52f 100644 (file)
@@ -2062,8 +2062,8 @@ Session::new_route_from_template (uint32_t how_many, const std::string& template
                Track::zero_diskstream_id_in_xml (node_copy);
 
                try {
-                       shared_ptr<Route> route (XMLRouteFactory (node_copy));
-
+                       shared_ptr<Route> route (XMLRouteFactory (node_copy, 3000));
+           
                        if (route == 0) {
                                error << _("Session: cannot create track/bus from template description") << endmsg;
                                goto out;
index af1286e8f28e94faf8e13afbc8ccca8ac99b86fa..ffd68bb5a6972ef62441b5cbdd30c678563021f7 100644 (file)
@@ -170,7 +170,7 @@ Session::GlobalRouteStateCommand::GlobalRouteStateCommand (Session& s, const XML
 }
 
 int
-Session::GlobalRouteStateCommand::set_state (const XMLNode& node)
+Session::GlobalRouteStateCommand::set_state (const XMLNode& node, int version)
 {
        GlobalRouteBooleanState states;
        XMLNodeList nlist;
@@ -483,7 +483,7 @@ Session::GlobalMeteringStateCommand::get_state()
 }
 
 int
-Session::GlobalMeteringStateCommand::set_state (const XMLNode& node)
+Session::GlobalMeteringStateCommand::set_state (const XMLNode& node, int version)
 {
        GlobalRouteBooleanState states;
        XMLNodeList nlist;
index 2cae7021e167a0245e3aca547e1270b11f89b994..c35da623689b1d00b0c9aa2e41fbdeade71fb351 100644 (file)
@@ -76,7 +76,7 @@ SessionConfiguration::get_variables ()
 
 
 int
-SessionConfiguration::set_state (XMLNode const& root)
+SessionConfiguration::set_state (XMLNode const& root, int version)
 {
        if (root.name() != "Ardour") {
                return -1;
index e792fd1585f0c5789959e6e779365b6461a2e5f4..446d944f8a56f7089cefc649ecc95dde693e8736 100644 (file)
@@ -163,7 +163,7 @@ SessionMetadata::get_state ()
 }
 
 int
-SessionMetadata::set_state (const XMLNode & state)
+SessionMetadata::set_state (const XMLNode & state, int version)
 {
        const XMLNodeList & children = state.children();
        ustring name;
index b85f2ac07895c0c20d5c090bd9b18fe133147442..de99558c16745db293147be42a137d7d1d102152 100644 (file)
@@ -1123,7 +1123,7 @@ Session::get_control_protocol_state ()
 }
 
 int
-Session::set_state (const XMLNode& node)
+Session::set_state (const XMLNode& node, int version)
 {
        XMLNodeList nlist;
        XMLNode* child;
@@ -1137,6 +1137,10 @@ Session::set_state (const XMLNode& node)
                return -1;
        }
 
+       if ((prop = node.property ("version")) != 0) {
+               version = atoi (prop->value ()) * 1000;
+       }
+
        if ((prop = node.property ("name")) != 0) {
                _name = prop->value ();
        }
@@ -1205,10 +1209,12 @@ Session::set_state (const XMLNode& node)
        if (use_config_midi_ports ()) {
        }
 
-       if ((child = find_named_node (node, "Metadata")) == 0) {
-               warning << _("Session: XML state has no metadata section (2.0 session?)") << endmsg;
-       } else if (_metadata->set_state (*child)) {
-               goto out;
+       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)) {
+                       goto out;
+               }
        }
 
        if ((child = find_named_node (node, "Locations")) == 0) {
@@ -1270,7 +1276,7 @@ Session::set_state (const XMLNode& node)
        } else if (load_unused_playlists (*child)) {
                goto out;
        }
-
+       
        if ((child = find_named_node (node, "NamedSelections")) != 0) {
                if (load_named_selections (*child)) {
                        goto out;
@@ -1284,21 +1290,42 @@ Session::set_state (const XMLNode& node)
                goto out;
        }
 
-       if ((child = find_named_node (node, "Bundles")) == 0) {
-               warning << _("Session: XML state has no bundles section (2.0 session?)") << endmsg;
-               //goto out;
-       } else {
-               /* We can't load Bundles yet as they need to be able
-                  to convert from port names to Port objects, which can't happen until
-                  later */
-               _bundle_xml_node = new XMLNode (*child);
+       if (version >= 3000) {
+               if ((child = find_named_node (node, "Bundles")) == 0) {
+                       warning << _("Session: XML state has no bundles section") << endmsg;
+                       //goto out;
+               } else {
+                       /* We can't load Bundles yet as they need to be able
+                          to convert from port names to Port objects, which can't happen until
+                          later */
+                       _bundle_xml_node = new XMLNode (*child);
+               }
        }
+       
+       if (version >= 3000) {
+               
+               if ((child = find_named_node (node, "RouteGroups")) == 0) {
+                       error << _("Session: XML state has no route groups section") << endmsg;
+                       goto out;
+               } else if (load_route_groups (*child, version)) {
+                       goto out;
+               }
+               
+       } else if (version < 3000) {
+               
+               if ((child = find_named_node (node, "EditGroups")) == 0) {
+                       error << _("Session: XML state has no edit groups section") << endmsg;
+                       goto out;
+               } else if (load_route_groups (*child, version)) {
+                       goto out;
+               }
 
-       if ((child = find_named_node (node, "RouteGroups")) == 0) {
-               error << _("Session: XML state has no route groups section") << endmsg;
-               goto out;
-       } else if (load_route_groups (*child)) {
-               goto out;
+               if ((child = find_named_node (node, "MixGroups")) == 0) {
+                       error << _("Session: XML state has no mix groups section") << endmsg;
+                       goto out;
+               } else if (load_route_groups (*child, version)) {
+                       goto out;
+               }
        }
 
        if ((child = find_named_node (node, "TempoMap")) == 0) {
@@ -1311,7 +1338,7 @@ Session::set_state (const XMLNode& node)
        if ((child = find_named_node (node, "Routes")) == 0) {
                error << _("Session: XML state has no routes section") << endmsg;
                goto out;
-       } else if (load_routes (*child)) {
+       } else if (load_routes (*child, version)) {
                goto out;
        }
 
@@ -1336,7 +1363,7 @@ Session::set_state (const XMLNode& node)
 }
 
 int
-Session::load_routes (const XMLNode& node)
+Session::load_routes (const XMLNode& node, int version)
 {
        XMLNodeList nlist;
        XMLNodeConstIterator niter;
@@ -1348,7 +1375,7 @@ Session::load_routes (const XMLNode& node)
 
        for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
 
-               boost::shared_ptr<Route> route (XMLRouteFactory (**niter));
+               boost::shared_ptr<Route> route (XMLRouteFactory (**niter, version));
 
                if (route == 0) {
                        error << _("Session: cannot create Route from XML description.") << endmsg;
@@ -1366,7 +1393,7 @@ Session::load_routes (const XMLNode& node)
 }
 
 boost::shared_ptr<Route>
-Session::XMLRouteFactory (const XMLNode& node)
+Session::XMLRouteFactory (const XMLNode& node, int version)
 {
        if (node.name() != "Route") {
                return boost::shared_ptr<Route> ((Route*) 0);
@@ -1385,14 +1412,14 @@ Session::XMLRouteFactory (const XMLNode& node)
 
        if (has_diskstream) {
                if (type == DataType::AUDIO) {
-                       boost::shared_ptr<Route> ret (new AudioTrack (*this, node));
+                       boost::shared_ptr<Route> ret (new AudioTrack (*this, node, version));
                        return ret;
                } else {
-                       boost::shared_ptr<Route> ret (new MidiTrack (*this, node));
+                       boost::shared_ptr<Route> ret (new MidiTrack (*this, node, version));
                        return ret;
                }
        } else {
-               boost::shared_ptr<Route> ret (new Route (*this, node));
+               boost::shared_ptr<Route> ret (new Route (*this, node, version));
                return ret;
        }
 }
@@ -2053,18 +2080,31 @@ Session::load_bundles (XMLNode const & node)
 }
 
 int
-Session::load_route_groups (const XMLNode& node)
+Session::load_route_groups (const XMLNode& node, int version)
 {
        XMLNodeList nlist = node.children();
        XMLNodeConstIterator niter;
 
        set_dirty ();
 
-       for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
-               if ((*niter)->name() == "RouteGroup") {
-                       RouteGroup* rg = new RouteGroup (*this, "");
-                       add_route_group (rg);
-                       rg->set_state (**niter);
+       if (version >= 3000) {
+               
+               for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
+                       if ((*niter)->name() == "RouteGroup") {
+                               RouteGroup* rg = new RouteGroup (*this, "");
+                               add_route_group (rg);
+                               rg->set_state (**niter, version);
+                       }
+               }
+
+       } else if (version < 3000) {
+
+               for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
+                       if ((*niter)->name() == "EditGroup" || (*niter)->name() == "MixGroup") {
+                               RouteGroup* rg = new RouteGroup (*this, "");
+                               add_route_group (rg);
+                               rg->set_state (**niter, version);
+                       }
                }
        }
 
index 679f244dbe80dfe90552c91e35c3e6b23a10b1cf..358cbb12576cc7b865278ebf9cf68b0d7fea8ca0 100644 (file)
@@ -329,7 +329,7 @@ SMFSource::get_state ()
 }
 
 int
-SMFSource::set_state (const XMLNode& node)
+SMFSource::set_state (const XMLNode& node, int version)
 {
        if (Source::set_state (node)) {
                return -1;
index 45cd1fb904e0536a99f791e9087b66c12af33424..7ed4e584ce2606f33474daa5062be4bb48b998cf 100644 (file)
@@ -110,7 +110,7 @@ Source::get_state ()
 }
 
 int
-Source::set_state (const XMLNode& node)
+Source::set_state (const XMLNode& node, int version)
 {
        const XMLProperty* prop;
 
index 623dd2162722a07fd138788815f30019c33169f4..c66e0f6f24fda712e123b9696b7716ff0e156398 100644 (file)
@@ -1500,7 +1500,7 @@ TempoMap::get_state ()
 }
 
 int
-TempoMap::set_state (const XMLNode& node)
+TempoMap::set_state (const XMLNode& node, int version)
 {
        {
                Glib::RWLock::WriterLock lm (lock);
index ce208769f6c14a94e54469990e6e2c82cb6ef20b..ecd8208282720a26fbfb6c96c2d58f16b1e92fc6 100644 (file)
@@ -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, DataType default_type)
-       : Route (sess, node, default_type)
+Track::Track (Session& sess, const XMLNode& node, int version, DataType default_type)
+       : Route (sess, node, version, default_type)
        , _rec_enable_control (new RecEnableControllable(*this))
 {
        _freeze_record.state = NoFreeze;
index e2d46ab6e0047b77223117865ed845568bdd8076..73b5960e03015c405116260099a934b97cba98ee 100644 (file)
@@ -24,7 +24,7 @@ ARDOUR::UserBundle::UserBundle (XMLNode const & x, bool i)
 }
 
 int
-ARDOUR::UserBundle::set_state (XMLNode const & node)
+ARDOUR::UserBundle::set_state (XMLNode const & node, int version)
 {
        XMLProperty const * name;
 
index cd3207cffcca07aa231fa4a6f96c3ebf76f1e88d..27986bc6e97640df111d31e0172537b852abb8f8 100644 (file)
@@ -102,7 +102,7 @@ public:
        const PatchPrimaryKey&   patch_primary_key()   const { return _id; }
 
        XMLNode& get_state (void);
-       int      set_state (const XMLNode& a_node);
+       int      set_state (const XMLNode&, int version = 3000);
 
 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& a_node);
+       int      set_state (const XMLNode&, int version = 3000);
 
 private:
        std::string       _name;
@@ -203,7 +203,7 @@ public:
        }
 
        XMLNode& get_state (void);
-       int      set_state (const XMLNode& a_node);
+       int      set_state (const XMLNode& a_node, int version = 3000);
 
 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& a_node);
+       int      set_state (const XMLNode&, int version = 3000);
 
 private:
        std::string _number;
@@ -248,7 +248,7 @@ public:
        const Notes& notes() const { return _notes; }
 
        XMLNode& get_state (void);
-       int      set_state (const XMLNode& a_node);
+       int      set_state (const XMLNode&, int version = 3000);
 
 private:
        std::string _name;
@@ -266,7 +266,7 @@ public:
 
        
        XMLNode& get_state (void);
-       int      set_state (const XMLNode& a_node);
+       int      set_state (const XMLNode&, int version = 3000);
        
        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& a_node);
+       int      set_state (const XMLNode&, int version = 3000);
        
 private:
        std::string           _manufacturer;
@@ -346,7 +346,7 @@ public:
        const MasterDeviceNames::Models& all_models() const { return _all_models; }
                
        XMLNode& get_state (void);
-       int      set_state (const XMLNode& a_node);
+       int      set_state (const XMLNode&, int version = 3000);
 
 private:
        std::string                   _author;
index 5a0c0fe147d39c9dffb75ba98a83bd506a4c355c..815ebd4b37c1e8dca1a43c06402c86fdbed50904 100644 (file)
@@ -77,7 +77,7 @@ void initialize_primary_key_from_commands (PatchPrimaryKey& id, const XMLNode* n
 
 
 int
-Patch::set_state (const XMLNode& node)
+Patch::set_state (const XMLNode& node, int version)
 {
        assert(node.name() == "Patch");
        _number = node.property("Number")->value();
@@ -116,7 +116,7 @@ Note::get_state (void)
 }
 
 int
-Note::set_state (const XMLNode& node)
+Note::set_state (const XMLNode& node, int version)
 {
        assert(node.name() == "Note");
        _number = node.property("Number")->value();
@@ -135,7 +135,7 @@ NoteNameList::get_state (void)
 }
 
 int
-NoteNameList::set_state (const XMLNode& node)
+NoteNameList::set_state (const XMLNode& node, int version)
 {
        assert(node.name() == "NoteNameList");
        _name   = node.property("Name")->value();
@@ -168,7 +168,7 @@ PatchBank::get_state (void)
 }
 
 int
-PatchBank::set_state (const XMLNode& node)
+PatchBank::set_state (const XMLNode& node, int version)
 {
        assert(node.name() == "PatchBank");
        _name   = node.property("Name")->value();
@@ -223,7 +223,7 @@ ChannelNameSet::get_state (void)
 }
 
 int
-ChannelNameSet::set_state (const XMLNode& node)
+ChannelNameSet::set_state (const XMLNode& node, int version)
 {
        assert(node.name() == "ChannelNameSet");
        _name   = node.property("Name")->value();
@@ -270,7 +270,7 @@ ChannelNameSet::set_state (const XMLNode& node)
 }
 
 int
-CustomDeviceMode::set_state(const XMLNode& a_node)
+CustomDeviceMode::set_state(const XMLNode& a_node, int version)
 {
        assert(a_node.name() == "CustomDeviceMode");
        
@@ -307,7 +307,7 @@ CustomDeviceMode::get_state(void)
 }
 
 int
-MasterDeviceNames::set_state(const XMLNode& a_node)
+MasterDeviceNames::set_state(const XMLNode& a_node, int version)
 {
        // cerr << "MasterDeviceNames::set_state Manufacturer" << endl;
        // Manufacturer
@@ -376,7 +376,7 @@ MasterDeviceNames::get_state(void)
 }
 
 int
-MIDINameDocument::set_state(const XMLNode& a_node)
+MIDINameDocument::set_state(const XMLNode& a_node, int version)
 {
        // Author
        boost::shared_ptr<XMLSharedNodeList> author = a_node.find("//Author");
index ba6b32282b9d74e3999d5df06be4528203d35f3a..ea6ad364a8a4fef13ae77ba25f36e34671920b2c 100644 (file)
@@ -105,7 +105,7 @@ Controllable::get_state ()
 }
 
 int
-Controllable::set_state (const XMLNode& node)
+Controllable::set_state (const XMLNode& node, int version)
 {
        const XMLProperty* prop = node.property (X_("id"));
 
index 240118901c8f763562e065a821e7636b7276b1fb..f913dec5b7b448f822b3ce456e68fb7d575c01ea 100644 (file)
@@ -38,7 +38,7 @@ public:
        virtual void redo() { (*this)(); }
        
        virtual XMLNode &get_state();
-       virtual int set_state(const XMLNode&) { /* noop */ return 0; }
+       virtual int set_state(const XMLNode&, int version = 3000) { /* noop */ return 0; }
 
 protected:
        Command() {}
index 28b0b37cb92aca2934b0e30567cedc2f64b3d5b8..4afcb5374004526232c2390034a4e4f02dd9c135 100644 (file)
@@ -51,7 +51,7 @@ class Controllable : public PBD::StatefulDestructible {
 
        sigc::signal<void> Changed;
 
-       int set_state (const XMLNode&);
+       int set_state (const XMLNode&, int version = 3000);
        XMLNode& get_state ();
 
        std::string name()      const { return _name; }
index 0d75a8579a29f3009a177df123aa6d390760a4bb..324d9c1222baab508404149450c7941abbca3655 100644 (file)
@@ -38,7 +38,7 @@ class Stateful {
 
        virtual XMLNode& get_state (void) = 0;
 
-       virtual int set_state (const XMLNode&) = 0;
+       virtual int set_state (const XMLNode&, int version = 3000) = 0;
 
        /* Extra XML nodes */
 
index a4987ee9d2f891f90f1154662ddc2e23f7007d27..b3cd5746a6c0339a90550e8ce63aad44b92a35f7 100644 (file)
@@ -323,7 +323,7 @@ GenericMidiControlProtocol::get_state ()
 }
 
 int
-GenericMidiControlProtocol::set_state (const XMLNode& node)
+GenericMidiControlProtocol::set_state (const XMLNode& node, int version)
 {
        XMLNodeList nlist;
        XMLNodeConstIterator niter;
index dfff8810d1449e54dd113c2eed2957b88eff826e..6a81eda02194f37685ba3e5ed3beb970e551a258 100644 (file)
@@ -36,7 +36,7 @@ class GenericMidiControlProtocol : public ARDOUR::ControlProtocol {
        bool get_feedback () const;
 
        XMLNode& get_state ();
-       int set_state (const XMLNode&);
+       int set_state (const XMLNode&, int version = 3000);
 
   private:
        MIDI::Port* _port;
index 9d80915ef6d8430cfb7e7765671d8e37d84e7f94..8275d0849c465f16e5f716cac354576d2c2f43b2 100644 (file)
@@ -361,7 +361,7 @@ MIDIControllable::write_feedback (MIDI::byte* buf, int32_t& bufsize, bool /*forc
 }
 
 int 
-MIDIControllable::set_state (const XMLNode& node)
+MIDIControllable::set_state (const XMLNode& node, int version)
 {
        const XMLProperty* prop;
        int xx;
index 9fe9dcd2acd1b91a3f3bfe6fd39707756c097778..b2805744a39f037863400b08e13dd7218059013a 100644 (file)
@@ -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 set_state (const XMLNode&, int version = 3000);
 
        void bind_midi (MIDI::channel_t, MIDI::eventType, MIDI::byte);
        MIDI::channel_t get_control_channel () { return control_channel; }
index 7c7fbd9ff599dcbfd9a5711313791840650c06b3..5fef10fac49cc5baffd26713a327ef01a54a7e82 100644 (file)
@@ -806,7 +806,7 @@ XMLNode & MackieControlProtocol::get_state()
        return *node;
 }
 
-int MackieControlProtocol::set_state( const XMLNode & node )
+int MackieControlProtocol::set_state (const XMLNode & node, int version)
 {
 #ifdef DEBUG
        cout << "MackieControlProtocol::set_state: active " << _active << endl;
index 7d8a6f2fd0e9c882c8dc7f977bec7038695ecc1b..3d1dea1ed47dce3466d0550b481d03e4277ce3e8 100644 (file)
@@ -78,7 +78,7 @@ class MackieControlProtocol
        int set_active (bool yn);
 
        XMLNode& get_state ();
-       int set_state (const XMLNode&);
+       int set_state (const XMLNode&, int version = 3000);
   
        static bool probe();
        
index e26e0f7b77b12dc54f5a241385767e605fa222a9..9a6c19225b9bfc079e007b5183a4ab379a7c96a4 100644 (file)
@@ -864,7 +864,7 @@ OSC::get_state ()
 }
                
 int 
-OSC::set_state (const XMLNode&)
+OSC::set_state (const XMLNode&, int /*version*/)
 {
        return 0;
 }
index 2b6df6a80cab93cdd08474bfdbc51ce4c6cf8d04..a814726b4e5bfd1f603c88a987526b52bfea58b1 100644 (file)
@@ -49,7 +49,7 @@ class OSC : public ARDOUR::ControlProtocol
        virtual ~OSC();
 
        XMLNode& get_state ();
-       int set_state (const XMLNode&);
+       int set_state (const XMLNode&, int version = 3000);
 
        int set_active (bool yn);
        bool get_active () const;
index 3d3fefcac1a6f57a3e512be8531c2bbe0267cd9d..ed805466b018a5b99ba2c4cb265da531929ed3c1 100644 (file)
@@ -51,7 +51,7 @@ OSCControllable::get_state ()
 }
 
 int
-OSCControllable::set_state (const XMLNode& /*node*/)
+OSCControllable::set_state (const XMLNode& /*node*/, int /*version*/)
 {
        return 0;
 }
index 4b10dbc39eb6a25653184210ce92de8c69d0b657..b5021aa397f22680e2a1adc78fcc6c801c6a60ef 100644 (file)
@@ -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 set_state (const XMLNode& node, int version = 3000);
 
   protected:
        boost::shared_ptr<PBD::Controllable> controllable;
index daee40cd44674fe8a236c6ac3b9118bc642fdefa..a32c4696aeec71d9577e90c609576ec81c3e1ef2 100644 (file)
@@ -154,7 +154,7 @@ PowermateControlProtocol::get_state ()
 }
 
 int
-PowermateControlProtocol::set_state (const XMLNode& /*node*/)
+PowermateControlProtocol::set_state (const XMLNode& /*node*/, int /*version*/)
 {
        return 0;
 }
index 6b0a2fbbc3902097516aea5a07fc5c9afa23367f..d03fb1fce4320e87fd1d56ce69099c479b7afd21 100644 (file)
@@ -16,7 +16,7 @@ class PowermateControlProtocol : public ARDOUR::ControlProtocol
        static bool probe ();
 
        XMLNode& get_state ();
-       int set_state (const XMLNode&);
+       int set_state (const XMLNode&, int version = 3000);
 
   private: