diff options
author | Carl Hetherington <carl@carlh.net> | 2009-05-14 00:13:27 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2009-05-14 00:13:27 +0000 |
commit | 015fc7b39fab97cee1875231694adce43155ceb5 (patch) | |
tree | 76dded18cc9441e7325af999358ab3a3235cdb1e /libs/ardour/ardour | |
parent | 0569107ddc0d2a8df6ca0a2c8cc16ebe8f3dee99 (diff) |
First stage of options rework.
- Split Configuration into RCConfiguration and SessionConfiguration;
the first for options which are saved to .rc files and the second
for options which are saved in a session file.
- Move some options from the old `master' Configuration object into
SessionConfiguration; this needs more refinement.
- Reflect many RCConfiguration options in an expanded Edit->Preferences
dialog; my intention is to remove the corresponding menu items
eventually.
git-svn-id: svn://localhost/ardour2/branches/3.0@5075 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/ardour')
-rw-r--r-- | libs/ardour/ardour/ardour.h | 1 | ||||
-rw-r--r-- | libs/ardour/ardour/audio_diskstream.h | 1 | ||||
-rw-r--r-- | libs/ardour/ardour/broadcast_info.h | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/configuration.h | 73 | ||||
-rw-r--r-- | libs/ardour/ardour/configuration_variable.h | 120 | ||||
-rw-r--r-- | libs/ardour/ardour/diskstream.h | 1 | ||||
-rw-r--r-- | libs/ardour/ardour/midi_diskstream.h | 1 | ||||
-rw-r--r-- | libs/ardour/ardour/session.h | 12 | ||||
-rw-r--r-- | libs/ardour/ardour/session_object.h | 1 | ||||
-rw-r--r-- | libs/ardour/ardour/sndfilesource.h | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/types.h | 1 | ||||
-rw-r--r-- | libs/ardour/ardour/utils.h | 14 |
12 files changed, 57 insertions, 172 deletions
diff --git a/libs/ardour/ardour/ardour.h b/libs/ardour/ardour/ardour.h index 7358a7bddb..630bde675c 100644 --- a/libs/ardour/ardour/ardour.h +++ b/libs/ardour/ardour/ardour.h @@ -29,7 +29,6 @@ #include "pbd/error.h" #include "pbd/failed_constructor.h" -#include "ardour/configuration.h" #include "ardour/types.h" // #include <jack/jack.h> need this to inline jack_get_microseconds diff --git a/libs/ardour/ardour/audio_diskstream.h b/libs/ardour/ardour/audio_diskstream.h index be95d737fb..187c97b3e6 100644 --- a/libs/ardour/ardour/audio_diskstream.h +++ b/libs/ardour/ardour/audio_diskstream.h @@ -35,7 +35,6 @@ #include "pbd/rcu.h" #include "ardour/ardour.h" -#include "ardour/configuration.h" #include "ardour/utils.h" #include "ardour/diskstream.h" #include "ardour/audioplaylist.h" diff --git a/libs/ardour/ardour/broadcast_info.h b/libs/ardour/ardour/broadcast_info.h index 8dfb697d08..39ea96c590 100644 --- a/libs/ardour/ardour/broadcast_info.h +++ b/libs/ardour/ardour/broadcast_info.h @@ -68,7 +68,7 @@ class BroadcastInfo void set_time_reference (int64_t when); void set_origination_time (struct tm * now = 0); // if 0, use time generated at construction void set_originator (std::string const & str = ""); - void set_originator_ref (std::string const & str = ""); + void set_originator_ref (Session const &, std::string const & str = ""); /* State info */ diff --git a/libs/ardour/ardour/configuration.h b/libs/ardour/ardour/configuration.h index e8d2685aa1..68944e92e6 100644 --- a/libs/ardour/ardour/configuration.h +++ b/libs/ardour/ardour/configuration.h @@ -1,5 +1,5 @@ /* - Copyright (C) 1999 Paul Davis + 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 @@ -20,16 +20,7 @@ #ifndef __ardour_configuration_h__ #define __ardour_configuration_h__ -#include <map> -#include <vector> - -#include <sys/types.h> -#include <string> - -#include "pbd/stateful.h" - -#include "ardour/types.h" -#include "ardour/utils.h" +#include "pbd/stateful.h" #include "ardour/configuration_variable.h" class XMLNode; @@ -42,65 +33,15 @@ class Configuration : public PBD::Stateful Configuration(); virtual ~Configuration(); - std::map<std::string,XMLNode> midi_ports; - - void map_parameters (sigc::slot<void,const char*> theSlot); - - 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); - - int set_state (const XMLNode&); - XMLNode& get_state (void); - XMLNode& get_variables (sigc::slot<bool,ConfigVariableBase::Owner>, std::string which_node = "Config"); - void set_variables (const XMLNode&, ConfigVariableBase::Owner owner); - - void set_current_owner (ConfigVariableBase::Owner); - - XMLNode* control_protocol_state () { return _control_protocol_state; } + virtual void map_parameters (sigc::slot<void, const char *> s) = 0; + virtual int set_state (XMLNode const &) = 0; + virtual XMLNode & get_state () = 0; + virtual XMLNode & get_variables () = 0; + virtual void set_variables (XMLNode const &) = 0; sigc::signal<void,const char*> ParameterChanged; - - /* 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, current_owner); 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, current_owner); if (ret) { ParameterChanged (name); } return ret; } -#include "ardour/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/configuration_vars.h" -#undef CONFIG_VARIABLE -#undef CONFIG_VARIABLE_SPECIAL - - ConfigVariableBase::Owner current_owner; - XMLNode* _control_protocol_state; - - XMLNode& state (sigc::slot<bool,ConfigVariableBase::Owner>); - bool save_config_options_predicate (ConfigVariableBase::Owner owner); }; -extern Configuration *Config; -extern gain_t speed_quietning; /* see comment in configuration.cc */ - } // namespace ARDOUR #endif /* __ardour_configuration_h__ */ diff --git a/libs/ardour/ardour/configuration_variable.h b/libs/ardour/ardour/configuration_variable.h index 57db525017..6282da2c54 100644 --- a/libs/ardour/ardour/configuration_variable.h +++ b/libs/ardour/ardour/configuration_variable.h @@ -30,29 +30,23 @@ namespace ARDOUR { class ConfigVariableBase { public: - enum Owner { - Default = 0x1, - System = 0x2, - Config = 0x4, - Session = 0x8, - Interface = 0x10 - }; - - ConfigVariableBase (std::string str) : _name (str), _owner (Default) {} - virtual ~ConfigVariableBase() {} - std::string name() const { return _name; } - Owner owner() const { return _owner; } + ConfigVariableBase (std::string str) : _name (str) {} + virtual ~ConfigVariableBase() {} - virtual void add_to_node (XMLNode& node) = 0; - virtual bool set_from_node (const XMLNode& node, Owner owner) = 0; + std::string name () const { return _name; } + void add_to_node (XMLNode&); + bool set_from_node (XMLNode const &); + + virtual std::string get_as_string () const = 0; + virtual void set_from_string (std::string const &) = 0; void show_stored_value (const std::string&); - static void set_show_stored_values (bool yn); + + static void set_show_stored_values (bool); protected: std::string _name; - Owner _owner; static bool show_stores; void notify (); @@ -63,94 +57,34 @@ 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 bool set (T val, Owner owner = ARDOUR::ConfigVariableBase::Config) { + T get() const { + return value; + } + + std::string get_as_string () const { + std::stringstream ss; + ss << value; + return ss.str (); + } + + virtual bool set (T val) { if (val == value) { miss (); return false; } value = val; - _owner = (ConfigVariableBase::Owner)(_owner |owner); notify (); return true; } - T get() const { - return value; - } - - void add_to_node (XMLNode& node) { + void set_from_string (std::string const & s) { std::stringstream ss; - ss << value; - show_stored_value (ss.str()); - 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, Owner owner) { - - if (node.name() == "Config") { - - /* ardour.rc */ - - 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; - _owner = (ConfigVariableBase::Owner)(_owner |owner); - return true; - } - } - } - } - } - - } else if (node.name() == "Options") { - - /* session file */ - - XMLNodeList olist; - XMLNodeConstIterator oiter; - XMLNode* option; - const XMLProperty* opt_prop; - - olist = node.children(); - - for (oiter = olist.begin(); oiter != olist.end(); ++oiter) { - - option = *oiter; - - if (option->name() == _name) { - if ((opt_prop = option->property ("val")) != 0) { - std::stringstream ss; - ss << opt_prop->value(); - ss >> value; - _owner = (ConfigVariableBase::Owner)(_owner |owner); - return true; - } - } - } - } - - return false; + ss << s; + ss >> value; } protected: @@ -165,10 +99,10 @@ class ConfigVariableWithMutation : public ConfigVariable<T> ConfigVariableWithMutation (std::string name, T val, T (*m)(T)) : ConfigVariable<T> (name, val), mutator (m) {} - bool set (T val, ConfigVariableBase::Owner owner) { + bool set (T val) { if (unmutated_value != val) { unmutated_value = val; - return ConfigVariable<T>::set (mutator (val), owner); + return ConfigVariable<T>::set (mutator (val)); } return false; } diff --git a/libs/ardour/ardour/diskstream.h b/libs/ardour/ardour/diskstream.h index a78f2e23a7..f6471e300a 100644 --- a/libs/ardour/ardour/diskstream.h +++ b/libs/ardour/ardour/diskstream.h @@ -39,7 +39,6 @@ #include "pbd/statefuldestructible.h" #include "ardour/ardour.h" -#include "ardour/configuration.h" #include "ardour/location.h" #include "ardour/session_object.h" #include "ardour/types.h" diff --git a/libs/ardour/ardour/midi_diskstream.h b/libs/ardour/ardour/midi_diskstream.h index d5c2d0cdb3..872ffb78e3 100644 --- a/libs/ardour/ardour/midi_diskstream.h +++ b/libs/ardour/ardour/midi_diskstream.h @@ -36,7 +36,6 @@ #include "pbd/ringbufferNPT.h" #include "ardour/ardour.h" -#include "ardour/configuration.h" #include "ardour/diskstream.h" #include "ardour/midi_playlist.h" #include "ardour/midi_ring_buffer.h" diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 344b79bcd1..fc879b45a3 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -51,7 +51,8 @@ #include "ardour/ardour.h" #include "ardour/chan_count.h" -#include "ardour/configuration.h" +#include "ardour/rc_configuration.h" +#include "ardour/session_configuration.h" #include "ardour/location.h" #include "ardour/smpte.h" @@ -388,7 +389,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable void goto_end () { request_locate (end_location->start(), false);} void goto_start () { request_locate (start_location->start(), false); } void set_session_start (nframes_t start) { start_location->set_start(start); } - void set_session_end (nframes_t end) { end_location->set_start(end); _end_location_is_free = false; } + void set_session_end (nframes_t end) { end_location->set_start(end); config.set_end_marker_is_free (false); } void use_rf_shuttle_speed (); void allow_auto_play (bool yn); void request_transport_speed (double speed); @@ -967,6 +968,8 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable SessionMetadata & metadata () { return *_metadata; } + SessionConfiguration config; + protected: friend class AudioEngine; void set_block_size (nframes_t nframes); @@ -1038,7 +1041,6 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable bool _have_captured; float _meter_hold; float _meter_falloff; - bool _end_location_is_free; void set_worst_io_latencies (); void set_worst_io_latencies_x (IOChange asifwecare, void *ignored) { @@ -1111,7 +1113,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable if (actively_recording()) { return true; } else { - if (Config->get_auto_input()) { + if (config.get_auto_input()) { return false; } else { return true; @@ -1173,9 +1175,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable void auto_save(); int load_options (const XMLNode&); - XMLNode& get_options () const; int load_state (std::string snapshot_name); - bool save_config_options_predicate (ConfigVariableBase::Owner owner) const; nframes_t _last_roll_location; nframes_t _last_record_location; diff --git a/libs/ardour/ardour/session_object.h b/libs/ardour/ardour/session_object.h index 1a6a79ceee..7a05ab16b0 100644 --- a/libs/ardour/ardour/session_object.h +++ b/libs/ardour/ardour/session_object.h @@ -27,7 +27,6 @@ namespace ARDOUR { class Session; - /** An object associated with a Session. * * This is a few common things factored out of IO which weren't IO specific diff --git a/libs/ardour/ardour/sndfilesource.h b/libs/ardour/ardour/sndfilesource.h index d50dbad664..7d04e7de25 100644 --- a/libs/ardour/ardour/sndfilesource.h +++ b/libs/ardour/ardour/sndfilesource.h @@ -57,7 +57,7 @@ class SndFileSource : public AudioFileSource { bool one_of_several_channels () const; - static void setup_standard_crossfades (nframes_t sample_rate); + static void setup_standard_crossfades (Session const &, nframes_t sample_rate); static const Source::Flag default_writable_flags; static int get_soundfile_info (const Glib::ustring& path, SoundFileInfo& _info, std::string& error_msg); diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h index 2ed5e0e365..cdec0c5fab 100644 --- a/libs/ardour/ardour/types.h +++ b/libs/ardour/ardour/types.h @@ -336,6 +336,7 @@ namespace ARDOUR { }; enum AutoConnectOption { + ManualConnect = 0x0, AutoConnectPhysical = 0x1, AutoConnectMaster = 0x2 }; diff --git a/libs/ardour/ardour/utils.h b/libs/ardour/ardour/utils.h index eecde2e85f..fc5d98115f 100644 --- a/libs/ardour/ardour/utils.h +++ b/libs/ardour/ardour/utils.h @@ -63,6 +63,20 @@ ARDOUR::SlaveSource string_to_slave_source (std::string str); const char* edit_mode_to_string (ARDOUR::EditMode); ARDOUR::EditMode string_to_edit_mode (std::string); + +/* I don't really like hard-coding these falloff rates here + * Probably should use a map of some kind that could be configured + * These rates are db/sec. +*/ + +#define METER_FALLOFF_OFF 0.0f +#define METER_FALLOFF_SLOWEST 6.6f // BBC standard +#define METER_FALLOFF_SLOW 8.6f // BBC standard +#define METER_FALLOFF_MEDIUM 20.0f +#define METER_FALLOFF_FAST 32.0f +#define METER_FALLOFF_FASTER 46.0f +#define METER_FALLOFF_FASTEST 70.0f + float meter_falloff_to_float (ARDOUR::MeterFalloff); ARDOUR::MeterFalloff meter_falloff_from_float (float); float meter_falloff_to_db_per_sec (float); |