summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2009-05-14 00:15:38 +0000
committerCarl Hetherington <carl@carlh.net>2009-05-14 00:15:38 +0000
commit6cf41417a0358d819bd4b5c862caa55ce7acf2cf (patch)
tree6a2082a26d1ca57ed9ce7212a908f59489031ef0 /libs/ardour
parent015fc7b39fab97cee1875231694adce43155ceb5 (diff)
Add missing files from last commit, as per.
git-svn-id: svn://localhost/ardour2/branches/3.0@5076 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour')
-rw-r--r--libs/ardour/ardour/rc_configuration.h92
-rw-r--r--libs/ardour/ardour/rc_configuration_vars.h (renamed from libs/ardour/ardour/configuration_vars.h)36
-rw-r--r--libs/ardour/ardour/session_configuration.h69
-rw-r--r--libs/ardour/ardour/session_configuration_vars.h44
-rw-r--r--libs/ardour/rc_configuration.cc319
-rw-r--r--libs/ardour/session_configuration.cc123
6 files changed, 647 insertions, 36 deletions
diff --git a/libs/ardour/ardour/rc_configuration.h b/libs/ardour/ardour/rc_configuration.h
new file mode 100644
index 0000000000..abf22e4e9d
--- /dev/null
+++ b/libs/ardour/ardour/rc_configuration.h
@@ -0,0 +1,92 @@
+/*
+ Copyright (C) 1999 Paul Davis
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __ardour_rc_configuration_h__
+#define __ardour_rc_configuration_h__
+
+#include <map>
+#include <string>
+
+#include "ardour/types.h"
+#include "ardour/utils.h"
+#include "ardour/configuration.h"
+
+class XMLNode;
+
+namespace ARDOUR {
+
+class RCConfiguration : public Configuration
+{
+ public:
+ RCConfiguration();
+
+ void map_parameters (sigc::slot<void,const char*>);
+ int set_state (XMLNode const &);
+ XMLNode& get_state ();
+ XMLNode& get_variables ();
+ void set_variables (XMLNode const &);
+
+ std::map<std::string, XMLNode> midi_ports;
+
+ int load_state ();
+ int save_state ();
+
+ /// calls Stateful::*instant_xml methods using
+ /// ARDOUR::user_config_directory for the directory argument
+ void add_instant_xml (XMLNode&);
+ XMLNode * instant_xml (const std::string& str);
+
+ XMLNode* control_protocol_state () { return _control_protocol_state; }
+
+ /* define accessor methods */
+
+#undef CONFIG_VARIABLE
+#undef CONFIG_VARIABLE_SPECIAL
+#define CONFIG_VARIABLE(Type,var,name,value) \
+ Type get_##var () const { return var.get(); } \
+ bool set_##var (Type val) { bool ret = var.set (val); if (ret) { ParameterChanged (name); } return ret; }
+#define CONFIG_VARIABLE_SPECIAL(Type,var,name,value,mutator) \
+ Type get_##var () const { return var.get(); } \
+ bool set_##var (Type val) { bool ret = var.set (val); if (ret) { ParameterChanged (name); } return ret; }
+#include "ardour/rc_configuration_vars.h"
+#undef CONFIG_VARIABLE
+#undef CONFIG_VARIABLE_SPECIAL
+
+ private:
+
+ /* declare variables */
+
+#undef CONFIG_VARIABLE
+#undef CONFIG_VARIABLE_SPECIAL
+#define CONFIG_VARIABLE(Type,var,name,value) ConfigVariable<Type> var;
+#define CONFIG_VARIABLE_SPECIAL(Type,var,name,value,mutator) ConfigVariableWithMutation<Type> var;
+#include "ardour/rc_configuration_vars.h"
+#undef CONFIG_VARIABLE
+#undef CONFIG_VARIABLE_SPECIAL
+
+ XMLNode* _control_protocol_state;
+};
+
+/* XXX: rename this */
+extern RCConfiguration *Config;
+extern gain_t speed_quietning; /* see comment in configuration.cc */
+
+} // namespace ARDOUR
+
+#endif /* __ardour_configuration_h__ */
diff --git a/libs/ardour/ardour/configuration_vars.h b/libs/ardour/ardour/rc_configuration_vars.h
index f49663b55b..f90cde88c3 100644
--- a/libs/ardour/ardour/configuration_vars.h
+++ b/libs/ardour/ardour/rc_configuration_vars.h
@@ -23,9 +23,6 @@ CONFIG_VARIABLE (bool, auto_connect_master, "auto-connect-master", true)
CONFIG_VARIABLE (AutoConnectOption, output_auto_connect, "output-auto-connect", AutoConnectOption (0))
CONFIG_VARIABLE (AutoConnectOption, input_auto_connect, "input-auto-connect", AutoConnectOption (0))
-CONFIG_VARIABLE (std::string, auditioner_output_left, "auditioner-output-left", "default")
-CONFIG_VARIABLE (std::string, auditioner_output_right, "auditioner-output-right", "default")
-
/* MIDI and MIDI related */
CONFIG_VARIABLE (std::string, mtc_port_name, "mtc-port-name", "default")
@@ -57,8 +54,6 @@ CONFIG_VARIABLE (float, midi_readahead, "midi-readahead", 1.0)
CONFIG_VARIABLE (float, audio_track_buffer_seconds, "track-buffer-seconds", 5.0)
CONFIG_VARIABLE (float, midi_track_buffer_seconds, "midi-track-buffer-seconds", 1.0)
CONFIG_VARIABLE (uint32_t, disk_choice_space_threshold, "disk-choice-space-threshold", 57600000)
-CONFIG_VARIABLE (SampleFormat, native_file_data_format, "native-file-data-format", ARDOUR::FormatFloat)
-CONFIG_VARIABLE (HeaderFormat, native_file_header_format, "native-file-header-format", ARDOUR::WAVE)
CONFIG_VARIABLE (bool, auto_analyse_audio, "auto-analyse-audio", false)
/* OSC */
@@ -66,21 +61,9 @@ CONFIG_VARIABLE (bool, auto_analyse_audio, "auto-analyse-audio", false)
CONFIG_VARIABLE (uint32_t, osc_port, "osc-port", 3819)
CONFIG_VARIABLE (bool, use_osc, "use-osc", false)
-/* fades, crossfades */
-
-CONFIG_VARIABLE (CrossfadeModel, xfade_model, "xfade-model", FullCrossfade)
-CONFIG_VARIABLE (bool, auto_xfade, "auto-xfade", true)
-CONFIG_VARIABLE (float, short_xfade_seconds, "short-xfade-seconds", 0.015)
-CONFIG_VARIABLE (bool, xfades_active, "xfades-active", true)
-CONFIG_VARIABLE (bool, xfades_visible, "xfades-visible", true)
-CONFIG_VARIABLE (uint32_t, destructive_xfade_msecs, "destructive-xfade-msecs", 2)
-CONFIG_VARIABLE (bool, use_region_fades, "use-region-fades", true)
-CONFIG_VARIABLE (bool, show_region_fades, "show-region-fades", true)
-
/* editing related */
CONFIG_VARIABLE (EditMode, edit_mode, "edit-mode", Slide)
-CONFIG_VARIABLE (LayerModel, layer_model, "layer-model", MoveAddHigher)
CONFIG_VARIABLE (bool, link_region_and_track_selection, "link-region-and-track-selection", false)
CONFIG_VARIABLE (std::string, keyboard_layout_name, "keyboard-layout-name", "ansi")
CONFIG_VARIABLE (bool, automation_follows_regions, "automation-follows-regions", false)
@@ -110,11 +93,6 @@ CONFIG_VARIABLE (std::string, click_emphasis_sound, "click-emphasis-sound", "")
/* transport control and related */
-CONFIG_VARIABLE (bool, auto_play, "auto-play", false)
-CONFIG_VARIABLE (bool, auto_return, "auto-return", false)
-CONFIG_VARIABLE (bool, auto_input, "auto-input", true)
-CONFIG_VARIABLE (bool, punch_in, "punch-in", false)
-CONFIG_VARIABLE (bool, punch_out, "punch-out", false)
CONFIG_VARIABLE (bool, plugins_stop_with_transport, "plugins-stop-with-transport", false)
CONFIG_VARIABLE (bool, do_not_record_plugins, "do-not-record-plugins", false)
CONFIG_VARIABLE (bool, stop_recording_on_xrun, "stop-recording-on-xrun", false)
@@ -138,17 +116,13 @@ CONFIG_VARIABLE (bool, locate_while_waiting_for_sync, "locate-while-waiting-for-
/* timecode and sync */
CONFIG_VARIABLE (bool, jack_time_master, "jack-time-master", true)
-CONFIG_VARIABLE (SmpteFormat, smpte_format, "smpte-format", smpte_30)
CONFIG_VARIABLE (bool, use_video_sync, "use-video-sync", false)
-CONFIG_VARIABLE (bool, timecode_source_is_synced, "timecode-source-is-synced", true)
CONFIG_VARIABLE (float, video_pullup, "video-pullup", 0.0f)
/* metering */
CONFIG_VARIABLE (float, meter_hold, "meter-hold", 100.0f)
CONFIG_VARIABLE (float, meter_falloff, "meter-falloff", 27.0f)
-CONFIG_VARIABLE (nframes_t, over_length_short, "over-length-short", 2)
-CONFIG_VARIABLE (nframes_t, over_length_long, "over-length-long", 10)
/* miscellany */
@@ -156,7 +130,6 @@ CONFIG_VARIABLE (bool, hiding_groups_deactivates_groups, "hiding-groups-deactiva
CONFIG_VARIABLE (bool, verify_remove_last_capture, "verify-remove-last-capture", true)
CONFIG_VARIABLE (bool, no_new_session_dialog, "no-new-session-dialog", false)
CONFIG_VARIABLE (bool, use_vst, "use-vst", true)
-CONFIG_VARIABLE (uint32_t, subframes_per_frame, "subframes-per-frame", 100)
CONFIG_VARIABLE (bool, save_history, "save-history", true)
CONFIG_VARIABLE (int32_t, saved_history_depth, "save-history-depth", 20)
CONFIG_VARIABLE (int32_t, history_depth, "history-depth", 20)
@@ -180,12 +153,3 @@ CONFIG_VARIABLE (std::string, default_session_parent_dir, "default-session-paren
CONFIG_VARIABLE (bool, denormal_protection, "denormal-protection", false)
CONFIG_VARIABLE (DenormalModel, denormal_model, "denormal-model", DenormalNone)
-/* BWAV */
-
-CONFIG_VARIABLE (std::string, bwf_country_code, "bwf-country-code", "US")
-CONFIG_VARIABLE (std::string, bwf_organization_code, "bwf-organization-code", "US")
-
-/* these variables have custom set() methods (e.g. path globbing) */
-
-CONFIG_VARIABLE_SPECIAL(Glib::ustring, raid_path, "raid-path", "", path_expand)
-
diff --git a/libs/ardour/ardour/session_configuration.h b/libs/ardour/ardour/session_configuration.h
new file mode 100644
index 0000000000..138702ae84
--- /dev/null
+++ b/libs/ardour/ardour/session_configuration.h
@@ -0,0 +1,69 @@
+/*
+ Copyright (C) 2009 Paul Davis
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __ardour_session_configuration_h__
+#define __ardour_session_configuration_h__
+
+#include "ardour/configuration.h"
+
+namespace ARDOUR {
+
+class SessionConfiguration : public Configuration
+{
+public:
+ SessionConfiguration ();
+
+ void map_parameters (sigc::slot<void, const char*>);
+ int set_state (XMLNode const &);
+ XMLNode& get_state ();
+ XMLNode& get_variables ();
+ void set_variables (XMLNode const &);
+
+ /* define accessor methods */
+
+#undef CONFIG_VARIABLE
+#undef CONFIG_VARIABLE_SPECIAL
+#define CONFIG_VARIABLE(Type,var,name,value) \
+ Type get_##var () const { return var.get(); } \
+ bool set_##var (Type val) { bool ret = var.set (val); if (ret) { ParameterChanged (name); } return ret; }
+#define CONFIG_VARIABLE_SPECIAL(Type,var,name,value,mutator) \
+ Type get_##var () const { return var.get(); } \
+ bool set_##var (Type val) { bool ret = var.set (val); if (ret) { ParameterChanged (name); } return ret; }
+#include "ardour/session_configuration_vars.h"
+#undef CONFIG_VARIABLE
+#undef CONFIG_VARIABLE_SPECIAL
+
+ private:
+
+ /* declare variables */
+
+#undef CONFIG_VARIABLE
+#undef CONFIG_VARIABLE_SPECIAL
+#define CONFIG_VARIABLE(Type,var,name,value) ConfigVariable<Type> var;
+#define CONFIG_VARIABLE_SPECIAL(Type,var,name,value,mutator) ConfigVariableWithMutation<Type> var;
+#include "ardour/session_configuration_vars.h"
+#undef CONFIG_VARIABLE
+#undef CONFIG_VARIABLE_SPECIAL
+
+ int foo;
+};
+
+}
+
+#endif
diff --git a/libs/ardour/ardour/session_configuration_vars.h b/libs/ardour/ardour/session_configuration_vars.h
new file mode 100644
index 0000000000..d99fc031d8
--- /dev/null
+++ b/libs/ardour/ardour/session_configuration_vars.h
@@ -0,0 +1,44 @@
+/*
+ Copyright (C) 2009 Paul Davis
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+CONFIG_VARIABLE (CrossfadeModel, xfade_model, "xfade-model", FullCrossfade)
+CONFIG_VARIABLE (bool, auto_xfade, "auto-xfade", true)
+CONFIG_VARIABLE (float, short_xfade_seconds, "short-xfade-seconds", 0.015)
+CONFIG_VARIABLE (bool, xfades_active, "xfades-active", true)
+CONFIG_VARIABLE (bool, xfades_visible, "xfades-visible", true)
+CONFIG_VARIABLE (uint32_t, destructive_xfade_msecs, "destructive-xfade-msecs", 2)
+CONFIG_VARIABLE (bool, use_region_fades, "use-region-fades", true)
+CONFIG_VARIABLE (bool, show_region_fades, "show-region-fades", true)
+CONFIG_VARIABLE (SampleFormat, native_file_data_format, "native-file-data-format", ARDOUR::FormatFloat)
+CONFIG_VARIABLE (HeaderFormat, native_file_header_format, "native-file-header-format", ARDOUR::WAVE)
+CONFIG_VARIABLE (bool, auto_play, "auto-play", false)
+CONFIG_VARIABLE (bool, auto_return, "auto-return", false)
+CONFIG_VARIABLE (bool, auto_input, "auto-input", true)
+CONFIG_VARIABLE (bool, punch_in, "punch-in", false)
+CONFIG_VARIABLE (bool, punch_out, "punch-out", false)
+CONFIG_VARIABLE (uint32_t, subframes_per_frame, "subframes-per-frame", 100)
+CONFIG_VARIABLE (SmpteFormat, smpte_format, "smpte-format", smpte_30)
+CONFIG_VARIABLE_SPECIAL(Glib::ustring, raid_path, "raid-path", "", path_expand)
+CONFIG_VARIABLE (std::string, bwf_country_code, "bwf-country-code", "US")
+CONFIG_VARIABLE (std::string, bwf_organization_code, "bwf-organization-code", "US")
+CONFIG_VARIABLE (bool, end_marker_is_free, "end-marker-is-free", true)
+CONFIG_VARIABLE (LayerModel, layer_model, "layer-model", MoveAddHigher)
+CONFIG_VARIABLE (std::string, auditioner_output_left, "auditioner-output-left", "default")
+CONFIG_VARIABLE (std::string, auditioner_output_right, "auditioner-output-right", "default")
+CONFIG_VARIABLE (bool, timecode_source_is_synced, "timecode-source-is-synced", true)
diff --git a/libs/ardour/rc_configuration.cc b/libs/ardour/rc_configuration.cc
new file mode 100644
index 0000000000..70c4b785cf
--- /dev/null
+++ b/libs/ardour/rc_configuration.cc
@@ -0,0 +1,319 @@
+/*
+ Copyright (C) 1999-2006 Paul Davis
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <unistd.h>
+#include <cstdio> /* for snprintf, grrr */
+
+#include <glib.h>
+#include <glib/gstdio.h> /* for g_stat() */
+#include <glibmm/miscutils.h>
+
+#include "pbd/failed_constructor.h"
+#include "pbd/xml++.h"
+#include "pbd/filesystem.h"
+#include "pbd/file_utils.h"
+
+#include "midi++/manager.h"
+
+#include "ardour/ardour.h"
+#include "ardour/rc_configuration.h"
+#include "ardour/audio_diskstream.h"
+#include "ardour/control_protocol_manager.h"
+#include "ardour/filesystem_paths.h"
+
+#include "i18n.h"
+
+using namespace ARDOUR;
+using namespace std;
+using namespace PBD;
+
+/* this is global so that we do not have to indirect through an object pointer
+ to reference it.
+*/
+
+namespace ARDOUR {
+ float speed_quietning = 0.251189; // -12dB reduction for ffwd or rewind
+}
+
+RCConfiguration::RCConfiguration ()
+ :
+/* construct variables */
+#undef CONFIG_VARIABLE
+#undef CONFIG_VARIABLE_SPECIAL
+#define CONFIG_VARIABLE(Type,var,name,value) var (name,value),
+#define CONFIG_VARIABLE_SPECIAL(Type,var,name,value,mutator) var (name,value,mutator),
+#include "ardour/rc_configuration_vars.h"
+#undef CONFIG_VARIABLE
+#undef CONFIG_VARIABLE_SPECIAL
+ _control_protocol_state (0)
+{
+}
+
+int
+RCConfiguration::load_state ()
+{
+ bool found = false;
+
+ sys::path system_rc_file;
+ struct stat statbuf;
+
+ /* load system configuration first */
+
+ if (find_file_in_search_path (ardour_search_path() + system_config_search_path(),
+ "ardour_system.rc", system_rc_file) )
+ {
+ XMLTree tree;
+ found = true;
+
+ string rcfile = system_rc_file.to_string();
+
+ /* stupid XML Parser hates empty files */
+
+ if (g_stat (rcfile.c_str(), &statbuf)) {
+ return -1;
+ }
+
+ if (statbuf.st_size != 0) {
+ cerr << string_compose (_("Loading system configuration file %1"), rcfile) << endl;
+
+ if (!tree.read (rcfile.c_str())) {
+ error << string_compose(_("Ardour: cannot read system configuration file \"%1\""), rcfile) << endmsg;
+ return -1;
+ }
+
+ if (set_state (*tree.root())) {
+ error << string_compose(_("Ardour: system configuration file \"%1\" not loaded successfully."), rcfile) << endmsg;
+ return -1;
+ }
+ } else {
+ error << _("your system Ardour configuration file is empty. This probably means that there as an error installing Ardour") << endmsg;
+ }
+ }
+
+ /* now load configuration file for user */
+
+ sys::path user_rc_file;
+
+ if (find_file_in_search_path (ardour_search_path() + user_config_directory(),
+ "ardour.rc", user_rc_file))
+ {
+ XMLTree tree;
+ found = true;
+
+ string rcfile = user_rc_file.to_string();
+
+ /* stupid XML parser hates empty files */
+
+ if (g_stat (rcfile.c_str(), &statbuf)) {
+ return -1;
+ }
+
+ if (statbuf.st_size != 0) {
+ cerr << string_compose (_("Loading user configuration file %1"), rcfile) << endl;
+
+ if (!tree.read (rcfile)) {
+ error << string_compose(_("Ardour: cannot read configuration file \"%1\""), rcfile) << endmsg;
+ return -1;
+ }
+
+ if (set_state (*tree.root())) {
+ error << string_compose(_("Ardour: user configuration file \"%1\" not loaded successfully."), rcfile) << endmsg;
+ return -1;
+ }
+ } else {
+ warning << _("your Ardour configuration file is empty. This is not normal.") << endmsg;
+ }
+ }
+
+ if (!found)
+ error << "Ardour: could not find configuration file (ardour.rc), canvas will look broken." << endmsg;
+
+ return 0;
+}
+
+int
+RCConfiguration::save_state()
+{
+ XMLTree tree;
+
+ try
+ {
+ sys::create_directories (user_config_directory ());
+ }
+ catch (const sys::filesystem_error& ex)
+ {
+ error << "Could not create user configuration directory" << endmsg;
+ return -1;
+ }
+
+ sys::path rcfile_path(user_config_directory());
+
+ rcfile_path /= "ardour.rc";
+ const string rcfile = rcfile_path.to_string();
+
+ // this test seems bogus?
+ if (rcfile.length()) {
+ tree.set_root (&get_state());
+ if (!tree.write (rcfile.c_str())){
+ error << string_compose (_("Config file %1 not saved"), rcfile) << endmsg;
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+void
+RCConfiguration::add_instant_xml(XMLNode& node)
+{
+ Stateful::add_instant_xml (node, user_config_directory ());
+}
+
+XMLNode*
+RCConfiguration::instant_xml(const string& node_name)
+{
+ return Stateful::instant_xml (node_name, user_config_directory ());
+}
+
+
+XMLNode&
+RCConfiguration::get_state ()
+{
+ XMLNode* root;
+ LocaleGuard lg (X_("POSIX"));
+
+ root = new XMLNode("Ardour");
+
+ MIDI::Manager::PortMap::const_iterator i;
+ const MIDI::Manager::PortMap& ports = MIDI::Manager::instance()->get_midi_ports();
+
+ for (i = ports.begin(); i != ports.end(); ++i) {
+ root->add_child_nocopy(i->second->get_state());
+ }
+
+ root->add_child_nocopy (get_variables ());
+
+ if (_extra_xml) {
+ root->add_child_copy (*_extra_xml);
+ }
+
+ root->add_child_nocopy (ControlProtocolManager::instance().get_state());
+
+ return *root;
+}
+
+XMLNode&
+RCConfiguration::get_variables ()
+{
+ XMLNode* node;
+ LocaleGuard lg (X_("POSIX"));
+
+ node = new XMLNode ("Config");
+
+#undef CONFIG_VARIABLE
+#undef CONFIG_VARIABLE_SPECIAL
+#define CONFIG_VARIABLE(type,var,Name,value) \
+ var.add_to_node (*node);
+#define CONFIG_VARIABLE_SPECIAL(type,var,Name,value,mutator) \
+ var.add_to_node (*node);
+#include "ardour/rc_configuration_vars.h"
+#undef CONFIG_VARIABLE
+#undef CONFIG_VARIABLE_SPECIAL
+
+ return *node;
+}
+
+int
+RCConfiguration::set_state (const XMLNode& root)
+{
+ if (root.name() != "Ardour") {
+ return -1;
+ }
+
+ XMLNodeList nlist = root.children();
+ XMLNodeConstIterator niter;
+ XMLNode *node;
+
+ for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
+
+ node = *niter;
+
+ if (node->name() == "MIDI-port") {
+
+ try {
+
+ MIDI::Port::Descriptor desc (*node);
+ map<string,XMLNode>::iterator x;
+ if ((x = midi_ports.find (desc.tag)) != midi_ports.end()) {
+ midi_ports.erase (x);
+ }
+ midi_ports.insert (pair<string,XMLNode>(desc.tag,*node));
+ }
+
+ catch (failed_constructor& err) {
+ warning << _("ill-formed MIDI port specification in ardour rcfile (ignored)") << endmsg;
+ }
+
+ } else if (node->name() == "Config") {
+
+ set_variables (*node);
+
+ } else if (node->name() == "Extra") {
+ _extra_xml = new XMLNode (*node);
+
+ } else if (node->name() == ControlProtocolManager::state_node_name) {
+ _control_protocol_state = new XMLNode (*node);
+ }
+ }
+
+ Diskstream::set_disk_io_chunk_frames (minimum_disk_io_bytes.get() / sizeof (Sample));
+
+ return 0;
+}
+
+void
+RCConfiguration::set_variables (const XMLNode& node)
+{
+#undef CONFIG_VARIABLE
+#undef CONFIG_VARIABLE_SPECIAL
+#define CONFIG_VARIABLE(type,var,name,value) \
+ if (var.set_from_node (node)) { \
+ ParameterChanged (name); \
+ }
+#define CONFIG_VARIABLE_SPECIAL(type,var,name,value,mutator) \
+ if (var.set_from_node (node)) { \
+ ParameterChanged (name); \
+ }
+
+#include "ardour/rc_configuration_vars.h"
+#undef CONFIG_VARIABLE
+#undef CONFIG_VARIABLE_SPECIAL
+
+}
+void
+RCConfiguration::map_parameters (sigc::slot<void,const char*> theSlot)
+{
+#undef CONFIG_VARIABLE
+#undef CONFIG_VARIABLE_SPECIAL
+#define CONFIG_VARIABLE(type,var,name,value) theSlot (name);
+#define CONFIG_VARIABLE_SPECIAL(type,var,name,value,mutator) theSlot (name);
+#include "ardour/rc_configuration_vars.h"
+#undef CONFIG_VARIABLE
+#undef CONFIG_VARIABLE_SPECIAL
+}
diff --git a/libs/ardour/session_configuration.cc b/libs/ardour/session_configuration.cc
new file mode 100644
index 0000000000..00c95d241a
--- /dev/null
+++ b/libs/ardour/session_configuration.cc
@@ -0,0 +1,123 @@
+/*
+ Copyright (C) 2009 Paul Davis
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "ardour/types.h"
+#include "ardour/utils.h"
+#include "ardour/session_configuration.h"
+#include "ardour/ardour.h"
+#include "i18n.h"
+
+using namespace ARDOUR;
+
+SessionConfiguration::SessionConfiguration ()
+ :
+/* construct variables */
+#undef CONFIG_VARIABLE
+#undef CONFIG_VARIABLE_SPECIAL
+#define CONFIG_VARIABLE(Type,var,name,value) var (name,value),
+#define CONFIG_VARIABLE_SPECIAL(Type,var,name,value,mutator) var (name,value,mutator),
+#include "ardour/session_configuration_vars.h"
+#undef CONFIG_VARIABLE
+#undef CONFIG_VARIABLE_SPECIAL
+ foo (0)
+{
+
+}
+
+XMLNode&
+SessionConfiguration::get_state ()
+{
+ XMLNode* root;
+ LocaleGuard lg (X_("POSIX"));
+
+ root = new XMLNode ("Ardour");
+ root->add_child_nocopy (get_variables ());
+
+ return *root;
+}
+
+
+XMLNode&
+SessionConfiguration::get_variables ()
+{
+ XMLNode* node;
+ LocaleGuard lg (X_("POSIX"));
+
+ node = new XMLNode ("Config");
+
+#undef CONFIG_VARIABLE
+#undef CONFIG_VARIABLE_SPECIAL
+#define CONFIG_VARIABLE(type,var,Name,value) \
+ var.add_to_node (*node);
+#define CONFIG_VARIABLE_SPECIAL(type,var,Name,value,mutator) \
+ var.add_to_node (*node);
+#include "ardour/session_configuration_vars.h"
+#undef CONFIG_VARIABLE
+#undef CONFIG_VARIABLE_SPECIAL
+
+ return *node;
+}
+
+
+int
+SessionConfiguration::set_state (XMLNode const& root)
+{
+ if (root.name() != "Ardour") {
+ return -1;
+ }
+
+ for (XMLNodeConstIterator i = root.children().begin(); i != root.children().end(); ++i) {
+ if ((*i)->name() == "Config") {
+ set_variables (**i);
+ }
+ }
+
+ return 0;
+}
+
+void
+SessionConfiguration::set_variables (const XMLNode& node)
+{
+#undef CONFIG_VARIABLE
+#undef CONFIG_VARIABLE_SPECIAL
+#define CONFIG_VARIABLE(type,var,name,value) \
+ if (var.set_from_node (node)) { \
+ ParameterChanged (name); \
+ }
+#define CONFIG_VARIABLE_SPECIAL(type,var,name,value,mutator) \
+ if (var.set_from_node (node)) { \
+ ParameterChanged (name); \
+ }
+
+#include "ardour/session_configuration_vars.h"
+#undef CONFIG_VARIABLE
+#undef CONFIG_VARIABLE_SPECIAL
+
+}
+void
+SessionConfiguration::map_parameters (sigc::slot<void,const char*> theSlot)
+{
+#undef CONFIG_VARIABLE
+#undef CONFIG_VARIABLE_SPECIAL
+#define CONFIG_VARIABLE(type,var,name,value) theSlot (name);
+#define CONFIG_VARIABLE_SPECIAL(type,var,name,value,mutator) theSlot (name);
+#include "ardour/session_configuration_vars.h"
+#undef CONFIG_VARIABLE
+#undef CONFIG_VARIABLE_SPECIAL
+}