} 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);
+ }
}
}
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);
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);
}
int
-AutomationTimeAxisView::set_state (const XMLNode& node)
+AutomationTimeAxisView::set_state (const XMLNode& node, int version)
{
TimeAxisView::set_state (node);
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 ();
}
int
-Editor::set_state (const XMLNode& node)
+Editor::set_state (const XMLNode& node, int version)
{
const XMLProperty* prop;
XMLNode* geometry;
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);
return *node;
}
-int
-Keyboard::set_state (const XMLNode& node)
+int
+Keyboard::set_state (const XMLNode& node, int version)
{
const XMLProperty* prop;
~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;
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;
<< _(" -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")
#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")
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")) {
{ "no-hw-optimizations", 0, 0, 'O' },
{ "sync", 0, 0, 'S' },
{ "curvetest", 1, 0, 'C' },
+ { "save", 1, 0, 'E' },
{ 0, 0, 0, 0 }
};
keybindings_path = optarg;
break;
+ case 'E':
+ immediate_save = optarg;
+ break;
+
default:
return print_help(execname);
}
session_name = argv[optind++];
}
-
return 0;
}
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[]);
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;
}
}
int
-RouteTimeAxisView::set_state (const XMLNode& node)
+RouteTimeAxisView::set_state (const XMLNode& node, int version)
{
TimeAxisView::set_state (node);
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;
}
int
-TimeAxisView::set_state (const XMLNode& node)
+TimeAxisView::set_state (const XMLNode& node, int version)
{
const XMLProperty *prop;
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; }
}
int
-UIConfiguration::set_state (const XMLNode& root)
+UIConfiguration::set_state (const XMLNode& root, int version)
{
if (root.name() != "Ardour") {
return -1;
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&);
}
int
-Amp::set_state (const XMLNode& node)
+Amp::set_state (const XMLNode& node, int version)
{
const XMLProperty* prop;
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);
/* stateful */
XMLNode& get_state(void);
- int set_state(const XMLNode& node);
+ int set_state(const XMLNode& node, int version = 3000);
void monitor_input (bool);
{
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);
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 *);
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; }
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;
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;
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 ();
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 ();
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;
void set_protocol_states (const XMLNode&);
- int set_state (const XMLNode&);
+ int set_state (const XMLNode&, int version = 3000);
XMLNode& get_state (void);
private:
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; }
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 */
/* 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; }
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);
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);
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;
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);
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 */
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);
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;
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; }
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 {
}
Location (const Location& other);
- Location (const XMLNode&);
+ Location (const XMLNode&, int version = 3000);
Location* operator= (const Location& other);
bool locked() const { return _locked; }
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;
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;
/* stateful */
XMLNode& get_state(void);
- int set_state(const XMLNode& node);
+ int set_state(const XMLNode&, int version = 3000);
void monitor_input (bool);
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);
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,
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>);
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;
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; }
{
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,
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);
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 (
sigc::signal<void> MutePointChanged;
XMLNode& get_state();
- int set_state(const XMLNode& node);
+ int set_state(const XMLNode&, int version = 3000);
private:
AutomationList* _automation;
XMLNode& get_state (void);
- int set_state (const XMLNode&);
+ int set_state (const XMLNode&, int version = 3000);
static sigc::signal<void,NamedSelection*> NamedSelectionCreated;
};
namespace ARDOUR {
-class Route;
class Session;
class Panner;
class BufferSet;
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; }
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 ();
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 */
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
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;
{
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);
{
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);
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; }
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
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 &);
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;
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(); }
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; }
/* 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 ();
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;
private:
void init ();
+ int _set_state_2X (const XMLNode&, int);
+ void set_processor_state_2X (XMLNodeList const &, int);
static uint32_t order_key_cnt;
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);
};
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;
Property _properties;
void remove_when_going_away (Route*);
+ int set_state_2X (const XMLNode&, int);
};
} /* namespace */
{
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; }
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(); }
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 ();
}
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
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:
void operator()();
void undo();
XMLNode &get_state();
- int set_state (const XMLNode&);
+ int set_state (const XMLNode&, int version = 3000);
void mark();
protected:
/* edit/mix groups */
- int load_route_groups (const XMLNode&);
+ int load_route_groups (const XMLNode&, int);
std::list<RouteGroup *> _route_groups;
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 */
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 &);
/*** Serialization ***/
XMLNode & get_state ();
- int set_state (const XMLNode &);
+ int set_state (const XMLNode &, int version = 3000);
private:
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 ();
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; }
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 ();
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; }
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;
XMLNode& get_state ();
private:
- int set_state (XMLNode const &);
+ int set_state (XMLNode const &, int version = 3000);
};
}
}
int
-AudioDiskstream::set_state (const XMLNode& node)
+AudioDiskstream::set_state (const XMLNode& node, int version)
{
const XMLProperty* prop;
XMLNodeList nlist = node.children();
}
int
-AudioPlaylist::set_state (const XMLNode& node)
+AudioPlaylist::set_state (const XMLNode& node, int version)
{
XMLNode *child;
XMLNodeList nlist;
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 ()
}
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;
}
}
XMLNode routes ("Routes");
routes.add_child_copy (xml_track);
- session.load_routes (routes);
+ session.load_routes (routes, 3000);
}
bool
}
int
-AudioFileSource::set_state (const XMLNode& node)
+AudioFileSource::set_state (const XMLNode& node, int version)
{
if (Source::set_state (node)) {
return -1;
}
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()
}
int
-AudioSource::set_state (const XMLNode& node)
+AudioSource::set_state (const XMLNode& node, int version)
{
const XMLProperty* prop;
}
int
-AutomationList::set_state (const XMLNode& node)
+AutomationList::set_state (const XMLNode& node, int version)
{
XMLNodeList nlist = node.children();
XMLNode* nsos;
}
int
-ControlProtocolManager::set_state (const XMLNode& node)
+ControlProtocolManager::set_state (const XMLNode& node, int version)
{
XMLNodeList clist;
XMLNodeConstIterator citer;
}
int
-Crossfade::set_state (const XMLNode& node)
+Crossfade::set_state (const XMLNode& node, int version)
{
XMLNodeConstIterator i;
XMLNodeList children;
}
int
-Delivery::set_state (const XMLNode& node)
+Delivery::set_state (const XMLNode& node, int version)
{
const XMLProperty* prop;
}
int
-FileSource::set_state (const XMLNode& node)
+FileSource::set_state (const XMLNode& node, int version)
{
const XMLProperty* prop;
}
int
-InternalReturn::set_state (const XMLNode& node)
+InternalReturn::set_state (const XMLNode& node, int version)
{
return Return::set_state (node);
}
}
int
-InternalSend::set_state (const XMLNode& node)
+InternalSend::set_state (const XMLNode& node, int version)
{
const XMLProperty* prop;
}
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"));
_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));
}
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 ()
{
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;
}
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;
}
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;
}
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) {
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)
{
}
int
-IOProcessor::set_state (const XMLNode& node)
+IOProcessor::set_state (const XMLNode& node, int version)
{
const XMLProperty *prop;
const XMLNode *io_node = 0;
}
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;
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;
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
{
_locked = false;
}
-Location::Location (const XMLNode& node)
+Location::Location (const XMLNode& node, int version)
{
if (set_state (node)) {
throw failed_constructor ();
}
int
-Location::set_state (const XMLNode& node)
+Location::set_state (const XMLNode& node, int version)
{
const XMLProperty *prop;
}
int
-Locations::set_state (const XMLNode& node)
+Locations::set_state (const XMLNode& node, int version)
{
XMLNodeList nlist;
XMLNodeConstIterator niter;
}
int
-MidiDiskstream::set_state (const XMLNode& node)
+MidiDiskstream::set_state (const XMLNode& node, int version)
{
const XMLProperty* prop;
XMLNodeList nlist = node.children();
#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;
}
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;
int
-MidiPlaylist::set_state (const XMLNode& node)
+MidiPlaylist::set_state (const XMLNode& node, int version)
{
in_set_state++;
freeze ();
}
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()
}
int
-MidiSource::set_state (const XMLNode& node)
+MidiSource::set_state (const XMLNode& node, int version)
{
const XMLProperty* prop;
_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)
, _default_channel (0)
, _midi_thru (true)
{
- _set_state(node, false);
+ _set_state (node, version, false);
}
MidiTrack::~MidiTrack ()
}
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;
}
}
int
-MuteMaster::set_state (const XMLNode& node)
+MuteMaster::set_state (const XMLNode& node, int version)
{
const XMLProperty* prop;
}
int
-NamedSelection::set_state (const XMLNode& /*node*/)
+NamedSelection::set_state (const XMLNode& /*node*/, int /*version*/)
{
return 0;
}
}
int
-StreamPanner::set_state (const XMLNode& node)
+StreamPanner::set_state (const XMLNode& node, int version)
{
const XMLProperty* prop;
XMLNodeConstIterator iter;
}
int
-EqualPowerStereoPanner::set_state (const XMLNode& node)
+EqualPowerStereoPanner::set_state (const XMLNode& node, int version)
{
const XMLProperty* prop;
float pos;
}
int
-Multi2dPanner::set_state (const XMLNode& node)
+Multi2dPanner::set_state (const XMLNode& node, int version)
{
const XMLProperty* prop;
float newx,newy;
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.
*/
}
int
-Panner::set_state (const XMLNode& node)
+Panner::set_state (const XMLNode& node, int version)
{
XMLNodeList nlist;
XMLNodeConstIterator niter;
}
int
-Playlist::set_state (const XMLNode& node)
+Playlist::set_state (const XMLNode& node, int version)
{
XMLNode *child;
XMLNodeList nlist;
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();
}
}
int
-PluginInsert::set_state(const XMLNode& node)
+PluginInsert::set_state(const XMLNode& node, int version)
{
XMLNodeList nlist = node.children();
XMLNodeIterator niter;
}
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;
}
prop = node.property ("unique-id");
+ cout << "- ID " << prop->value() << "\n";
if (prop == 0) {
error << _("Plugin has no unique ID field") << endmsg;
return -1;
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;
}
break;
}
}
-
- Processor::set_state (*insert_node);
+
+ Processor::set_state (*insert_node, version);
/* look for port automation node */
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();
}
}
int
-PortInsert::set_state(const XMLNode& node)
+PortInsert::set_state (const XMLNode& node, int version)
{
XMLNodeList nlist = node.children();
XMLNodeIterator niter;
}
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;
}
int
-RCConfiguration::set_state (const XMLNode& root)
+RCConfiguration::set_state (const XMLNode& root, int version)
{
if (root.name() != "Ardour") {
return -1;
}
int
-Region::set_state (const XMLNode& node)
+Region::set_state (const XMLNode& node, int version)
{
const XMLProperty *prop;
Change what_changed = Change (0);
}
int
-Return::set_state(const XMLNode& node)
+Return::set_state (const XMLNode& node, int version)
{
XMLNodeList nlist = node.children();
XMLNodeIterator niter;
_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))
{
init ();
- _set_state (node, false);
+ _set_state (node, version, false);
/* now that we have _meter, its safe to connect to this */
// 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;
}
}
+
+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)
{
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;
}
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;
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 ()
{
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)
{
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) {
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)
{
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();
}
}
int
-Send::set_state(const XMLNode& node)
+Send::set_state (const XMLNode& node, int version)
{
XMLNodeList nlist = node.children();
XMLNodeIterator niter;
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;
}
int
-Session::GlobalRouteStateCommand::set_state (const XMLNode& node)
+Session::GlobalRouteStateCommand::set_state (const XMLNode& node, int version)
{
GlobalRouteBooleanState states;
XMLNodeList nlist;
}
int
-Session::GlobalMeteringStateCommand::set_state (const XMLNode& node)
+Session::GlobalMeteringStateCommand::set_state (const XMLNode& node, int version)
{
GlobalRouteBooleanState states;
XMLNodeList nlist;
int
-SessionConfiguration::set_state (XMLNode const& root)
+SessionConfiguration::set_state (XMLNode const& root, int version)
{
if (root.name() != "Ardour") {
return -1;
}
int
-SessionMetadata::set_state (const XMLNode & state)
+SessionMetadata::set_state (const XMLNode & state, int version)
{
const XMLNodeList & children = state.children();
ustring name;
}
int
-Session::set_state (const XMLNode& node)
+Session::set_state (const XMLNode& node, int version)
{
XMLNodeList nlist;
XMLNode* child;
return -1;
}
+ if ((prop = node.property ("version")) != 0) {
+ version = atoi (prop->value ()) * 1000;
+ }
+
if ((prop = node.property ("name")) != 0) {
_name = prop->value ();
}
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) {
} else if (load_unused_playlists (*child)) {
goto out;
}
-
+
if ((child = find_named_node (node, "NamedSelections")) != 0) {
if (load_named_selections (*child)) {
goto out;
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) {
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;
}
}
int
-Session::load_routes (const XMLNode& node)
+Session::load_routes (const XMLNode& node, int version)
{
XMLNodeList nlist;
XMLNodeConstIterator niter;
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;
}
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);
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;
}
}
}
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);
+ }
}
}
}
int
-SMFSource::set_state (const XMLNode& node)
+SMFSource::set_state (const XMLNode& node, int version)
{
if (Source::set_state (node)) {
return -1;
}
int
-Source::set_state (const XMLNode& node)
+Source::set_state (const XMLNode& node, int version)
{
const XMLProperty* prop;
}
int
-TempoMap::set_state (const XMLNode& node)
+TempoMap::set_state (const XMLNode& node, int version)
{
{
Glib::RWLock::WriterLock lm (lock);
_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;
}
int
-ARDOUR::UserBundle::set_state (XMLNode const & node)
+ARDOUR::UserBundle::set_state (XMLNode const & node, int version)
{
XMLProperty const * name;
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;
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;
}
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;
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;
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;
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);
}
XMLNode& get_state (void);
- int set_state (const XMLNode& a_node);
+ int set_state (const XMLNode&, int version = 3000);
private:
std::string _manufacturer;
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;
int
-Patch::set_state (const XMLNode& node)
+Patch::set_state (const XMLNode& node, int version)
{
assert(node.name() == "Patch");
_number = node.property("Number")->value();
}
int
-Note::set_state (const XMLNode& node)
+Note::set_state (const XMLNode& node, int version)
{
assert(node.name() == "Note");
_number = node.property("Number")->value();
}
int
-NoteNameList::set_state (const XMLNode& node)
+NoteNameList::set_state (const XMLNode& node, int version)
{
assert(node.name() == "NoteNameList");
_name = node.property("Name")->value();
}
int
-PatchBank::set_state (const XMLNode& node)
+PatchBank::set_state (const XMLNode& node, int version)
{
assert(node.name() == "PatchBank");
_name = node.property("Name")->value();
}
int
-ChannelNameSet::set_state (const XMLNode& node)
+ChannelNameSet::set_state (const XMLNode& node, int version)
{
assert(node.name() == "ChannelNameSet");
_name = node.property("Name")->value();
}
int
-CustomDeviceMode::set_state(const XMLNode& a_node)
+CustomDeviceMode::set_state(const XMLNode& a_node, int version)
{
assert(a_node.name() == "CustomDeviceMode");
}
int
-MasterDeviceNames::set_state(const XMLNode& a_node)
+MasterDeviceNames::set_state(const XMLNode& a_node, int version)
{
// cerr << "MasterDeviceNames::set_state Manufacturer" << endl;
// Manufacturer
}
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");
}
int
-Controllable::set_state (const XMLNode& node)
+Controllable::set_state (const XMLNode& node, int version)
{
const XMLProperty* prop = node.property (X_("id"));
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() {}
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; }
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 */
}
int
-GenericMidiControlProtocol::set_state (const XMLNode& node)
+GenericMidiControlProtocol::set_state (const XMLNode& node, int version)
{
XMLNodeList nlist;
XMLNodeConstIterator niter;
bool get_feedback () const;
XMLNode& get_state ();
- int set_state (const XMLNode&);
+ int set_state (const XMLNode&, int version = 3000);
private:
MIDI::Port* _port;
}
int
-MIDIControllable::set_state (const XMLNode& node)
+MIDIControllable::set_state (const XMLNode& node, int version)
{
const XMLProperty* prop;
int xx;
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; }
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;
int set_active (bool yn);
XMLNode& get_state ();
- int set_state (const XMLNode&);
+ int set_state (const XMLNode&, int version = 3000);
static bool probe();
}
int
-OSC::set_state (const XMLNode&)
+OSC::set_state (const XMLNode&, int /*version*/)
{
return 0;
}
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;
}
int
-OSCControllable::set_state (const XMLNode& /*node*/)
+OSCControllable::set_state (const XMLNode& /*node*/, int /*version*/)
{
return 0;
}
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;
}
int
-PowermateControlProtocol::set_state (const XMLNode& /*node*/)
+PowermateControlProtocol::set_state (const XMLNode& /*node*/, int /*version*/)
{
return 0;
}
static bool probe ();
XMLNode& get_state ();
- int set_state (const XMLNode&);
+ int set_state (const XMLNode&, int version = 3000);
private: