summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2006-03-27 01:04:59 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2006-03-27 01:04:59 +0000
commit948caba5889a7425cbca11c2eb339f27f5a27194 (patch)
treed8e59f5d2487abb502a28256319147de707968d7 /libs
parentee7c3042bdb870ea073b69a625b48e30bd6dab94 (diff)
total reimplementation of Configuration object internals to make adding new config vars an order of magnitude simpler. the actual path taken is a bit of a kludge, to put it mildly, but adding a new variable is now basically just one line in configuration_vars.h, and no work is required for serialization to/from ardour.rc.
git-svn-id: svn://localhost/trunk/ardour2@420 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/ardour/configuration.h209
-rw-r--r--libs/ardour/ardour/configuration_variable.h106
-rw-r--r--libs/ardour/ardour/configuration_vars.h43
-rw-r--r--libs/ardour/ardour/filesource.h6
-rw-r--r--libs/ardour/ardour/types.h5
-rw-r--r--libs/ardour/ardour/utils.h1
-rw-r--r--libs/ardour/configuration.cc929
-rw-r--r--libs/ardour/globals.cc1
-rw-r--r--libs/ardour/route_group.cc4
-rw-r--r--libs/ardour/session_butler.cc2
-rw-r--r--libs/ardour/utils.cc35
11 files changed, 261 insertions, 1080 deletions
diff --git a/libs/ardour/ardour/configuration.h b/libs/ardour/ardour/configuration.h
index e61fe29f31..d067bc6e61 100644
--- a/libs/ardour/ardour/configuration.h
+++ b/libs/ardour/ardour/configuration.h
@@ -22,12 +22,15 @@
#define __ardour_configuration_h__
#include <map>
+#include <vector>
#include <sys/types.h>
#include <string>
#include <ardour/types.h>
#include <ardour/stateful.h>
+#include <ardour/utils.h>
+#include <ardour/configuration_variable.h>
class XMLNode;
@@ -54,202 +57,36 @@ class Configuration : public Stateful
int load_state ();
int save_state ();
- XMLNode& option_node (const std::string &, const std::string &);
-
int set_state (const XMLNode&);
XMLNode& get_state (void);
- XMLNode * get_keys() const;
- void set_keys(XMLNode *);
-
- void set_latched_record_enable (bool yn);
- bool get_latched_record_enable();
-
- void set_use_vst (bool yn);
- bool get_use_vst();
-
- bool get_trace_midi_input ();
- void set_trace_midi_input (bool);
-
- bool get_trace_midi_output ();
- void set_trace_midi_output (bool);
-
- std::string get_raid_path();
- void set_raid_path(std::string);
-
- uint32_t get_minimum_disk_io();
- void set_minimum_disk_io(uint32_t);
-
- float get_track_buffer();
- void set_track_buffer(float);
-
- bool does_hiding_groups_deactivates_groups();
- void set_hiding_groups_deactivates_groups(bool);
+ /* define accessor methods */
- std::string get_auditioner_output_left();
- void set_auditioner_output_left(std::string);
+#undef CONFIG_VARIABLE
+#undef CONFIG_VARIABLE_SPECIAL
+#define CONFIG_VARIABLE(Type,var,name,value) \
+ Type get_##var () const { return var.get(); } \
+ void set_##var (Type val) { var.set (val); var.set_is_user (user_configuration); }
+#define CONFIG_VARIABLE_SPECIAL(Type,var,name,value,mutator) \
+ Type get_##var () const { return var.get(); } \
+ void set_##var (Type val) { var.set (val); var.set_is_user (user_configuration); }
+#include "ardour/configuration_vars.h"
+#undef CONFIG_VARIABLE
+#undef CONFIG_VARIABLE_SPECIAL
- std::string get_auditioner_output_right();
- void set_auditioner_output_right(std::string);
-
- bool get_mute_affects_pre_fader();
- void set_mute_affects_pre_fader (bool);
-
- bool get_mute_affects_post_fader();
- void set_mute_affects_post_fader (bool);
-
- bool get_mute_affects_control_outs ();
- void set_mute_affects_control_outs (bool);
-
- bool get_mute_affects_main_outs ();
- void set_mute_affects_main_outs (bool);
-
- bool get_solo_latch ();
- void set_solo_latch (bool);
-
- uint32_t get_disk_choice_space_threshold();
- void set_disk_choice_space_threshold (uint32_t);
-
- std::string get_mmc_port_name();
- void set_mmc_port_name(std::string);
-
- std::string get_mtc_port_name();
- void set_mtc_port_name(std::string);
-
- std::string get_midi_port_name();
- void set_midi_port_name(std::string);
-
- uint32_t get_midi_feedback_interval_ms();
- void set_midi_feedback_interval_ms (uint32_t);
-
- bool get_use_hardware_monitoring();
- void set_use_hardware_monitoring(bool);
-
- bool get_use_sw_monitoring();
- void set_use_sw_monitoring(bool);
-
- bool get_jack_time_master();
- void set_jack_time_master(bool);
-
- bool get_native_format_is_bwf();
- void set_native_format_is_bwf(bool);
-
- bool get_plugins_stop_with_transport();
- void set_plugins_stop_with_transport(bool);
-
- bool get_stop_recording_on_xrun();
- void set_stop_recording_on_xrun(bool);
-
- bool get_verify_remove_last_capture();
- void set_verify_remove_last_capture(bool);
-
- bool get_stop_at_session_end();
- void set_stop_at_session_end(bool);
-
- bool get_seamless_looping();
- void set_seamless_looping(bool);
-
- bool get_auto_xfade();
- void set_auto_xfade (bool);
-
- bool get_no_new_session_dialog();
- void set_no_new_session_dialog(bool);
-
- uint32_t get_timecode_skip_limit ();
- void set_timecode_skip_limit (uint32_t);
-
- bool get_timecode_source_is_synced ();
- void set_timecode_source_is_synced (bool);
-
- gain_t get_quieten_at_speed ();
- void set_quieten_at_speed (gain_t);
-
- uint32_t get_destructive_xfade_msecs ();
- void set_destructive_xfade_msecs (uint32_t, jack_nframes_t sample_rate = 0);
private:
- void set_defaults ();
- std::string get_system_path();
- std::string get_user_path();
- /* this is subject to wordexp, so we need
- to keep the original (user-entered) form
- around. e.g. ~/blah-> /home/foo/blah
- */
-
- std::string raid_path;
- bool raid_path_is_user;
- std::string orig_raid_path;
+ /* declare variables */
- uint32_t minimum_disk_io_bytes;
- bool minimum_disk_io_bytes_is_user;
- float track_buffer_seconds;
- bool track_buffer_seconds_is_user;
- bool hiding_groups_deactivates_groups;
- bool hiding_groups_deactivates_groups_is_user;
- std::string auditioner_output_left;
- bool auditioner_output_left_is_user;
- std::string auditioner_output_right;
- bool auditioner_output_right_is_user;
- bool mute_affects_pre_fader;
- bool mute_affects_pre_fader_is_user;
- bool mute_affects_post_fader;
- bool mute_affects_post_fader_is_user;
- bool mute_affects_control_outs;
- bool mute_affects_control_outs_is_user;
- bool mute_affects_main_outs;
- bool mute_affects_main_outs_is_user;
- bool solo_latch;
- bool solo_latch_is_user;
- uint32_t disk_choice_space_threshold;
- bool disk_choice_space_threshold_is_user;
- std::string mtc_port_name;
- bool mtc_port_name_is_user;
- std::string mmc_port_name;
- bool mmc_port_name_is_user;
- std::string midi_port_name;
- bool midi_port_name_is_user;
- bool use_hardware_monitoring;
- bool use_hardware_monitoring_is_user;
- bool be_jack_time_master;
- bool be_jack_time_master_is_user;
- bool native_format_is_bwf;
- bool native_format_is_bwf_is_user;
- bool trace_midi_input;
- bool trace_midi_input_is_user;
- bool trace_midi_output;
- bool trace_midi_output_is_user;
- bool plugins_stop_with_transport;
- bool plugins_stop_with_transport_is_user;
- bool use_sw_monitoring;
- bool use_sw_monitoring_is_user;
- bool stop_recording_on_xrun;
- bool stop_recording_on_xrun_is_user;
- bool verify_remove_last_capture;
- bool verify_remove_last_capture_is_user;
- bool stop_at_session_end;
- bool stop_at_session_end_is_user;
- bool seamless_looping;
- bool seamless_looping_is_user;
- bool auto_xfade;
- bool auto_xfade_is_user;
- bool no_new_session_dialog;
- bool no_new_session_dialog_is_user;
- uint32_t timecode_skip_limit;
- bool timecode_skip_limit_is_user;
- bool timecode_source_is_synced;
- bool timecode_source_is_synced_is_user;
- bool use_vst; /* always per-user */
- bool quieten_at_speed;
- bool quieten_at_speed_is_user;
- uint32_t midi_feedback_interval_ms;
- bool midi_feedback_interval_ms_is_user;
- bool latched_record_enable;
- bool latched_record_enable_is_user;
- uint32_t destructive_xfade_msecs;
- bool destructive_xfade_msecs_is_user;
+#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/configuration_vars.h"
+#undef CONFIG_VARIABLE
+#undef CONFIG_VARIABLE_SPECIAL
- XMLNode *key_node;
bool user_configuration;
XMLNode& state (bool user_only);
diff --git a/libs/ardour/ardour/configuration_variable.h b/libs/ardour/ardour/configuration_variable.h
new file mode 100644
index 0000000000..cdd9b24284
--- /dev/null
+++ b/libs/ardour/ardour/configuration_variable.h
@@ -0,0 +1,106 @@
+#ifndef __ardour_configuration_variable_h__
+#define __ardour_configuration_variable_h__
+
+#include <sstream>
+#include <ostream>
+
+#include <pbd/xml++.h>
+
+namespace ARDOUR {
+
+class ConfigVariableBase {
+ public:
+ ConfigVariableBase (std::string str) : _name (str), _is_user (false) {}
+ virtual ~ConfigVariableBase() {}
+
+ std::string name() const { return _name; }
+ bool is_user() const { return _is_user; }
+ void set_is_user (bool yn) { _is_user = yn; }
+
+ virtual void add_to_node (XMLNode& node) = 0;
+ virtual bool set_from_node (const XMLNode& node) = 0;
+
+ protected:
+ std::string _name;
+ bool _is_user;
+};
+
+template<class T>
+class ConfigVariable : public ConfigVariableBase
+{
+ public:
+ ConfigVariable (std::string str) : ConfigVariableBase (str) {}
+ ConfigVariable (std::string str, T val) : ConfigVariableBase (str), value (val) {}
+
+ virtual void set (T val) {
+ value = val;
+ }
+
+ T get() const {
+ return value;
+ }
+
+ void add_to_node (XMLNode& node) {
+ std::stringstream ss;
+ ss << value;
+ XMLNode* child = new XMLNode ("Option");
+ child->add_property ("name", _name);
+ child->add_property ("value", ss.str());
+ node.add_child_nocopy (*child);
+ }
+
+ bool set_from_node (const XMLNode& node) {
+ const XMLProperty* prop;
+ XMLNodeList nlist;
+ XMLNodeConstIterator niter;
+ XMLNode* child;
+
+ nlist = node.children();
+
+ for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
+
+ child = *niter;
+
+ if (child->name() == "Option") {
+ if ((prop = child->property ("name")) != 0) {
+ if (prop->value() == _name) {
+ if ((prop = child->property ("value")) != 0) {
+ std::stringstream ss;
+ ss << prop->value();
+ ss >> value;
+ return true;
+ }
+ }
+ }
+ }
+ }
+
+ return false;
+ }
+
+ protected:
+ virtual T get_for_save() { return value; }
+ T value;
+};
+
+template<class T>
+class ConfigVariableWithMutation : public ConfigVariable<T>
+{
+ public:
+ ConfigVariableWithMutation (std::string name, T val, T (*m)(T))
+ : ConfigVariable<T> (name, val), mutator (m) {}
+
+ void set (T val) {
+ unmutated_value = val;
+ ConfigVariable<T>::set (mutator (val));
+ }
+
+ protected:
+ virtual T get_for_save() { return unmutated_value; }
+ T unmutated_value;
+ T (*mutator)(T);
+};
+
+}
+
+#endif /* __ardour_configuration_variable_h__ */
diff --git a/libs/ardour/ardour/configuration_vars.h b/libs/ardour/ardour/configuration_vars.h
new file mode 100644
index 0000000000..9641c43dbd
--- /dev/null
+++ b/libs/ardour/ardour/configuration_vars.h
@@ -0,0 +1,43 @@
+#ifdef __APPLE__
+CONFIG_VARIABLE(std::string, auditioner_output_left, "auditioner-output-left" "coreaudio:Built-in Audio:in1")
+CONFIG_VARIABLE(std::string, auditioner_output_right, "auditioner-output-right", "coreaudio:Built-in Audio:in2")
+#else
+CONFIG_VARIABLE(std::string, auditioner_output_left, "auditioner-output-left", "alsa_pcm:playback_1")
+CONFIG_VARIABLE(std::string, auditioner_output_right, "auditioner-output-right", "alsa_pcm:playback_2")
+#endif
+
+CONFIG_VARIABLE(std::string, mtc_port_name, "mtc-port-name", "default")
+CONFIG_VARIABLE(std::string, mmc_port_name, "mmc-port-name", "default")
+CONFIG_VARIABLE(std::string, midi_port_name, "midi-port-name", "default")
+CONFIG_VARIABLE(uint32_t, minimum_disk_io_bytes, "minimum-disk-io-bytes", 1024 * 256)
+CONFIG_VARIABLE(float, track_buffer_seconds, "track-buffer-seconds", 5.0)
+CONFIG_VARIABLE(bool, hiding_groups_deactivates_groups, "hiding-groups-deactivates-groups", true)
+CONFIG_VARIABLE(bool, mute_affects_pre_fader, "mute-affects-pre-fader", true)
+CONFIG_VARIABLE(bool, mute_affects_post_fader, "mute-affects-post-fader", true)
+CONFIG_VARIABLE(bool, mute_affects_control_outs, "mute-affects-control-outs", true)
+CONFIG_VARIABLE(bool, mute_affects_main_outs, "mute-affects-main-outs", true)
+CONFIG_VARIABLE(bool, solo_latch, "solo-latch", true)
+CONFIG_VARIABLE(bool, use_hardware_monitoring, "use-hardware-monitoring", true)
+CONFIG_VARIABLE(bool, jack_time_master, "jack-time-master", true)
+CONFIG_VARIABLE(bool, native_format_is_bwf, "native-format-is-bwf", true)
+CONFIG_VARIABLE(bool, trace_midi_input, "trace-midi-input", false)
+CONFIG_VARIABLE(bool, trace_midi_output, "trace-midi-output", false)
+CONFIG_VARIABLE(bool, plugins_stop_with_transport, "plugins-stop-with-transport", false)
+CONFIG_VARIABLE(bool, use_sw_monitoring, "use-sw-monitoring", true)
+CONFIG_VARIABLE(bool, stop_recording_on_xrun, "stop-recording-on-xrun", false)
+CONFIG_VARIABLE(bool, verify_remove_last_capture, "verify-remove-last-capture", true)
+CONFIG_VARIABLE(bool, stop_at_session_end, "stop-at-session-end", true)
+CONFIG_VARIABLE(bool, seamless_looping, "seamless-looping", true)
+CONFIG_VARIABLE(bool, auto_xfade, "auto-xfade", true)
+CONFIG_VARIABLE(bool, no_new_session_dialog, "no-new-session-dialog", false)
+CONFIG_VARIABLE(bool, timecode_source_is_synced, "timecode-source-is-synced", true)
+CONFIG_VARIABLE(bool, latched_record_enable, "latched-record-enable", false)
+CONFIG_VARIABLE(bool, use_vst, "use-vst", true)
+CONFIG_VARIABLE(bool, quieten_at_speed, "quieten-at-speed", true)
+CONFIG_VARIABLE(uint32_t, midi_feedback_interval_ms, "midi-feedback-interval-ms", 100)
+CONFIG_VARIABLE(uint32_t, disk_choice_space_threshold, "disk-choice-space-threshold", 57600000)
+CONFIG_VARIABLE(uint32_t, destructive_xfade_msecs, "destructive-xfade-msecs", 2)
+
+/* these variables have custom set() methods */
+
+CONFIG_VARIABLE_SPECIAL(std::string, raid_path, "raid-path", "", path_expand)
diff --git a/libs/ardour/ardour/filesource.h b/libs/ardour/ardour/filesource.h
index c7ae97c281..df9cc46b91 100644
--- a/libs/ardour/ardour/filesource.h
+++ b/libs/ardour/ardour/filesource.h
@@ -44,12 +44,6 @@ namespace ARDOUR {
class FileSource : public Source {
public:
- enum SampleFormat
- {
- FormatFloat = 0,
- FormatInt24
- };
-
FileSource (string path, jack_nframes_t rate, bool repair_first = false, SampleFormat samp_format=FormatFloat);
FileSource (const XMLNode&, jack_nframes_t rate);
~FileSource ();
diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h
index c7e5faa21e..ae0353cc01 100644
--- a/libs/ardour/ardour/types.h
+++ b/libs/ardour/ardour/types.h
@@ -242,6 +242,11 @@ namespace ARDOUR {
volatile float progress;
pthread_t thread;
};
+
+ enum SampleFormat {
+ FormatFloat = 0,
+ FormatInt24
+ };
};
diff --git a/libs/ardour/ardour/utils.h b/libs/ardour/ardour/utils.h
index 2fc6fa6e50..3a9905b3ac 100644
--- a/libs/ardour/ardour/utils.h
+++ b/libs/ardour/ardour/utils.h
@@ -53,5 +53,6 @@ int touch_file(std::string path);
uint32_t long get_uid();
std::string region_name_from_path (std::string path);
+std::string path_expand (std::string);
#endif /* __ardour_utils_h__ */
diff --git a/libs/ardour/configuration.cc b/libs/ardour/configuration.cc
index c925525144..1581e5216e 100644
--- a/libs/ardour/configuration.cc
+++ b/libs/ardour/configuration.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1999 Paul Davis
+ 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
@@ -21,10 +21,6 @@
#include <unistd.h>
#include <cstdio> /* for snprintf, grrr */
-#ifdef HAVE_WORDEXP
-#include <wordexp.h>
-#endif
-
#include <pbd/failed_constructor.h>
#include <pbd/xml++.h>
@@ -47,26 +43,22 @@ namespace ARDOUR {
}
Configuration::Configuration ()
-{
- key_node = 0;
- user_configuration = false;
- set_defaults ();
-}
+ :
+/* 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/configuration_vars.h"
+#undef CONFIG_VARIABLE
+#undef CONFIG_VARIABLE_SPECIAL
-Configuration::~Configuration ()
+ user_configuration (false)
{
}
-
-string
-Configuration::get_user_path()
-{
- return find_config_file ("ardour.rc");
-}
-string
-Configuration::get_system_path()
+Configuration::~Configuration ()
{
- return find_config_file ("ardour_system.rc");
}
int
@@ -76,11 +68,13 @@ Configuration::load_state ()
/* load system configuration first */
- rcfile = get_system_path ();
+ rcfile = find_config_file ("ardour_system.rc");
if (rcfile.length()) {
XMLTree tree;
+
+ 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;
@@ -99,20 +93,21 @@ Configuration::load_state ()
/* now load configuration file for user */
- rcfile = get_user_path ();
+ rcfile = find_config_file ("ardour.rc");
if (rcfile.length()) {
XMLTree tree;
+ 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: configuration file \"%1\" not loaded successfully."), rcfile) << endmsg;
+ error << string_compose(_("Ardour: user configuration file \"%1\" not loaded successfully."), rcfile) << endmsg;
return -1;
}
}
@@ -130,12 +125,13 @@ Configuration::save_state()
only saves variables marked as user-set or modified
*/
- rcfile = find_config_file("ardour.rc");
+ rcfile = get_user_ardour_path ();
+ rcfile += "ardour.rc";
if (rcfile.length()) {
tree.set_root (&state (true));
if (!tree.write (rcfile.c_str())){
- error << _("Config file not saved") << endmsg;
+ error << string_compose (_("Config file %1 not saved"), rcfile) << endmsg;
return -1;
}
}
@@ -161,122 +157,19 @@ Configuration::state (bool user_only)
}
XMLNode* node = new XMLNode("Config");
- char buf[32];
- if (!user_only || minimum_disk_io_bytes_is_user) {
- snprintf(buf, sizeof(buf), "%" PRIu32 , minimum_disk_io_bytes);
- node->add_child_nocopy(option_node("minimum-disk-io-bytes", string(buf)));
- }
- if (!user_only || track_buffer_seconds_is_user) {
- snprintf(buf, sizeof(buf), "%f", track_buffer_seconds);
- node->add_child_nocopy(option_node("track-buffer-seconds", string(buf)));
- }
- if (!user_only || disk_choice_space_threshold_is_user) {
- snprintf(buf, sizeof(buf), "%" PRIu32, disk_choice_space_threshold);
- node->add_child_nocopy(option_node("disk-choice-space-threshold", string(buf)));
- }
-
- if (!user_only || midi_feedback_interval_ms_is_user) {
- snprintf(buf, sizeof(buf), "%" PRIu32, midi_feedback_interval_ms);
- node->add_child_nocopy(option_node("midi-feedback-interval-ms", string(buf)));
- }
-
- if (!user_only || mute_affects_pre_fader_is_user) {
- node->add_child_nocopy(option_node("mute-affects-pre-fader", mute_affects_pre_fader?"yes":"no"));
- }
- if (!user_only || mute_affects_post_fader_is_user) {
- node->add_child_nocopy(option_node("mute-affects-post-fader", mute_affects_post_fader?"yes":"no"));
- }
- if (!user_only || mute_affects_control_outs_is_user) {
- node->add_child_nocopy(option_node("mute-affects-control-outs", mute_affects_control_outs?"yes":"no"));
- }
- if (!user_only || mute_affects_main_outs_is_user) {
- node->add_child_nocopy(option_node("mute-affects-main-outs", mute_affects_main_outs?"yes":"no"));
- }
- if (!user_only || solo_latch_is_user) {
- node->add_child_nocopy(option_node("solo-latch", solo_latch?"yes":"no"));
- }
- if (!user_only || raid_path_is_user) {
- node->add_child_nocopy(option_node("raid-path", orig_raid_path));
- }
- if (!user_only || mtc_port_name_is_user) {
- node->add_child_nocopy(option_node("mtc-port", mtc_port_name));
- }
- if (!user_only || mmc_port_name_is_user) {
- node->add_child_nocopy(option_node("mmc-port", mmc_port_name));
- }
- if (!user_only || midi_port_name_is_user) {
- node->add_child_nocopy(option_node("midi-port", midi_port_name));
- }
- if (!user_only || use_hardware_monitoring_is_user) {
- node->add_child_nocopy(option_node("hardware-monitoring", use_hardware_monitoring?"yes":"no"));
- }
- if (!user_only || be_jack_time_master_is_user) {
- node->add_child_nocopy(option_node("jack-time-master", be_jack_time_master?"yes":"no"));
- }
- if (!user_only || native_format_is_bwf_is_user) {
- node->add_child_nocopy(option_node("native-format-bwf", native_format_is_bwf?"yes":"no"));
- }
- if (!user_only || trace_midi_input_is_user) {
- node->add_child_nocopy(option_node("trace-midi-input", trace_midi_input?"yes":"no"));
- }
- if (!user_only || trace_midi_output_is_user) {
- node->add_child_nocopy(option_node("trace-midi-output", trace_midi_output?"yes":"no"));
- }
- if (!user_only || plugins_stop_with_transport_is_user) {
- node->add_child_nocopy(option_node("plugins-stop-with-transport", plugins_stop_with_transport?"yes":"no"));
- }
- if (!user_only || use_sw_monitoring_is_user) {
- node->add_child_nocopy(option_node("use-sw-monitoring", use_sw_monitoring?"yes":"no"));
- }
- if (!user_only || stop_recording_on_xrun_is_user) {
- node->add_child_nocopy(option_node("stop-recording-on-xrun", stop_recording_on_xrun?"yes":"no"));
- }
- if (!user_only || verify_remove_last_capture_is_user) {
- node->add_child_nocopy(option_node("verify-remove-last-capture", verify_remove_last_capture?"yes":"no"));
- }
- if (!user_only || stop_at_session_end_is_user) {
- node->add_child_nocopy(option_node("stop-at-session-end", stop_at_session_end?"yes":"no"));
- }
- if (!user_only || seamless_looping_is_user) {
- node->add_child_nocopy(option_node("seamless-loop", seamless_looping?"yes":"no"));
- }
- if (!user_only || auto_xfade_is_user) {
- node->add_child_nocopy(option_node("auto-xfade", auto_xfade?"yes":"no"));
- }
- if (!user_only || no_new_session_dialog_is_user) {
- node->add_child_nocopy(option_node("no-new-session-dialog", no_new_session_dialog?"yes":"no"));
- }
- if (!user_only || timecode_source_is_synced_is_user) {
- node->add_child_nocopy(option_node("timecode-source-is-synced", timecode_source_is_synced?"yes":"no"));
- }
- if (!user_only || auditioner_output_left_is_user) {
- node->add_child_nocopy(option_node("auditioner-left-out", auditioner_output_left));
- }
- if (!user_only || auditioner_output_right_is_user) {
- node->add_child_nocopy(option_node("auditioner-right-out", auditioner_output_right));
- }
- if (!user_only || quieten_at_speed_is_user) {
- snprintf (buf, sizeof (buf), "%f", speed_quietning);
- node->add_child_nocopy(option_node("quieten-at-speed", buf));
- }
- if (!user_only || latched_record_enable_is_user) {
- node->add_child_nocopy(option_node("latched-record-enable", latched_record_enable?"yes":"no"));
- }
- if (!user_only || destructive_xfade_msecs_is_user) {
- snprintf(buf, sizeof(buf), "%" PRIu32, destructive_xfade_msecs);
- node->add_child_nocopy(option_node("destructive-xfade-msecs", string(buf)));
- }
-
- /* use-vst is always per-user */
- node->add_child_nocopy (option_node ("use-vst", use_vst?"yes":"no"));
+#undef CONFIG_VARIABLE
+#undef CONFIG_VARIABLE_SPECIAL
+#define CONFIG_VARIABLE(type,var,name,value) \
+ if (!user_only || var.is_user()) var.add_to_node (*node);
+#define CONFIG_VARIABLE_SPECIAL(type,var,name,value,mutator) \
+ if (!user_only || var.is_user()) var.add_to_node (*node);
+#include "ardour/configuration_vars.h"
+#undef CONFIG_VARIABLE
+#undef CONFIG_VARIABLE_SPECIAL
root->add_child_nocopy (*node);
- if (key_node) {
- root->add_child_copy (*key_node);
- }
-
if (_extra_xml) {
root->add_child_copy (*_extra_xml);
}
@@ -294,7 +187,6 @@ Configuration::set_state (const XMLNode& root)
XMLNodeList nlist = root.children();
XMLNodeConstIterator niter;
XMLNode *node;
- XMLProperty *prop;
for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
@@ -314,206 +206,29 @@ Configuration::set_state (const XMLNode& root)
}
} else if (node->name() == "Config") {
-
- XMLNodeList option_list = node->children();
- XMLNodeConstIterator option_iter;
- XMLNode *option_node;
- string option_name;
- string option_value;
-
- for (option_iter = option_list.begin(); option_iter != option_list.end(); ++option_iter) {
-
- option_node = *option_iter;
-
- if (option_node->name() != "Option") {
- continue;
- }
-
- if ((prop = option_node->property ("name")) != 0) {
- option_name = prop->value();
- } else {
- throw failed_constructor ();
- }
-
- if ((prop = option_node->property ("value")) != 0) {
- option_value = prop->value();
- } else {
- throw failed_constructor ();
- }
-
- if (option_name == "minimum-disk-io-bytes") {
- set_minimum_disk_io (atoi (option_value.c_str()));
- } else if (option_name == "track-buffer-seconds") {
- set_track_buffer (atof (option_value.c_str()));
- } else if (option_name == "raid-path") {
- set_raid_path (option_value);
- } else if (option_name == "hiding-groups-deactivates-groups") {
- set_hiding_groups_deactivates_groups (option_value == "yes");
- } else if (option_name == "mute-affects-pre-fader") {
- set_mute_affects_pre_fader (option_value == "yes");
- } else if (option_name == "mute-affects-post-fader") {
- set_mute_affects_post_fader (option_value == "yes");
- } else if (option_name == "mute-affects-control-outs") {
- set_mute_affects_control_outs (option_value == "yes");
- } else if (option_name == "mute-affects-main-outs") {
- set_mute_affects_main_outs (option_value == "yes");
- } else if (option_name == "solo-latch") {
- set_solo_latch (option_value == "yes");
- } else if (option_name == "mtc-port") {
- set_mtc_port_name (option_value);
- } else if (option_name == "mmc-port") {
- set_mmc_port_name (option_value);
- } else if (option_name == "midi-port") {
- set_midi_port_name (option_value);
- } else if (option_name == "hardware-monitoring") {
- set_use_hardware_monitoring (option_value == "yes");
- } else if (option_name == "jack-time-master") {
- set_jack_time_master (option_value == "yes");
- } else if (option_name == "trace-midi-input") {
- set_trace_midi_input (option_value == "yes");
- } else if (option_name == "trace-midi-output") {
- set_trace_midi_output (option_value == "yes");
- } else if (option_name == "plugins-stop-with-transport") {
- set_plugins_stop_with_transport (option_value == "yes");
- } else if (option_name == "use-sw-monitoring") {
- set_use_sw_monitoring (option_value == "yes");
- } else if (option_name == "no-sw-monitoring") { /* DEPRECATED */
- set_use_sw_monitoring (option_value != "yes");
- } else if (option_name == "stop-recording-on-xrun") {
- set_stop_recording_on_xrun (option_value == "yes");
- } else if (option_name == "verify-remove-last-capture") {
- set_verify_remove_last_capture (option_value == "yes");
- } else if (option_name == "stop-at-session-end") {
- set_stop_at_session_end (option_value == "yes");
- } else if (option_name == "seamless-loop") {
- set_seamless_looping (option_value == "yes");
- } else if (option_name == "auto-xfade") {
- set_auto_xfade (option_value == "yes");
- } else if (option_name == "no-new-session-dialog") {
- set_no_new_session_dialog (option_value == "yes");
- } else if (option_name == "timecode-source-is-synced") {
- set_timecode_source_is_synced (option_value == "yes");
- } else if (option_name == "auditioner-left-out") {
- set_auditioner_output_left (option_value);
- } else if (option_name == "auditioner-right-out") {
- set_auditioner_output_right (option_value);
- } else if (option_name == "use-vst") {
- set_use_vst (option_value == "yes");
- } else if (option_name == "quieten-at-speed") {
- float v;
- if (sscanf (option_value.c_str(), "%f", &v) == 1) {
- set_quieten_at_speed (v);
- }
- } else if (option_name == "midi-feedback-interval-ms") {
- set_midi_feedback_interval_ms (atoi (option_value.c_str()));
- } else if (option_name == "latched-record-enable") {
- set_latched_record_enable (option_value == "yes");
- } else if (option_name == "destructive-xfade-msecs") {
- uint32_t v;
- if (sscanf (option_value.c_str(), "%u", &v) == 1) {
- set_destructive_xfade_msecs (v);
- }
- }
- }
+#undef CONFIG_VARIABLE
+#undef CONFIG_VARIABLE_SPECIAL
+#define CONFIG_VARIABLE(type,var,name,value) \
+ var.set_from_node (*node); \
+ var.set_is_user (user_configuration);
+#define CONFIG_VARIABLE_SPECIAL(type,var,name,value,mutator) \
+ var.set_from_node (*node); \
+ var.set_is_user (user_configuration);
+#include "ardour/configuration_vars.h"
+#undef CONFIG_VARIABLE
+#undef CONFIG_VARIABLE_SPECIAL
- } else if (node->name() == "Keys") {
- /* defer handling of this for UI objects */
- key_node = new XMLNode (*node);
} else if (node->name() == "extra") {
_extra_xml = new XMLNode (*node);
}
}
- DiskStream::set_disk_io_chunk_frames (minimum_disk_io_bytes / sizeof (Sample));
+ DiskStream::set_disk_io_chunk_frames (minimum_disk_io_bytes.get() / sizeof (Sample));
return 0;
}
-void
-Configuration::set_defaults ()
-{
- raid_path = "";
- orig_raid_path = raid_path;
-
- mtc_port_name = N_("default");
- mmc_port_name = N_("default");
- midi_port_name = N_("default");
-#ifdef __APPLE__
- auditioner_output_left = N_("coreaudio:Built-in Audio:in1");
- auditioner_output_right = N_("coreaudio:Built-in Audio:in2");
-#else
- auditioner_output_left = N_("alsa_pcm:playback_1");
- auditioner_output_right = N_("alsa_pcm:playback_2");
-#endif
- minimum_disk_io_bytes = 1024 * 256;
- track_buffer_seconds = 5.0;
- hiding_groups_deactivates_groups = true;
- mute_affects_pre_fader = 1;
- mute_affects_post_fader = 1;
- mute_affects_control_outs = 1;
- mute_affects_main_outs = 1;
- solo_latch = 1;
- use_hardware_monitoring = true;
- be_jack_time_master = true;
- native_format_is_bwf = true;
- trace_midi_input = false;
- trace_midi_output = false;
- plugins_stop_with_transport = false;
- use_sw_monitoring = true;
- stop_recording_on_xrun = false;
- verify_remove_last_capture = true;
- stop_at_session_end = true;
- seamless_looping = true;
- auto_xfade = true;
- no_new_session_dialog = false;
- timecode_source_is_synced = true;
- use_vst = true; /* if we build with VST_SUPPORT, otherwise no effect */
- quieten_at_speed = true;
- destructive_xfade_msecs = 2;
-
- midi_feedback_interval_ms = 100;
-
- // this is about 5 minutes at 48kHz, 4 bytes/sample
- disk_choice_space_threshold = 57600000;
-
- /* at this point, no variables from from the user */
-
- raid_path_is_user = false;
- minimum_disk_io_bytes_is_user = false;
- track_buffer_seconds_is_user = false;
- hiding_groups_deactivates_groups_is_user = false;
- auditioner_output_left_is_user = false;
- auditioner_output_right_is_user = false;
- mute_affects_pre_fader_is_user = false;
- mute_affects_post_fader_is_user = false;
- mute_affects_control_outs_is_user = false;
- mute_affects_main_outs_is_user = false;
- solo_latch_is_user = false;
- disk_choice_space_threshold_is_user = false;
- mtc_port_name_is_user = false;
- mmc_port_name_is_user = false;
- midi_port_name_is_user = false;
- use_hardware_monitoring_is_user = false;
- be_jack_time_master_is_user = false;
- native_format_is_bwf_is_user = false;
- trace_midi_input_is_user = false;
- trace_midi_output_is_user = false;
- plugins_stop_with_transport_is_user = false;
- use_sw_monitoring_is_user = false;
- stop_recording_on_xrun_is_user = false;
- verify_remove_last_capture_is_user = false;
- stop_at_session_end_is_user = false;
- seamless_looping_is_user = false;
- auto_xfade_is_user = false;
- no_new_session_dialog_is_user = false;
- timecode_source_is_synced_is_user = false;
- quieten_at_speed_is_user = false;
- midi_feedback_interval_ms_is_user = false;
- latched_record_enable_is_user = false;
- destructive_xfade_msecs_is_user = false;
-}
-
Configuration::MidiPortDescriptor::MidiPortDescriptor (const XMLNode& node)
{
const XMLProperty *prop;
@@ -560,559 +275,3 @@ Configuration::MidiPortDescriptor::get_state()
return *root;
}
-XMLNode&
-Configuration::option_node(const string & name, const string & value)
-{
- XMLNode* root = new XMLNode("Option");
-
- root->add_property("name", name);
- root->add_property("value", value);
-
- return *root;
-}
-
-string
-Configuration::get_raid_path()
-{
- return raid_path;
-}
-
-void
-Configuration::set_raid_path(string path)
-{
-#ifdef HAVE_WORDEXP
- /* Handle tilde and environment variable expansion in session path */
- wordexp_t expansion;
- switch (wordexp (path.c_str(), &expansion, WRDE_NOCMD|WRDE_UNDEF)) {
- case 0:
- break;
- default:
- error << _("illegal or badly-formed string used for RAID path") << endmsg;
- return;
- }
-
- if (expansion.we_wordc > 1) {
- error << _("RAID search path is ambiguous") << endmsg;
- return;
- }
-
- raid_path = expansion.we_wordv[0];
- orig_raid_path = path;
- wordfree (&expansion);
-#else
- raid_path = orig_raid_path = path;
-#endif
-
- if (user_configuration) {
- raid_path_is_user = true;
- }
-}
-
-uint32_t
-Configuration::get_minimum_disk_io()
-{
- return minimum_disk_io_bytes;
-}
-
-void
-Configuration::set_minimum_disk_io(uint32_t min)
-{
- minimum_disk_io_bytes = min;
- if (user_configuration) {
- minimum_disk_io_bytes_is_user = true;
- }
-}
-
-float
-Configuration::get_track_buffer()
-{
- return track_buffer_seconds;
-}
-
-void
-Configuration::set_track_buffer(float buffer)
-{
- track_buffer_seconds = buffer;
- if (user_configuration) {
- track_buffer_seconds_is_user = true;
- }
-}
-
-bool
-Configuration::does_hiding_groups_deactivates_groups()
-{
- return hiding_groups_deactivates_groups;
-}
-
-void
-Configuration::set_hiding_groups_deactivates_groups(bool hiding)
-{
- hiding_groups_deactivates_groups = hiding;
- if (user_configuration) {
- hiding_groups_deactivates_groups_is_user = true;
- }
-}
-
-string
-Configuration::get_auditioner_output_left ()
-{
- return auditioner_output_left;
-}
-
-void
-Configuration::set_auditioner_output_left (string str)
-{
- auditioner_output_left = str;
- if (user_configuration) {
- auditioner_output_left_is_user = true;
- }
-}
-
-string
-Configuration::get_auditioner_output_right ()
-{
- return auditioner_output_right;
-}
-
-void
-Configuration::set_auditioner_output_right (string str)
-{
- auditioner_output_right = str;
- if (user_configuration) {
- auditioner_output_right_is_user = true;
- }
-}
-
-bool
-Configuration::get_mute_affects_pre_fader()
-{
- return mute_affects_pre_fader;
-}
-
-void
-Configuration::set_mute_affects_pre_fader (bool affects)
-{
- mute_affects_pre_fader = affects;
- if (user_configuration) {
- mute_affects_pre_fader_is_user = true;
- }
-}
-
-bool
-Configuration::get_mute_affects_post_fader()
-{
- return mute_affects_post_fader;
-}
-
-void
-Configuration::set_mute_affects_post_fader (bool affects)
-{
- mute_affects_post_fader = affects;
- if (user_configuration) {
- mute_affects_post_fader_is_user = true;
- }
-}
-
-bool
-Configuration::get_mute_affects_control_outs()
-{
- return mute_affects_control_outs;
-}
-
-void
-Configuration::set_mute_affects_control_outs (bool affects)
-{
- mute_affects_control_outs = affects;
- if (user_configuration) {
- mute_affects_control_outs_is_user = true;
- }
-}
-
-bool
-Configuration::get_mute_affects_main_outs()
-{
- return mute_affects_main_outs;
-}
-
-void
-Configuration::set_mute_affects_main_outs (bool affects)
-{
- mute_affects_main_outs = affects;
- if (user_configuration) {
- mute_affects_main_outs_is_user = true;
- }
-}
-
-bool
-Configuration::get_solo_latch()
-{
- return solo_latch;
-}
-
-void
-Configuration::set_solo_latch (bool latch)
-{
- solo_latch = latch;
- if (user_configuration) {
- solo_latch_is_user = true;
- }
-}
-
-XMLNode *
-Configuration::get_keys () const
-{
- return key_node;
-}
-
-void
-Configuration::set_keys (XMLNode* keys)
-{
- key_node = keys;
-}
-
-uint32_t
-Configuration::get_disk_choice_space_threshold ()
-{
- return disk_choice_space_threshold;
-}
-
-void
-Configuration::set_disk_choice_space_threshold (uint32_t val)
-{
- disk_choice_space_threshold = val;
- if (user_configuration) {
- disk_choice_space_threshold_is_user = true;
- }
-}
-
-string
-Configuration::get_mmc_port_name ()
-{
- return mmc_port_name;
-}
-
-void
-Configuration::set_mmc_port_name (string name)
-{
- mmc_port_name = name;
- if (user_configuration) {
- mmc_port_name_is_user = true;
- }
-}
-
-string
-Configuration::get_mtc_port_name ()
-{
- return mtc_port_name;
-}
-
-void
-Configuration::set_mtc_port_name (string name)
-{
- mtc_port_name = name;
- if (user_configuration) {
- mtc_port_name_is_user = true;
- }
-}
-
-string
-Configuration::get_midi_port_name ()
-{
- return midi_port_name;
-}
-
-void
-Configuration::set_midi_port_name (string name)
-{
- midi_port_name = name;
- if (user_configuration) {
- midi_port_name_is_user = true;
- }
-}
-
-uint32_t
-Configuration::get_midi_feedback_interval_ms ()
-{
- return midi_feedback_interval_ms;
-}
-
-void
-Configuration::set_midi_feedback_interval_ms (uint32_t val)
-{
- midi_feedback_interval_ms = val;
- if (user_configuration) {
- midi_feedback_interval_ms_is_user = true;
- }
-}
-
-bool
-Configuration::get_use_hardware_monitoring()
-{
- return use_hardware_monitoring;
-}
-
-void
-Configuration::set_use_hardware_monitoring(bool yn)
-{
- use_hardware_monitoring = yn;
- if (user_configuration) {
- use_hardware_monitoring_is_user = true;
- }
-}
-
-bool
-Configuration::get_jack_time_master()
-{
- return be_jack_time_master;
-}
-
-void
-Configuration::set_jack_time_master(bool yn)
-{
- be_jack_time_master = yn;
- if (user_configuration) {
- be_jack_time_master_is_user = true;
- }
-}
-
-bool
-Configuration::get_native_format_is_bwf()
-{
- return native_format_is_bwf;
-}
-
-void
-Configuration::set_native_format_is_bwf(bool yn)
-{
- native_format_is_bwf = yn;
- if (user_configuration) {
- native_format_is_bwf_is_user = true;
- }
-}
-
-bool
-Configuration::get_trace_midi_input ()
-{
- return trace_midi_input;
-}
-
-void
-Configuration::set_trace_midi_input (bool yn)
-{
- trace_midi_input = yn;
- if (user_configuration) {
- trace_midi_input_is_user = true;
- }
-}
-
-bool
-Configuration::get_trace_midi_output ()
-{
- return trace_midi_output;
-}
-
-void
-Configuration::set_trace_midi_output (bool yn)
-{
- trace_midi_output = yn;
- if (user_configuration) {
- trace_midi_output_is_user = true;
- }
-}
-
-bool
-Configuration::get_plugins_stop_with_transport ()
-{
- return plugins_stop_with_transport;
-}
-
-void
-Configuration::set_plugins_stop_with_transport (bool yn)
-{
- plugins_stop_with_transport = yn;
- if (user_configuration) {
- plugins_stop_with_transport_is_user = true;
- }
-}
-
-bool
-Configuration::get_use_sw_monitoring ()
-{
- return use_sw_monitoring;
-}
-
-void
-Configuration::set_use_sw_monitoring (bool yn)
-{
- use_sw_monitoring = yn;
- if (user_configuration) {
- use_sw_monitoring_is_user = true;
- }
-}
-
-bool
-Configuration::get_stop_recording_on_xrun ()
-{
- return stop_recording_on_xrun;
-}
-
-void
-Configuration::set_stop_recording_on_xrun (bool yn)
-{
- stop_recording_on_xrun = yn;
- if (user_configuration) {
- stop_recording_on_xrun_is_user = true;
- }
-}
-
-bool
-Configuration::get_verify_remove_last_capture ()
-{
- return verify_remove_last_capture;
-}
-
-void
-Configuration::set_verify_remove_last_capture (bool yn)
-{
- verify_remove_last_capture = yn;
- if (user_configuration) {
- verify_remove_last_capture_is_user = true;
- }
-}
-
-bool
-Configuration::get_stop_at_session_end ()
-{
- return stop_at_session_end;
-}
-
-void
-Configuration::set_stop_at_session_end (bool yn)
-{
- stop_at_session_end = yn;
- if (user_configuration) {
- stop_at_session_end_is_user = true;
- }
-}
-
-bool
-Configuration::get_seamless_looping ()
-{
- return seamless_looping;
-}
-
-void
-Configuration::set_seamless_looping (bool yn)
-{
- seamless_looping = yn;
- if (user_configuration) {
- seamless_looping_is_user = true;
- }
-}
-
-bool
-Configuration::get_auto_xfade ()
-{
- return auto_xfade;
-}
-
-void
-Configuration::set_auto_xfade (bool yn)
-{
- auto_xfade = yn;
- if (user_configuration) {
- auto_xfade_is_user = true;
- }
-}
-
-bool
-Configuration::get_no_new_session_dialog()
-{
- return no_new_session_dialog;
-}
-
-void
-Configuration::set_no_new_session_dialog(bool yn)
-{
- no_new_session_dialog = yn;
- if (user_configuration) {
- no_new_session_dialog_is_user = true;
- }
-}
-
-bool
-Configuration::get_timecode_source_is_synced()
-{
- return timecode_source_is_synced;
-}
-
-void
-Configuration::set_timecode_source_is_synced (bool yn)
-{
- timecode_source_is_synced = yn;
- if (user_configuration) {
- timecode_source_is_synced_is_user = true;
- }
-}
-
-bool
-Configuration::get_use_vst ()
-{
- return use_vst;
-}
-
-void
-Configuration::set_use_vst (bool yn)
-{
- use_vst = yn;
-}
-
-gain_t
-Configuration::get_quieten_at_speed()
-{
- return speed_quietning;
-}
-
-void
-Configuration::set_quieten_at_speed (float gain_coefficient)
-{
- speed_quietning = gain_coefficient;
- if (user_configuration) {
- quieten_at_speed_is_user = true;
- }
-}
-
-void
-Configuration::set_latched_record_enable (bool yn)
-{
- latched_record_enable = yn;
- if (user_configuration) {
- latched_record_enable_is_user = true;
- }
-}
-
-bool
-Configuration::get_latched_record_enable ()
-{
- return latched_record_enable;
-}
-
-uint32_t
-Configuration::get_destructive_xfade_msecs ()
-{
- return destructive_xfade_msecs;
-}
-
-void
-Configuration::set_destructive_xfade_msecs (uint32_t msecs, jack_nframes_t rate)
-{
- destructive_xfade_msecs = msecs;
-
- if (user_configuration) {
- destructive_xfade_msecs_is_user = true;
- }
-
- if (rate) {
- DestructiveFileSource::setup_standard_crossfades (rate);
- }
-}
diff --git a/libs/ardour/globals.cc b/libs/ardour/globals.cc
index e3953860e2..cad9edad8f 100644
--- a/libs/ardour/globals.cc
+++ b/libs/ardour/globals.cc
@@ -389,6 +389,7 @@ string
ARDOUR::find_config_file (string name)
{
char* envvar;
+
if ((envvar = getenv("ARDOUR_CONFIG_PATH")) == 0) {
envvar = CONFIG_DIR;
}
diff --git a/libs/ardour/route_group.cc b/libs/ardour/route_group.cc
index b9d4972277..ae807e66e1 100644
--- a/libs/ardour/route_group.cc
+++ b/libs/ardour/route_group.cc
@@ -190,12 +190,12 @@ RouteGroup::set_hidden (bool yn, void *src)
}
if (yn) {
_flags |= Hidden;
- if (Config->does_hiding_groups_deactivates_groups()) {
+ if (Config->get_hiding_groups_deactivates_groups()) {
_flags &= ~Active;
}
} else {
_flags &= ~Hidden;
- if (Config->does_hiding_groups_deactivates_groups()) {
+ if (Config->get_hiding_groups_deactivates_groups()) {
_flags |= Active;
}
}
diff --git a/libs/ardour/session_butler.cc b/libs/ardour/session_butler.cc
index bec34469ff..cf97e47803 100644
--- a/libs/ardour/session_butler.cc
+++ b/libs/ardour/session_butler.cc
@@ -69,7 +69,7 @@ Session::start_butler_thread ()
{
/* size is in Samples, not bytes */
- dstream_buffer_size = (uint32_t) floor (Config->get_track_buffer() * (float) frame_rate());
+ dstream_buffer_size = (uint32_t) floor (Config->get_track_buffer_seconds() * (float) frame_rate());
Crossfade::set_buffer_size (dstream_buffer_size);
diff --git a/libs/ardour/utils.cc b/libs/ardour/utils.cc
index 003e1c92a3..a5b0b4f2ce 100644
--- a/libs/ardour/utils.cc
+++ b/libs/ardour/utils.cc
@@ -30,6 +30,10 @@
#include <fcntl.h>
#include <unistd.h>
+#ifdef HAVE_WORDEXP
+#include <wordexp.h>
+#endif
+
#include <pbd/error.h>
#include <pbd/xml++.h>
#include <ardour/utils.h>
@@ -222,3 +226,34 @@ region_name_from_path (string path)
return path;
}
+
+string
+path_expand (string path)
+{
+#ifdef HAVE_WORDEXP
+ /* Handle tilde and environment variable expansion in session path */
+ string ret = path;
+
+ wordexp_t expansion;
+ switch (wordexp (path.c_str(), &expansion, WRDE_NOCMD|WRDE_UNDEF)) {
+ case 0:
+ break;
+ default:
+ error << string_compose (_("illegal or badly-formed string used for path (%1)"), path) << endmsg;
+ goto out;
+ }
+
+ if (expansion.we_wordc > 1) {
+ error << string_compose (_("path (%1) is ambiguous"), path) << endmsg;
+ goto out;
+ }
+
+ ret = expansion.we_wordv[0];
+ out:
+ wordfree (&expansion);
+ return ret;
+
+#else
+ return path;
+#endif
+}