From ac1272c0d4d4632106f7ed636ff1a9182b671a05 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 25 Sep 2006 21:24:00 +0000 Subject: the BIG CONFIG patch git-svn-id: svn://localhost/ardour2/trunk@926 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/ardour/configuration.h | 15 +- libs/ardour/ardour/configuration_variable.h | 102 ++-- libs/ardour/ardour/configuration_vars.h | 138 +++--- libs/ardour/ardour/session.h | 196 +------- libs/ardour/ardour/types.h | 44 +- libs/ardour/ardour/utils.h | 3 + libs/ardour/audio_diskstream.cc | 11 +- libs/ardour/audio_playlist.cc | 2 +- libs/ardour/audio_track.cc | 6 +- libs/ardour/configuration.cc | 113 +++-- libs/ardour/globals.cc | 22 +- libs/ardour/io.cc | 4 +- libs/ardour/playlist.cc | 18 +- libs/ardour/route.cc | 10 +- libs/ardour/session.cc | 230 +-------- libs/ardour/session_click.cc | 59 +-- libs/ardour/session_events.cc | 24 +- libs/ardour/session_export.cc | 6 +- libs/ardour/session_midi.cc | 170 ++----- libs/ardour/session_process.cc | 16 +- libs/ardour/session_state.cc | 702 +++++++--------------------- libs/ardour/session_time.cc | 50 +- libs/ardour/session_transport.cc | 102 ++-- libs/ardour/utils.cc | 39 +- libs/surfaces/control_protocol/basic_ui.cc | 14 +- 25 files changed, 699 insertions(+), 1397 deletions(-) (limited to 'libs') diff --git a/libs/ardour/ardour/configuration.h b/libs/ardour/ardour/configuration.h index 8d51343ffb..0b933cc5ac 100644 --- a/libs/ardour/ardour/configuration.h +++ b/libs/ardour/ardour/configuration.h @@ -55,11 +55,17 @@ class Configuration : public Stateful std::map midi_ports; + void map_parameters (sigc::slot theSlot); + int load_state (); int save_state (); int set_state (const XMLNode&); XMLNode& get_state (void); + XMLNode& get_partial_state (ConfigVariableBase::Owner); + void set_variables (const XMLNode&, ConfigVariableBase::Owner owner); + + void set_current_owner (ConfigVariableBase::Owner); XMLNode* control_protocol_state () { return _control_protocol_state; } @@ -71,14 +77,13 @@ class Configuration : public Stateful #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); ParameterChanged (name); } + 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(); } \ - void set_##var (Type val) { var.set (val); var.set_is_user (user_configuration); ParameterChanged (name); } + 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: @@ -92,10 +97,10 @@ class Configuration : public Stateful #undef CONFIG_VARIABLE #undef CONFIG_VARIABLE_SPECIAL - bool user_configuration; + ConfigVariableBase::Owner current_owner; XMLNode* _control_protocol_state; - XMLNode& state (bool user_only); + XMLNode& state (ConfigVariableBase::Owner); }; extern Configuration *Config; diff --git a/libs/ardour/ardour/configuration_variable.h b/libs/ardour/ardour/configuration_variable.h index cdd9b24284..4eba3101a2 100644 --- a/libs/ardour/ardour/configuration_variable.h +++ b/libs/ardour/ardour/configuration_variable.h @@ -10,19 +10,26 @@ namespace ARDOUR { class ConfigVariableBase { public: - ConfigVariableBase (std::string str) : _name (str), _is_user (false) {} + enum Owner { + Default, + System, + Config, + Session, + Interface + }; + + ConfigVariableBase (std::string str) : _name (str), _owner (Default) {} virtual ~ConfigVariableBase() {} std::string name() const { return _name; } - bool is_user() const { return _is_user; } - void set_is_user (bool yn) { _is_user = yn; } - + Owner owner() const { return _owner; } + virtual void add_to_node (XMLNode& node) = 0; - virtual bool set_from_node (const XMLNode& node) = 0; + virtual bool set_from_node (const XMLNode& node, Owner owner) = 0; protected: std::string _name; - bool _is_user; + Owner _owner; }; template @@ -32,8 +39,13 @@ class ConfigVariable : public ConfigVariableBase ConfigVariable (std::string str) : ConfigVariableBase (str) {} ConfigVariable (std::string str, T val) : ConfigVariableBase (str), value (val) {} - virtual void set (T val) { + virtual bool set (T val, Owner owner) { + if (val == value) { + return false; + } value = val; + _owner = owner; + return true; } T get() const { @@ -49,30 +61,63 @@ class ConfigVariable : public ConfigVariableBase node.add_child_nocopy (*child); } - bool set_from_node (const XMLNode& node) { - const XMLProperty* prop; - XMLNodeList nlist; - XMLNodeConstIterator niter; - XMLNode* child; + bool set_from_node (const XMLNode& node, Owner owner) { + + if (node.name() == "Config") { + + /* ardour.rc */ - nlist = node.children(); - - for (niter = nlist.begin(); niter != nlist.end(); ++niter) { + const XMLProperty* prop; + XMLNodeList nlist; + XMLNodeConstIterator niter; + XMLNode* child; - child = *niter; + nlist = node.children(); - 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; + 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 = 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 = owner; + return true; + } + } + } } return false; @@ -90,9 +135,12 @@ class ConfigVariableWithMutation : public ConfigVariable ConfigVariableWithMutation (std::string name, T val, T (*m)(T)) : ConfigVariable (name, val), mutator (m) {} - void set (T val) { - unmutated_value = val; - ConfigVariable::set (mutator (val)); + bool set (T val, ConfigVariableBase::Owner owner) { + if (unmutated_value != val) { + unmutated_value = val; + return ConfigVariable::set (mutator (val), owner); + } + return false; } protected: diff --git a/libs/ardour/ardour/configuration_vars.h b/libs/ardour/ardour/configuration_vars.h index 5222eefb0a..124a500d9f 100644 --- a/libs/ardour/ardour/configuration_vars.h +++ b/libs/ardour/ardour/configuration_vars.h @@ -1,61 +1,91 @@ #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") +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") +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", false) -CONFIG_VARIABLE(bool, use_sw_monitoring, "use-sw-monitoring", false) -CONFIG_VARIABLE(bool, use_external_monitoring, "use-external-monitoring", true) -CONFIG_VARIABLE(bool, jack_time_master, "jack-time-master", true) -CONFIG_VARIABLE(bool, use_video_sync, "use-video-sync", false) -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, 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, feedback_interval_ms, "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) -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, use_tranzport, "use-tranzport", false) -CONFIG_VARIABLE(uint32_t, osc_port, "osc-port", 3819) -CONFIG_VARIABLE(bool, use_osc, "use-osc", true) -CONFIG_VARIABLE(bool, use_overlap_equivalency, "use-overlap-equivalency", true) -CONFIG_VARIABLE(bool, meter_falloff_off, "meter-falloff-off", false) -CONFIG_VARIABLE(bool, meter_falloff_slowest, "meter-falloff-slowest", false) -CONFIG_VARIABLE(bool, meter_falloff_slower, "meter-falloff-slower", false) -CONFIG_VARIABLE(bool, meter_falloff_slow, "meter-falloff-slow", false) -CONFIG_VARIABLE(bool, meter_falloff_medium, "meter-falloff-medium", false) -CONFIG_VARIABLE(bool, meter_falloff_fast, "meter-falloff-fast", true) -CONFIG_VARIABLE(bool, meter_falloff_faster, "meter-falloff-faster", false) -CONFIG_VARIABLE(bool, meter_falloff_fastest, "meter-falloff-fastest", false) -CONFIG_VARIABLE(bool, meter_hold_off, "meter-hold-off", false) -CONFIG_VARIABLE(bool, meter_hold_short, "meter-hold-short", false) -CONFIG_VARIABLE(bool, meter_hold_medium, "meter-hold-medium", false) -CONFIG_VARIABLE(bool, meter_hold_long, "meter-hold-long", false) +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", false) +CONFIG_VARIABLE (bool, use_sw_monitoring, "use-sw-monitoring", false) +CONFIG_VARIABLE (bool, use_external_monitoring, "use-external-monitoring", true) +CONFIG_VARIABLE (bool, jack_time_master, "jack-time-master", true) +CONFIG_VARIABLE (bool, use_video_sync, "use-video-sync", false) +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, 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, feedback_interval_ms, "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) +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, use_tranzport, "use-tranzport", false) +CONFIG_VARIABLE (uint32_t, osc_port, "osc-port", 3819) +CONFIG_VARIABLE (bool, use_osc, "use-osc", true) +CONFIG_VARIABLE (bool, use_overlap_equivalency, "use-overlap-equivalency", true) +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, auto_loop, "auto-loop", false) +CONFIG_VARIABLE (bool, all_safe, "all-safe", false) +CONFIG_VARIABLE (bool, punch_in, "punch-in", false) +CONFIG_VARIABLE (bool, punch_out, "punch-out", false) +CONFIG_VARIABLE (bool, send_mtc, "send-mtc", false) +CONFIG_VARIABLE (bool, send_mmc, "send-mmc", false) +CONFIG_VARIABLE (bool, mmc_control, "mmc-control", false) +CONFIG_VARIABLE (bool, midi_feedback, "midi-feedback", false) +CONFIG_VARIABLE (bool, midi_control, "midi-control", false) +CONFIG_VARIABLE (bool, crossfades_active, "crossfades-active", false) +CONFIG_VARIABLE (bool, seamless_loop, "seamless-loop", false) +CONFIG_VARIABLE (bool, do_not_record_plugins, "do_not_record_plugins", false) +CONFIG_VARIABLE (AutoConnectOption, output_auto_connect, "output-auto-connect", AutoConnectOption (0)) +CONFIG_VARIABLE (AutoConnectOption, input_auto_connect, "input-auto-connect", AutoConnectOption (0)) +CONFIG_VARIABLE (EditMode, edit_mode, "edit-mode", Slide) +CONFIG_VARIABLE (LayerModel, layer_model, "layer-model", MoveAddHigher) +CONFIG_VARIABLE (SoloModel, solo_model, "solo-model", InverseMute) +CONFIG_VARIABLE (bool, solo_latched, "solo-latched", true) +CONFIG_VARIABLE (CrossfadeModel, xfade_model, "xfade-model", ShortCrossfade) +CONFIG_VARIABLE (bool, clicking, "clicking", false) +CONFIG_VARIABLE (std::string, click_sound, "click-sound", "") +CONFIG_VARIABLE (std::string, click_emphasis_sound, "click-emphasis-sound", "") +CONFIG_VARIABLE (float, meter_hold, "meter-hold", 100) +CONFIG_VARIABLE (float, meter_falloff, "meter-falloff", 0.375f) +CONFIG_VARIABLE (float, rf_speed, "rf-speed", 2.0f) +CONFIG_VARIABLE (float, shuttle_speed_factor, "shuttle-speed-factor", 1.0f) +CONFIG_VARIABLE (float, shuttle_speed_threshold, "shuttle-speed-threshold", 5.0f) +CONFIG_VARIABLE (float, smpte_frames_per_second, "smpte-frames-per-second", 30.0f) +CONFIG_VARIABLE (float, video_pullup, "video-pullup", 0.0f) +CONFIG_VARIABLE (bool, smpte_drop_frames, "smpte-drop-frames", false) +CONFIG_VARIABLE (jack_nframes_t, preroll, "preroll", 0) +CONFIG_VARIABLE (jack_nframes_t, postroll, "postroll", 0) +CONFIG_VARIABLE (jack_nframes_t, over_length_short, "over-length-short", 2) +CONFIG_VARIABLE (jack_nframes_t, over_length_long, "over-length-long", 10) +CONFIG_VARIABLE (bool, full_xfades_unmuted, "full-xfades-unmuted", true) +CONFIG_VARIABLE (float, short_xfade_seconds, "short-xfade-seconds", 0.015) +CONFIG_VARIABLE (SlaveSource, slave_source, "slave-source", None) +CONFIG_VARIABLE (ShuttleBehaviour, shuttle_behaviour, "shuttle-behaviour", Sprung) +CONFIG_VARIABLE (ShuttleUnits, shuttle_units, "shuttle-units", Percentage) /* these variables have custom set() methods */ diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 8b4123d4f0..36a8393ccd 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -119,17 +119,6 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible Recording = 2 }; - enum SlaveSource { - None = 0, - MTC, - JACK - }; - - enum AutoConnectOption { - AutoConnectPhysical = 0x1, - AutoConnectMaster = 0x2 - }; - struct Event { enum Type { SetTransportSpeed, @@ -172,7 +161,7 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible union { void* ptr; bool yes_or_no; - Session::SlaveSource slave; + SlaveSource slave; Route* route; }; @@ -247,6 +236,7 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible string path() const { return _path; } string name() const { return _name; } string snap_name() const { return _current_snapshot_name; } + string raid_path () const; void set_snap_name (); @@ -356,7 +346,7 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible void request_bounded_roll (jack_nframes_t start, jack_nframes_t end); void request_stop (bool abort = false); void request_locate (jack_nframes_t frame, bool with_roll = false); - void request_auto_loop (bool yn); + void request_play_loop (bool yn); jack_nframes_t last_transport_start() const { return _last_roll_location; } void goto_end () { request_locate (end_location->start(), false);} void goto_start () { request_locate (start_location->start(), false); } @@ -395,84 +385,7 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible void set_auto_punch_location (Location *); void set_auto_loop_location (Location *); - - enum ControlType { - AutoPlay, - AutoLoop, - AutoReturn, - AutoInput, - PunchIn, - PunchOut, - SendMTC, - MMCControl, - SoloLatch, - SoloingModel, - RecordingPlugins, - CrossFadesActive, - SendMMC, - SlaveType, - Clicking, - EditingMode, - PlayRange, - LayeringModel, - CrossfadingModel, - SeamlessLoop, - MidiFeedback, - MidiControl, - TranzportControl, - Feedback, - SmpteMode, - }; - - sigc::signal ControlChanged; - - void set_auto_play (bool yn); - void set_auto_return (bool yn); - void set_auto_input (bool yn); void reset_input_monitor_state (); - void set_input_auto_connect (bool yn); - void set_output_auto_connect (AutoConnectOption); - void set_punch_in (bool yn); - void set_punch_out (bool yn); - void set_send_mtc (bool yn); - void set_send_mmc (bool yn); - void set_mmc_control (bool yn); - void set_midi_feedback (bool yn); - void set_midi_control (bool yn); - void set_do_not_record_plugins (bool yn); - void set_crossfades_active (bool yn); - void set_seamless_loop (bool yn); - - bool get_auto_play () const { return auto_play; } - bool get_auto_input () const { return auto_input; } - bool get_auto_loop () const { return auto_loop; } - bool get_seamless_loop () const { return seamless_loop; } - bool get_punch_in () const { return punch_in; } - bool get_punch_out () const { return punch_out; } - bool get_all_safe () const { return all_safe; } - bool get_auto_return () const { return auto_return; } - bool get_send_mtc () const; - bool get_send_mmc () const; - bool get_mmc_control () const; - bool get_midi_feedback () const; - bool get_midi_control () const; - bool get_do_not_record_plugins () const { return do_not_record_plugins; } - bool get_crossfades_active () const { return crossfades_active; } - - bool get_input_auto_connect () const; - AutoConnectOption get_output_auto_connect () const { return output_auto_connect; } - - enum LayerModel { - LaterHigher, - MoveAddHigher, - AddHigher - }; - - void set_layer_model (LayerModel); - LayerModel get_layer_model () const { return layer_model; } - - void set_xfade_model (CrossfadeModel); - CrossfadeModel get_xfade_model () const { return xfade_model; } void add_event (jack_nframes_t action_frame, Event::Type type, jack_nframes_t target_frame = 0); void remove_event (jack_nframes_t frame, Event::Type type); @@ -555,36 +468,9 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible AudioEngine &engine() { return _engine; }; - /* configuration. there should really be accessors/mutators - for these - */ - - float meter_hold () { return _meter_hold; } - void set_meter_hold (float); - sigc::signal MeterHoldChanged; - - float meter_falloff () { return _meter_falloff; } - void set_meter_falloff (float); - sigc::signal MeterFalloffChanged; - int32_t max_level; int32_t min_level; - string click_emphasis_sound; - string click_sound; - bool click_requested; - jack_nframes_t over_length_short; - jack_nframes_t over_length_long; - bool send_midi_timecode; - bool send_midi_machine_control; - float shuttle_speed_factor; - float shuttle_speed_threshold; - float rf_speed; - float smpte_frames_per_second; - float video_pullup; - bool smpte_drop_frames; - AnyTime preroll; - AnyTime postroll; - + /* Time */ jack_nframes_t transport_frame () const {return _transport_frame; } @@ -616,7 +502,6 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible }; int set_smpte_type (float fps, bool drop_frames); - int set_video_pullup (float pullup); void sync_time_vars(); @@ -640,12 +525,10 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible static sigc::signal StartTimeChanged; static sigc::signal EndTimeChanged; static sigc::signal SMPTEOffsetChanged; - static sigc::signal SMPTETypeChanged; - static sigc::signal PullupChanged; - void request_slave_source (SlaveSource, jack_nframes_t pos = 0); - SlaveSource slave_source() const { return _slave_type; } - bool synced_to_jack() const { return _slave_type == JACK; } + void request_slave_source (SlaveSource); + bool synced_to_jack() const { return Config->get_slave_source() == JACK; } + float transport_speed() const { return _transport_speed; } bool transport_stopped() const { return _transport_speed == 0.0f; } bool transport_rolling() const { return _transport_speed != 0.0f; } @@ -690,7 +573,7 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible bool sample_rate_convert (import_status&, string infile, string& outfile); string build_tmp_convert_name (string file); - Session::SlaveSource post_export_slave; + SlaveSource post_export_slave; jack_nframes_t post_export_position; int start_audio_export (ARDOUR::AudioExportSpecification&); @@ -782,20 +665,9 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible int freeze (InterThreadInfo&); /* session-wide solo/mute/rec-enable */ - - enum SoloModel { - InverseMute, - SoloBus - }; bool soloing() const { return currently_soloing; } - SoloModel solo_model() const { return _solo_model; } - void set_solo_model (SoloModel); - - bool solo_latched() const { return _solo_latched; } - void set_solo_latched (bool yn); - void set_all_solo (bool); void set_all_mute (bool); @@ -833,7 +705,7 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible sigc::signal ConnectionRemoved; /* MIDI */ - + int set_mtc_port (string port_tag); int set_mmc_port (string port_tag); int set_midi_port (string port_tag); @@ -942,19 +814,9 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible void mark(); }; - /* edit mode */ - - void set_edit_mode (EditMode); - EditMode get_edit_mode () const { return _edit_mode; } - /* clicking */ boost::shared_ptr click_io() { return _click_io; } - void set_clicking (bool yn); - bool get_clicking() const; - - void set_click_sound (string path); - void set_click_emphasis_sound (string path); /* tempo FX */ @@ -971,9 +833,6 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible boost::shared_ptr tempoize_region (TimeStretchRequest&); - string raid_path() const; - void set_raid_path(string); - /* need to call this whenever we change native file formats */ void reset_native_file_format(); @@ -1099,7 +958,6 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible Location* end_location; Location* start_location; Slave *_slave; - SlaveSource _slave_type; volatile float _transport_speed; volatile float _desired_transport_speed; float _last_transport_speed; @@ -1153,6 +1011,7 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible void reset_slave_state (); bool follow_slave (jack_nframes_t, jack_nframes_t); + void set_slave_source (SlaveSource); bool _exporting; int prepare_to_export (ARDOUR::AudioExportSpecification&); @@ -1166,7 +1025,7 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible if (actively_recording()) { return true; } else { - if (auto_input) { + if (Config->get_auto_input()) { return false; } else { return true; @@ -1204,26 +1063,12 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible MIDI::Port* _midi_port; string _path; string _name; - bool do_not_record_plugins; - - /* toggles */ - - bool auto_play; - bool punch_in; - bool punch_out; - bool auto_loop; - bool seamless_loop; - bool loop_changing; - jack_nframes_t last_loopend; - bool auto_input; - bool crossfades_active; - bool all_safe; - bool auto_return; - bool monitor_in; - bool send_mtc; - bool send_mmc; - bool mmc_control; - bool midi_control; + bool session_send_mmc; + bool session_send_mtc; + bool session_midi_feedback; + bool play_loop; + bool loop_changing; + jack_nframes_t last_loopend; RingBuffer pending_events; @@ -1519,7 +1364,7 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible bool waiting_to_start; - void set_auto_loop (bool yn); + void set_play_loop (bool yn); void overwrite_some_buffers (Diskstream*); void flush_all_redirects (); void locate (jack_nframes_t, bool with_roll, bool with_flush, bool with_loop=false); @@ -1718,8 +1563,6 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible ConnectionList _connections; int load_connections (const XMLNode&); - int set_slave_source (SlaveSource, jack_nframes_t); - void reverse_diskstream_buffers (); UndoHistory history; @@ -1787,7 +1630,6 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible vector master_outs; - EditMode _edit_mode; EditMode pending_edit_mode; /* range playback */ @@ -1842,7 +1684,7 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible void add_controllable (PBD::Controllable*); void remove_controllable (PBD::Controllable*); - void handle_configuration_change (const char*); + void config_changed (const char*); }; } // namespace ARDOUR diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h index 39c06b6dcc..b70448e8a5 100644 --- a/libs/ardour/ardour/types.h +++ b/libs/ardour/ardour/types.h @@ -150,6 +150,8 @@ namespace ARDOUR { jack_nframes_t frames; double seconds; }; + + AnyTime() { type = Frames; frames = 0; } }; struct AudioRange { @@ -216,6 +218,22 @@ namespace ARDOUR { FullCrossfade, ShortCrossfade }; + + enum LayerModel { + LaterHigher, + MoveAddHigher, + AddHigher + }; + + enum SoloModel { + InverseMute, + SoloBus + }; + + enum AutoConnectOption { + AutoConnectPhysical = 0x1, + AutoConnectMaster = 0x2 + }; struct InterThreadInfo { volatile bool done; @@ -252,13 +270,37 @@ namespace ARDOUR { LADSPA, VST }; - + + enum SlaveSource { + None = 0, + MTC, + JACK + }; + + enum ShuttleBehaviour { + Sprung, + Wheel + }; + + enum ShuttleUnits { + Percentage, + Semitones + }; + typedef std::vector > SourceList; } // namespace ARDOUR std::istream& operator>>(std::istream& o, ARDOUR::SampleFormat& sf); std::istream& operator>>(std::istream& o, ARDOUR::HeaderFormat& sf); +std::istream& operator>>(std::istream& o, ARDOUR::AutoConnectOption& sf); +std::istream& operator>>(std::istream& o, ARDOUR::EditMode& sf); +std::istream& operator>>(std::istream& o, ARDOUR::SoloModel& sf); +std::istream& operator>>(std::istream& o, ARDOUR::LayerModel& sf); +std::istream& operator>>(std::istream& o, ARDOUR::CrossfadeModel& sf); +std::istream& operator>>(std::istream& o, ARDOUR::SlaveSource& sf); +std::istream& operator>>(std::istream& o, ARDOUR::ShuttleBehaviour& sf); +std::istream& operator>>(std::istream& o, ARDOUR::ShuttleUnits& sf); static inline jack_nframes_t session_frame_to_track_frame (jack_nframes_t session_frame, double speed) diff --git a/libs/ardour/ardour/utils.h b/libs/ardour/ardour/utils.h index 214e74156c..ab9f2ad952 100644 --- a/libs/ardour/ardour/utils.h +++ b/libs/ardour/ardour/utils.h @@ -59,6 +59,9 @@ std::string path_expand (std::string); void compute_equal_power_fades (jack_nframes_t nframes, float* in, float* out); +const char* slave_source_to_string (ARDOUR::SlaveSource src); +ARDOUR::SlaveSource string_to_slave_source (std::string str); + #if defined(HAVE_COREAUDIO) || defined(HAVE_AUDIOUNITS) std::string CFStringRefToStdString(CFStringRef stringRef); #endif // HAVE_COREAUDIO diff --git a/libs/ardour/audio_diskstream.cc b/libs/ardour/audio_diskstream.cc index f0ea938ca6..f1d6cb2db8 100644 --- a/libs/ardour/audio_diskstream.cc +++ b/libs/ardour/audio_diskstream.cc @@ -467,8 +467,7 @@ AudioDiskstream::check_record_status (jack_nframes_t transport_frame, jack_nfram if (_alignment_style == ExistingMaterial) { - - if (!_session.get_punch_in()) { + if (!Config->get_punch_in()) { /* manual punch in happens at the correct transport frame because the user hit a button. but to get alignment correct @@ -497,7 +496,7 @@ AudioDiskstream::check_record_status (jack_nframes_t transport_frame, jack_nfram } else { - if (_session.get_punch_in()) { + if (Config->get_punch_in()) { first_recordable_frame += _roll_delay; } else { capture_start_frame -= _roll_delay; @@ -591,7 +590,7 @@ AudioDiskstream::process (jack_nframes_t transport_frame, jack_nframes_t nframes (*c).current_playback_buffer = 0; } - if (nominally_recording || (_session.get_record_enabled() && _session.get_punch_in())) { + if (nominally_recording || (_session.get_record_enabled() && Config->get_punch_in())) { OverlapType ot; ot = coverage (first_recordable_frame, last_recordable_frame, transport_frame, transport_frame + nframes); @@ -1716,7 +1715,7 @@ AudioDiskstream::engage_record_enable () if (Config->get_use_hardware_monitoring()) { for (ChannelList::iterator chan = channels.begin(); chan != channels.end(); ++chan) { if ((*chan).source) { - (*chan).source->ensure_monitor_input (!(_session.get_auto_input() && rolling)); + (*chan).source->ensure_monitor_input (!(Config->get_auto_input() && rolling)); } capturing_sources.push_back ((*chan).write_source); } @@ -1782,7 +1781,7 @@ AudioDiskstream::get_state () Location* pi; - if (_session.get_punch_in() && ((pi = _session.locations()->auto_punch_location()) != 0)) { + if (Config->get_punch_in() && ((pi = _session.locations()->auto_punch_location()) != 0)) { snprintf (buf, sizeof (buf), "%" PRIu32, pi->start()); } else { snprintf (buf, sizeof (buf), "%" PRIu32, _session.transport_frame()); diff --git a/libs/ardour/audio_playlist.cc b/libs/ardour/audio_playlist.cc index 59425fcf1d..e7e410afe3 100644 --- a/libs/ardour/audio_playlist.cc +++ b/libs/ardour/audio_playlist.cc @@ -450,7 +450,7 @@ AudioPlaylist::check_dependents (boost::shared_ptr r, bool norefresh) } else { - xfade = new Crossfade (other, region, _session.get_xfade_model(), _session.get_crossfades_active()); + xfade = new Crossfade (other, region, Config->get_xfade_model(), Config->get_crossfades_active()); add_crossfade (*xfade); } } diff --git a/libs/ardour/audio_track.cc b/libs/ardour/audio_track.cc index 18a13f5f3f..7d6fd75206 100644 --- a/libs/ardour/audio_track.cc +++ b/libs/ardour/audio_track.cc @@ -444,7 +444,7 @@ AudioTrack::no_roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nf send_silence = true; } else { - if (_session.get_auto_input()) { + if (Config->get_auto_input()) { if (Config->get_use_sw_monitoring()) { send_silence = false; } else { @@ -545,7 +545,7 @@ AudioTrack::roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nfram just_meter_input (start_frame, end_frame, nframes, offset); } - if (diskstream->record_enabled() && !can_record && !_session.get_auto_input()) { + if (diskstream->record_enabled() && !can_record && !Config->get_auto_input()) { /* not actually recording, but we want to hear the input material anyway, at least potentially (depending on monitoring options) @@ -593,7 +593,7 @@ AudioTrack::roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nfram } } - process_output_buffers (bufs, limit, start_frame, end_frame, nframes, offset, (!_session.get_record_enabled() || !_session.get_do_not_record_plugins()), declick, (_meter_point != MeterInput)); + process_output_buffers (bufs, limit, start_frame, end_frame, nframes, offset, (!_session.get_record_enabled() || !Config->get_do_not_record_plugins()), declick, (_meter_point != MeterInput)); } else { /* problem with the diskstream; just be quiet for a bit */ diff --git a/libs/ardour/configuration.cc b/libs/ardour/configuration.cc index 84c3e3a834..d811be0f6e 100644 --- a/libs/ardour/configuration.cc +++ b/libs/ardour/configuration.cc @@ -56,7 +56,7 @@ Configuration::Configuration () #undef CONFIG_VARIABLE #undef CONFIG_VARIABLE_SPECIAL - user_configuration (false) + current_owner (ConfigVariableBase::Default) { _control_protocol_state = 0; } @@ -65,6 +65,12 @@ Configuration::~Configuration () { } +void +Configuration::set_current_owner (ConfigVariableBase::Owner owner) +{ + current_owner = owner; +} + int Configuration::load_state () { @@ -85,15 +91,14 @@ Configuration::load_state () return -1; } + current_owner = ConfigVariableBase::System; + if (set_state (*tree.root())) { error << string_compose(_("Ardour: system configuration file \"%1\" not loaded successfully."), rcfile) << endmsg; return -1; } } - /* from this point on, all configuration changes are user driven */ - - user_configuration = true; /* now load configuration file for user */ @@ -110,6 +115,8 @@ Configuration::load_state () return -1; } + current_owner = ConfigVariableBase::Config; + if (set_state (*tree.root())) { error << string_compose(_("Ardour: user configuration file \"%1\" not loaded successfully."), rcfile) << endmsg; return -1; @@ -125,15 +132,14 @@ Configuration::save_state() XMLTree tree; string rcfile; - /* Note: this only writes the per-user file, and therefore - only saves variables marked as user-set or modified + /* Note: this only writes the state not touched by Session or Interface */ rcfile = get_user_ardour_path (); rcfile += "ardour.rc"; if (rcfile.length()) { - tree.set_root (&state (true)); + tree.set_root (&state (ConfigVariableBase::Config)); if (!tree.write (rcfile.c_str())){ error << string_compose (_("Config file %1 not saved"), rcfile) << endmsg; return -1; @@ -146,41 +152,56 @@ Configuration::save_state() XMLNode& Configuration::get_state () { - return state (false); + return state (ConfigVariableBase::Config); } XMLNode& -Configuration::state (bool user_only) +Configuration::get_partial_state (ConfigVariableBase::Owner owner) { - XMLNode* root = new XMLNode("Ardour"); + return state (owner); +} + +XMLNode& +Configuration::state (ConfigVariableBase::Owner owner) +{ + XMLNode* root; + XMLNode* node; LocaleGuard lg (X_("POSIX")); - typedef map::const_iterator CI; - for(CI m = midi_ports.begin(); m != midi_ports.end(); ++m){ - root->add_child_nocopy(m->second->get_state()); - } + node = new XMLNode("Config"); - XMLNode* node = new XMLNode("Config"); - #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); + if (var.owner() <= owner) 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); + if (var.owner() <= owner) var.add_to_node (*node); #include "ardour/configuration_vars.h" #undef CONFIG_VARIABLE #undef CONFIG_VARIABLE_SPECIAL - root->add_child_nocopy (*node); + if (owner == ConfigVariableBase::Config) { - if (_extra_xml) { - root->add_child_copy (*_extra_xml); - } + root = new XMLNode("Ardour"); + typedef map::const_iterator CI; + for(CI m = midi_ports.begin(); m != midi_ports.end(); ++m){ + root->add_child_nocopy(m->second->get_state()); + } + + root->add_child_nocopy (*node); + + if (_extra_xml) { + root->add_child_copy (*_extra_xml); + } + + root->add_child_nocopy (ControlProtocolManager::instance().get_state()); + root->add_child_nocopy (Library->get_state()); - root->add_child_nocopy (ControlProtocolManager::instance().get_state()); - root->add_child_nocopy (Library->get_state()); + } else { + root = node; + } + return *root; } @@ -213,18 +234,8 @@ Configuration::set_state (const XMLNode& root) } } else if (node->name() == "Config") { - -#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 + + set_variables (*node, ConfigVariableBase::Config); } else if (node->name() == "extra") { _extra_xml = new XMLNode (*node); @@ -241,6 +252,25 @@ Configuration::set_state (const XMLNode& root) return 0; } +void +Configuration::set_variables (const XMLNode& node, ConfigVariableBase::Owner owner) +{ +#undef CONFIG_VARIABLE +#undef CONFIG_VARIABLE_SPECIAL +#define CONFIG_VARIABLE(type,var,name,value) \ + if (var.set_from_node (node, owner)) { \ + ParameterChanged (name); \ + } +#define CONFIG_VARIABLE_SPECIAL(type,var,name,value,mutator) \ + if (var.set_from_node (node, owner)) { \ + ParameterChanged (name); \ + } +#include "ardour/configuration_vars.h" +#undef CONFIG_VARIABLE +#undef CONFIG_VARIABLE_SPECIAL + +} + Configuration::MidiPortDescriptor::MidiPortDescriptor (const XMLNode& node) { const XMLProperty *prop; @@ -287,3 +317,14 @@ Configuration::MidiPortDescriptor::get_state() return *root; } +void +Configuration::map_parameters (sigc::slot 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/configuration_vars.h" +#undef CONFIG_VARIABLE +#undef CONFIG_VARIABLE_SPECIAL +} diff --git a/libs/ardour/globals.cc b/libs/ardour/globals.cc index 59a12a2917..c9c244ca3c 100644 --- a/libs/ardour/globals.cc +++ b/libs/ardour/globals.cc @@ -574,16 +574,22 @@ ARDOUR::coverage (jack_nframes_t sa, jack_nframes_t ea, /* not sure where to put these */ -std::istream& operator>>(std::istream& o, HeaderFormat& hf) { +template +std::istream& int_to_type (std::istream& o, T& hf) { int val; o >> val; - hf = (HeaderFormat) val; + hf = (T) val; return o; } -std::istream& operator>>(std::istream& o, SampleFormat& sf) { - int val; - o >> val; - sf = (SampleFormat) val; - return o; -} +std::istream& operator>>(std::istream& o, HeaderFormat& var) { return int_to_type (o, var); } +std::istream& operator>>(std::istream& o, SampleFormat& var) { return int_to_type (o, var); } +std::istream& operator>>(std::istream& o, AutoConnectOption& var) { return int_to_type (o, var); } +std::istream& operator>>(std::istream& o, EditMode& var) { return int_to_type (o, var); } +std::istream& operator>>(std::istream& o, SoloModel& var) { return int_to_type (o, var); } +std::istream& operator>>(std::istream& o, LayerModel& var) { return int_to_type (o, var); } +std::istream& operator>>(std::istream& o, CrossfadeModel& var) { return int_to_type (o, var); } +std::istream& operator>>(std::istream& o, SlaveSource& var) { return int_to_type (o, var); } +std::istream& operator>>(std::istream& o, ShuttleBehaviour& var) { return int_to_type (o, var); } +std::istream& operator>>(std::istream& o, ShuttleUnits& var) { return int_to_type (o, var); } + diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc index a6a976705c..b6bff35c89 100644 --- a/libs/ardour/io.cc +++ b/libs/ardour/io.cc @@ -2366,11 +2366,11 @@ IO::meter () new_peak = minus_infinity(); } - if (_session.meter_falloff() == 0.0f || new_peak > _visible_peak_power[n]) { + if (Config->get_meter_falloff() == 0.0f || new_peak > _visible_peak_power[n]) { _visible_peak_power[n] = new_peak; } else { // do falloff - new_peak = _visible_peak_power[n] - _session.meter_falloff(); + new_peak = _visible_peak_power[n] - Config->get_meter_falloff(); _visible_peak_power[n] = max (new_peak, -INFINITY); } } diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc index eca7b67e38..776af75a36 100644 --- a/libs/ardour/playlist.cc +++ b/libs/ardour/playlist.cc @@ -232,7 +232,7 @@ Playlist::init (bool hide) _splicing = false; _nudging = false; in_set_state = false; - _edit_mode = _session.get_edit_mode(); + _edit_mode = Config->get_edit_mode(); in_flush = false; in_partition = false; subcnt = 0; @@ -394,7 +394,7 @@ Playlist::flush_notifications () // pending_bounds.sort (cmp); for (RegionList::iterator r = pending_bounds.begin(); r != pending_bounds.end(); ++r) { - if (_session.get_layer_model() == Session::MoveAddHigher) { + if (Config->get_layer_model() == MoveAddHigher) { timestamp_layer_op (*r); } pending_length = true; @@ -1134,7 +1134,7 @@ Playlist::region_bounds_changed (Change what_changed, boost::shared_ptr if (holding_state ()) { pending_bounds.push_back (region); } else { - if (_session.get_layer_model() == Session::MoveAddHigher) { + if (Config->get_layer_model() == MoveAddHigher) { /* it moved or changed length, so change the timestamp */ timestamp_layer_op (region); } @@ -1537,8 +1537,8 @@ Playlist::relayer () freeze (); - if (_session.get_layer_model() == Session::MoveAddHigher || - _session.get_layer_model() == Session::AddHigher) { + if (Config->get_layer_model() == MoveAddHigher || + Config->get_layer_model() == AddHigher) { RegionSortByLastLayerOp cmp; RegionList copy = regions; @@ -1604,8 +1604,8 @@ void Playlist::raise_region_to_top (boost::shared_ptr region) { /* does nothing useful if layering mode is later=higher */ - if ((_session.get_layer_model() == Session::MoveAddHigher) || - (_session.get_layer_model() == Session::AddHigher)) { + if ((Config->get_layer_model() == MoveAddHigher) || + (Config->get_layer_model() == AddHigher)) { timestamp_layer_op (region); relayer (); } @@ -1615,8 +1615,8 @@ void Playlist::lower_region_to_bottom (boost::shared_ptr region) { /* does nothing useful if layering mode is later=higher */ - if ((_session.get_layer_model() == Session::MoveAddHigher) || - (_session.get_layer_model() == Session::AddHigher)) { + if ((Config->get_layer_model() == MoveAddHigher) || + (Config->get_layer_model() == AddHigher)) { region->set_last_layer_op (0); relayer (); } diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index 4f8a6ffd18..82edb253de 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -311,7 +311,7 @@ Route::process_output_buffers (vector& bufs, uint32_t nbufs, // TODO: this is probably wrong - (no_monitor && record_enabled() && (!_session.get_auto_input() || _session.actively_recording())) + (no_monitor && record_enabled() && (!Config->get_auto_input() || _session.actively_recording())) ) { @@ -390,7 +390,7 @@ Route::process_output_buffers (vector& bufs, uint32_t nbufs, // rec-enabled but not s/w monitoring - (no_monitor && record_enabled() && (!_session.get_auto_input() || _session.actively_recording())) + (no_monitor && record_enabled() && (!Config->get_auto_input() || _session.actively_recording())) ) { @@ -553,7 +553,7 @@ Route::process_output_buffers (vector& bufs, uint32_t nbufs, // recording but not s/w monitoring - (no_monitor && record_enabled() && (!_session.get_auto_input() || _session.actively_recording())) + (no_monitor && record_enabled() && (!Config->get_auto_input() || _session.actively_recording())) ) { @@ -586,7 +586,7 @@ Route::process_output_buffers (vector& bufs, uint32_t nbufs, /* relax */ - } else if (no_monitor && record_enabled() && (!_session.get_auto_input() || _session.actively_recording())) { + } else if (no_monitor && record_enabled() && (!Config->get_auto_input() || _session.actively_recording())) { IO::silence (nframes, offset); @@ -598,7 +598,7 @@ Route::process_output_buffers (vector& bufs, uint32_t nbufs, // muted by solo of another track, but not using control outs for solo - (!solo_audible && (_session.solo_model() != Session::SoloBus)) || + (!solo_audible && (Config->get_solo_model() != SoloBus)) || // muted by mute of this track diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 274fcf1b16..b2b36c9df5 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -96,8 +96,6 @@ sigc::signal Session::AskAboutPendingState; sigc::signal Session::SendFeedback; sigc::signal Session::SMPTEOffsetChanged; -sigc::signal Session::SMPTETypeChanged; -sigc::signal Session::PullupChanged; sigc::signal Session::StartTimeChanged; sigc::signal Session::EndTimeChanged; @@ -296,7 +294,7 @@ Session::Session (AudioEngine &eng, _state_of_the_state = StateOfTheState (_state_of_the_state & ~Dirty); - Config->ParameterChanged.connect (mem_fun (*this, &Session::handle_configuration_change)); + Config->ParameterChanged.connect (mem_fun (*this, &Session::config_changed)); if (was_dirty) { DirtyChanged (); /* EMIT SIGNAL */ @@ -601,6 +599,8 @@ Session::when_engine_running () set_block_size (_engine.frames_per_cycle()); set_frame_rate (_engine.frame_rate()); + Config->map_parameters (mem_fun (*this, &Session::config_changed)); + /* every time we reconnect, recompute worst case output latencies */ _engine.Running.connect (mem_fun (*this, &Session::set_worst_io_latencies)); @@ -626,7 +626,7 @@ Session::when_engine_running () if (_click_io->set_state (*child->children().front()) == 0) { - _clicking = click_requested; + _clicking = Config->get_clicking (); } else { @@ -644,7 +644,7 @@ Session::when_engine_running () if (_click_io->add_output_port (first_physical_output, this)) { // relax, even though its an error } else { - _clicking = click_requested; + _clicking = Config->get_clicking (); } } } @@ -657,7 +657,7 @@ Session::when_engine_running () set_worst_io_latencies (); if (_clicking) { - ControlChanged (Clicking); /* EMIT SIGNAL */ + // XXX HOW TO ALERT UI TO THIS ? DO WE NEED TO? } if (auditioner == 0) { @@ -923,76 +923,12 @@ Session::record_enabling_legal () const // return false; // } - if (all_safe) { + if (Config->get_all_safe()) { return false; } return true; } -void -Session::set_auto_play (bool yn) -{ - if (auto_play != yn) { - auto_play = yn; - set_dirty (); - ControlChanged (AutoPlay); - } -} - -void -Session::set_auto_return (bool yn) -{ - if (auto_return != yn) { - auto_return = yn; - set_dirty (); - ControlChanged (AutoReturn); - } -} - -void -Session::set_crossfades_active (bool yn) -{ - if (crossfades_active != yn) { - crossfades_active = yn; - set_dirty (); - ControlChanged (CrossFadesActive); - } -} - -void -Session::set_do_not_record_plugins (bool yn) -{ - if (do_not_record_plugins != yn) { - do_not_record_plugins = yn; - set_dirty (); - ControlChanged (RecordingPlugins); - } -} - -void -Session::set_auto_input (bool yn) -{ - if (auto_input != yn) { - auto_input = yn; - - if (Config->get_use_hardware_monitoring() && transport_rolling()) { - /* auto-input only makes a difference if we're rolling */ - - boost::shared_ptr dsl = diskstreams.reader(); - - for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) { - if ((*i)->record_enabled ()) { - //cerr << "switching to input = " << !auto_input << __FILE__ << __LINE__ << endl << endl; - (*i)->monitor_input (!auto_input); - } - } - } - - set_dirty(); - ControlChanged (AutoInput); - } -} - void Session::reset_input_monitor_state () { @@ -1003,7 +939,7 @@ Session::reset_input_monitor_state () for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) { if ((*i)->record_enabled ()) { //cerr << "switching to input = " << !auto_input << __FILE__ << __LINE__ << endl << endl; - (*i)->monitor_input (Config->get_use_hardware_monitoring() && !auto_input); + (*i)->monitor_input (Config->get_use_hardware_monitoring() && !Config->get_auto_input()); } } } else { @@ -1011,44 +947,19 @@ Session::reset_input_monitor_state () for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) { if ((*i)->record_enabled ()) { - //cerr << "switching to input = " << !auto_input << __FILE__ << __LINE__ << endl << endl; + //cerr << "switching to input = " << !Config->get_auto_input() << __FILE__ << __LINE__ << endl << endl; (*i)->monitor_input (Config->get_use_hardware_monitoring()); } } } } - -void -Session::set_input_auto_connect (bool yn) -{ - if (yn) { - input_auto_connect = AutoConnectOption (input_auto_connect|AutoConnectPhysical); - } else { - input_auto_connect = AutoConnectOption (input_auto_connect|~AutoConnectPhysical); - } - set_dirty (); -} - -bool -Session::get_input_auto_connect () const -{ - return (input_auto_connect & AutoConnectPhysical); -} - -void -Session::set_output_auto_connect (AutoConnectOption aco) -{ - output_auto_connect = aco; - set_dirty (); -} - void Session::auto_punch_start_changed (Location* location) { replace_event (Event::PunchIn, location->start()); - if (get_record_enabled() && get_punch_in()) { + if (get_record_enabled() && Config->get_punch_in()) { /* capture start has been changed, so save new pending state */ save_state ("", true); } @@ -1077,7 +988,7 @@ Session::auto_loop_changed (Location* location) { replace_event (Event::AutoLoop, location->end(), location->start()); - if (transport_rolling() && get_auto_loop()) { + if (transport_rolling() && play_loop) { //if (_transport_frame < location->start() || _transport_frame > location->end()) { @@ -1088,7 +999,7 @@ Session::auto_loop_changed (Location* location) request_locate (location->start(), true); } - else if (seamless_loop && !loop_changing) { + else if (Config->get_seamless_loop() && !loop_changing) { // schedule a locate-roll to refill the diskstreams at the // previous loop end @@ -1145,48 +1056,6 @@ Session::set_auto_punch_location (Location* location) auto_punch_location_changed (location); } -void -Session::set_punch_in (bool yn) -{ - if (punch_in == yn) { - return; - } - - Location* location; - - if ((location = _locations.auto_punch_location()) != 0) { - if ((punch_in = yn) == true) { - replace_event (Event::PunchIn, location->start()); - } else { - remove_event (location->start(), Event::PunchIn); - } - } - - set_dirty(); - ControlChanged (PunchIn); /* EMIT SIGNAL */ -} - -void -Session::set_punch_out (bool yn) -{ - if (punch_out == yn) { - return; - } - - Location* location; - - if ((location = _locations.auto_punch_location()) != 0) { - if ((punch_out = yn) == true) { - replace_event (Event::PunchOut, location->end()); - } else { - clear_events (Event::PunchOut); - } - } - - set_dirty(); - ControlChanged (PunchOut); /* EMIT SIGNAL */ -} - void Session::set_auto_loop_location (Location* location) { @@ -1280,7 +1149,7 @@ Session::enable_record () _last_record_location = _transport_frame; send_mmc_in_another_thread (MIDI::MachineControl::cmdRecordStrobe); - if (Config->get_use_hardware_monitoring() && auto_input) { + if (Config->get_use_hardware_monitoring() && Config->get_auto_input()) { boost::shared_ptr dsl = diskstreams.reader(); for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) { if ((*i)->record_enabled ()) { @@ -1310,7 +1179,7 @@ Session::disable_record (bool rt_context, bool force) send_mmc_in_another_thread (MIDI::MachineControl::cmdRecordExit); - if (Config->get_use_hardware_monitoring() && auto_input) { + if (Config->get_use_hardware_monitoring() && Config->get_auto_input()) { boost::shared_ptr dsl = diskstreams.reader(); for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) { @@ -1337,7 +1206,7 @@ Session::step_back_from_record () boost::shared_ptr dsl = diskstreams.reader(); for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) { - if (auto_input && (*i)->record_enabled ()) { + if (Config->get_auto_input() && (*i)->record_enabled ()) { //cerr << "switching from input" << __FILE__ << __LINE__ << endl << endl; (*i)->monitor_input (false); } @@ -1357,7 +1226,7 @@ Session::maybe_enable_record () save_state ("", true); if (_transport_speed) { - if (!punch_in) { + if (!Config->get_punch_in()) { enable_record (); } } else { @@ -2166,16 +2035,6 @@ Session::route_solo_changed (void* src, shared_ptr route) set_dirty(); } -void -Session::set_solo_latched (bool yn) -{ - if (yn != _solo_latched) { - _solo_latched = yn; - set_dirty (); - ControlChanged (SoloLatch); - } -} - void Session::update_route_solo_state () { @@ -3455,23 +3314,6 @@ Session::connection_by_name (string name) const return 0; } -void -Session::set_edit_mode (EditMode mode) -{ - _edit_mode = mode; - - { - Glib::Mutex::Lock lm (playlist_lock); - - for (PlaylistList::iterator i = playlists.begin(); i != playlists.end(); ++i) { - (*i)->set_edit_mode (mode); - } - } - - set_dirty (); - ControlChanged (EditingMode); /* EMIT SIGNAL */ -} - void Session::tempo_map_changed (Change ignored) { @@ -3618,16 +3460,6 @@ Session::n_playlists () const return playlists.size(); } -void -Session::set_solo_model (SoloModel sm) -{ - if (sm != _solo_model) { - _solo_model = sm; - ControlChanged (SoloingModel); - set_dirty (); - } -} - void Session::allocate_pan_automation_buffers (jack_nframes_t nframes, uint32_t howmany, bool force) { @@ -3869,36 +3701,6 @@ Session::nbusses () const return n; } -void -Session::set_layer_model (LayerModel lm) -{ - if (lm != layer_model) { - layer_model = lm; - set_dirty (); - ControlChanged (LayeringModel); - } -} - -void -Session::set_xfade_model (CrossfadeModel xm) -{ - if (xm != xfade_model) { - xfade_model = xm; - set_dirty (); - ControlChanged (CrossfadingModel); - } -} - -void -Session::handle_configuration_change (const char* parameter) -{ - if (!strcmp (parameter, "use-video-sync")) { - if (_transport_speed == 0.0f) { - waiting_for_sync_offset = true; - } - } -} - void Session::add_curve(Curve *curve) { diff --git a/libs/ardour/session_click.cc b/libs/ardour/session_click.cc index 1d14fd4a80..426e6e2864 100644 --- a/libs/ardour/session_click.cc +++ b/libs/ardour/session_click.cc @@ -145,17 +145,19 @@ Session::setup_click_sounds (int which) click_data = 0; } - if (click_sound.length() == 0) { + string path = Config->get_click_emphasis_sound(); + + if (path.empty()) { click_data = const_cast (default_click); click_length = default_click_length; } else { - if ((sndfile = sf_open (click_sound.c_str(), SFM_READ, &info)) == 0) { + if ((sndfile = sf_open (path.c_str(), SFM_READ, &info)) == 0) { char errbuf[256]; sf_error_str (0, errbuf, sizeof (errbuf) - 1); - warning << string_compose (_("cannot open click soundfile %1 (%2)"), click_sound, errbuf) << endmsg; + warning << string_compose (_("cannot open click soundfile %1 (%2)"), path, errbuf) << endmsg; _clicking = false; return; } @@ -182,14 +184,16 @@ Session::setup_click_sounds (int which) click_emphasis_data = 0; } - if (click_emphasis_sound.length() == 0) { + string path = Config->get_click_emphasis_sound(); + + if (path.empty()) { click_emphasis_data = const_cast (default_click_emphasis); click_emphasis_length = default_click_emphasis_length; } else { - if ((sndfile = sf_open (click_emphasis_sound.c_str(), SFM_READ, &info)) == 0) { + if ((sndfile = sf_open (path.c_str(), SFM_READ, &info)) == 0) { char errbuf[256]; sf_error_str (0, errbuf, sizeof (errbuf) - 1); - warning << string_compose (_("cannot open click emphasis soundfile %1 (%2)"), click_emphasis_sound, errbuf) << endmsg; + warning << string_compose (_("cannot open click emphasis soundfile %1 (%2)"), path, errbuf) << endmsg; return; } @@ -218,46 +222,3 @@ Session::clear_clicks () clicks.clear (); } - -void -Session::set_click_sound (string path) -{ - if (path != click_sound) { - click_sound = path; - setup_click_sounds (1); - } -} - -void -Session::set_click_emphasis_sound (string path) -{ - if (path != click_emphasis_sound) { - click_emphasis_sound = path; - setup_click_sounds (-1); - } -} - -void -Session::set_clicking (bool yn) -{ - if (click_requested != yn) { - click_requested = yn; - - if (yn) { - if (_click_io && click_data) { - _clicking = true; - } - } else { - _clicking = false; - } - - ControlChanged (Clicking); /* EMIT SIGNAL */ - } -} - -bool -Session::get_clicking () const -{ - return click_requested; -} - diff --git a/libs/ardour/session_events.cc b/libs/ardour/session_events.cc index 371b570069..a72a2e58d4 100644 --- a/libs/ardour/session_events.cc +++ b/libs/ardour/session_events.cc @@ -312,7 +312,15 @@ Session::process_event (Event* ev) switch (ev->type) { case Event::SetLoop: - set_auto_loop (ev->yes_or_no); + set_play_loop (ev->yes_or_no); + break; + + case Event::AutoLoop: + if (play_loop) { + start_locate (ev->target_frame, true, false, Config->get_seamless_loop()); + } + remove = false; + del = false; break; case Event::Locate: @@ -341,7 +349,7 @@ Session::process_event (Event* ev) case Event::PunchIn: // cerr << "PunchIN at " << transport_frame() << endl; - if (punch_in && record_status() == Enabled) { + if (Config->get_punch_in() && record_status() == Enabled) { enable_record (); } remove = false; @@ -350,7 +358,7 @@ Session::process_event (Event* ev) case Event::PunchOut: // cerr << "PunchOUT at " << transport_frame() << endl; - if (punch_out) { + if (Config->get_punch_out()) { step_back_from_record (); } remove = false; @@ -380,14 +388,6 @@ Session::process_event (Event* ev) del = false; break; - case Event::AutoLoop: - if (auto_loop) { - start_locate (ev->target_frame, true, false, seamless_loop); - } - remove = false; - del = false; - break; - case Event::Overwrite: overwrite_some_buffers (static_cast(ev->ptr)); break; @@ -397,7 +397,7 @@ Session::process_event (Event* ev) break; case Event::SetSlaveSource: - set_slave_source (ev->slave, ev->target_frame); + set_slave_source (ev->slave); break; case Event::Audition: diff --git a/libs/ardour/session_export.cc b/libs/ardour/session_export.cc index 98653314b0..81522dabec 100644 --- a/libs/ardour/session_export.cc +++ b/libs/ardour/session_export.cc @@ -462,7 +462,7 @@ Session::stop_audio_export (AudioExportSpecification& spec) /* restart slaving */ if (post_export_slave != None) { - set_slave_source (post_export_slave, post_export_position); + Config->set_slave_source (post_export_slave); } else { locate (post_export_position, false, false, false); } @@ -517,10 +517,10 @@ Session::prepare_to_export (AudioExportSpecification& spec) /* no slaving */ - post_export_slave = _slave_type; + post_export_slave = Config->get_slave_source (); post_export_position = _transport_frame; - set_slave_source (None, 0); + Config->set_slave_source (None); /* get transport ready */ diff --git a/libs/ardour/session_midi.cc b/libs/ardour/session_midi.cc index 821f894eeb..2a5b18962c 100644 --- a/libs/ardour/session_midi.cc +++ b/libs/ardour/session_midi.cc @@ -84,104 +84,6 @@ Session::use_config_midi_ports () MTC, MMC, etc. **********************************************************************/ -void -Session::set_mmc_control (bool yn) -{ - if (mmc_control == yn) { - return; - } - - mmc_control = yn; - set_dirty(); - poke_midi_thread (); - - ControlChanged (MMCControl); /* EMIT SIGNAL */ -} - -void -Session::set_midi_control (bool yn) -{ - if (midi_control == yn) { - return; - } - - midi_control = yn; - set_dirty(); - poke_midi_thread (); - - ControlChanged (MidiControl); /* EMIT SIGNAL */ -} - -void -Session::set_send_mtc (bool yn) -{ - /* set the persistent option value regardless */ - - send_midi_timecode = yn; - set_dirty(); - - /* only set the internal flag if we have - a port. - */ - - if (_mtc_port == 0 || send_mtc == yn) { - return; - } - - send_mtc = yn; - ControlChanged (SendMTC); /* EMIT SIGNAL */ -} - -void -Session::set_send_mmc (bool yn) -{ - if (_mmc_port == 0) { - return; - } - - if (send_midi_machine_control == yn) { - return; - } - - /* only set the internal flag if we have - a port. - */ - - if (_mmc_port) { - send_mmc = yn; - } - - /* set the persistent option value regardless */ - - send_midi_machine_control = yn; - set_dirty(); - - ControlChanged (SendMMC); /* EMIT SIGNAL */ -} - -void -Session::set_midi_feedback (bool yn) -{ -} - -bool -Session::get_midi_feedback () const -{ - return false; -} - -bool -Session::get_send_mtc () const -{ - return send_mtc; -} - -bool -Session::get_send_mmc () const -{ - return send_mmc; -} - int Session::set_mtc_port (string port_tag) { @@ -483,21 +385,20 @@ Session::setup_midi_control () if (_mmc_port != 0) { - send_mmc = send_midi_machine_control; + Config->set_send_mmc (session_send_mmc); } else { mmc = 0; - send_mmc = false; + session_send_mmc = false; } if (_mtc_port != 0) { - send_mtc = send_midi_timecode; + Config->set_send_mtc (session_send_mtc); } else { - - send_mtc = false; + session_send_mtc = false; } } @@ -542,7 +443,7 @@ Session::midi_read (MIDI::Port* port) void Session::spp_start (Parser& ignored) { - if (mmc_control && (_slave_type != MTC)) { + if (Config->get_mmc_control() && (Config->get_slave_source() != MTC)) { request_transport_speed (1.0); } } @@ -556,7 +457,7 @@ Session::spp_continue (Parser& ignored) void Session::spp_stop (Parser& ignored) { - if (mmc_control) { + if (Config->get_mmc_control()) { request_stop (); } } @@ -564,7 +465,7 @@ Session::spp_stop (Parser& ignored) void Session::mmc_deferred_play (MIDI::MachineControl &mmc) { - if (mmc_control && (_slave_type != MTC)) { + if (Config->get_mmc_control() && (Config->get_slave_source() != MTC)) { request_transport_speed (1.0); } } @@ -572,7 +473,7 @@ Session::mmc_deferred_play (MIDI::MachineControl &mmc) void Session::mmc_record_pause (MIDI::MachineControl &mmc) { - if (mmc_control) { + if (Config->get_mmc_control()) { maybe_enable_record(); } } @@ -580,7 +481,7 @@ Session::mmc_record_pause (MIDI::MachineControl &mmc) void Session::mmc_record_strobe (MIDI::MachineControl &mmc) { - if (!mmc_control) + if (!Config->get_mmc_control()) return; /* record strobe does an implicit "Play" command */ @@ -608,7 +509,7 @@ Session::mmc_record_strobe (MIDI::MachineControl &mmc) void Session::mmc_record_exit (MIDI::MachineControl &mmc) { - if (mmc_control) { + if (Config->get_mmc_control()) { disable_record (false); } } @@ -616,7 +517,7 @@ Session::mmc_record_exit (MIDI::MachineControl &mmc) void Session::mmc_stop (MIDI::MachineControl &mmc) { - if (mmc_control) { + if (Config->get_mmc_control()) { request_stop (); } } @@ -624,7 +525,7 @@ Session::mmc_stop (MIDI::MachineControl &mmc) void Session::mmc_pause (MIDI::MachineControl &mmc) { - if (mmc_control) { + if (Config->get_mmc_control()) { /* We support RECORD_PAUSE, so the spec says that we must interpret PAUSE like RECORD_PAUSE if @@ -645,7 +546,7 @@ void Session::mmc_step (MIDI::MachineControl &mmc, int steps) { - if (!mmc_control) { + if (!Config->get_mmc_control()) { return; } @@ -664,7 +565,7 @@ Session::mmc_step (MIDI::MachineControl &mmc, int steps) } double diff_secs = diff.tv_sec + (diff.tv_usec / 1000000.0); - double cur_speed = (((steps * 0.5) * smpte_frames_per_second) / diff_secs) / smpte_frames_per_second; + double cur_speed = (((steps * 0.5) * Config->get_smpte_frames_per_second()) / diff_secs) / Config->get_smpte_frames_per_second(); if (_transport_speed == 0 || cur_speed * _transport_speed < 0) { /* change direction */ @@ -696,7 +597,7 @@ Session::mmc_step (MIDI::MachineControl &mmc, int steps) void Session::mmc_rewind (MIDI::MachineControl &mmc) { - if (mmc_control) { + if (Config->get_mmc_control()) { request_transport_speed(-8.0f); } } @@ -704,7 +605,7 @@ Session::mmc_rewind (MIDI::MachineControl &mmc) void Session::mmc_fast_forward (MIDI::MachineControl &mmc) { - if (mmc_control) { + if (Config->get_mmc_control()) { request_transport_speed(8.0f); } } @@ -712,7 +613,7 @@ Session::mmc_fast_forward (MIDI::MachineControl &mmc) void Session::mmc_locate (MIDI::MachineControl &mmc, const MIDI::byte* mmc_tc) { - if (!mmc_control) { + if (!Config->get_mmc_control()) { return; } @@ -751,18 +652,14 @@ Session::mmc_locate (MIDI::MachineControl &mmc, const MIDI::byte* mmc_tc) void Session::mmc_shuttle (MIDI::MachineControl &mmc, float speed, bool forw) { - cerr << "MMC shuttle, speed = " << speed << endl; - - if (!mmc_control) { + if (!Config->get_mmc_control()) { return; } - if (shuttle_speed_threshold >= 0 && speed > shuttle_speed_threshold) { - speed *= shuttle_speed_factor; + if (Config->get_shuttle_speed_threshold() >= 0 && speed > Config->get_shuttle_speed_threshold()) { + speed *= Config->get_shuttle_speed_factor(); } - cerr << "requested MMC control speed = " << speed << endl; - if (forw) { request_transport_speed (speed); } else { @@ -773,7 +670,7 @@ Session::mmc_shuttle (MIDI::MachineControl &mmc, float speed, bool forw) void Session::mmc_record_enable (MIDI::MachineControl &mmc, size_t trk, bool enabled) { - if (mmc_control) { + if (Config->get_mmc_control()) { RouteList::iterator i; boost::shared_ptr r = routes.reader(); @@ -853,7 +750,7 @@ Session::send_full_time_code () MIDI::byte msg[10]; SMPTE::Time smpte; - if (_mtc_port == 0 || !send_mtc) { + if (_mtc_port == 0 || !session_send_mtc) { return 0; } @@ -916,7 +813,7 @@ Session::send_full_time_code () int Session::send_midi_time_code () { - if (_mtc_port == 0 || !send_mtc || transmitting_smpte_time.negative || (next_quarter_frame_to_send < 0) ) { + if (_mtc_port == 0 || !session_send_mtc || transmitting_smpte_time.negative || (next_quarter_frame_to_send < 0) ) { return 0; } @@ -999,7 +896,7 @@ Session::send_mmc_in_another_thread (MIDI::MachineControl::Command cmd, jack_nfr { MIDIRequest* request; - if (_mtc_port == 0 || !send_mmc) { + if (_mtc_port == 0 || !session_send_mmc) { return; } @@ -1019,7 +916,7 @@ Session::deliver_mmc (MIDI::MachineControl::Command cmd, jack_nframes_t where) int nbytes = 4; SMPTE::Time smpte; - if (_mmc_port == 0 || !send_mmc) { + if (_mmc_port == 0 || !session_send_mmc) { return; } @@ -1272,7 +1169,7 @@ Session::midi_thread_work () on the appropriate port. */ - if (mmc_control && _mmc_port && _mmc_port->selectable() >= 0) { + if (Config->get_mmc_control() && _mmc_port && _mmc_port->selectable() >= 0) { pfd[nfds].fd = _mmc_port->selectable(); pfd[nfds].events = POLLIN|POLLHUP|POLLERR; ports[nfds] = _mmc_port; @@ -1284,14 +1181,14 @@ Session::midi_thread_work () the relevant port. */ - if (_mtc_port && (_mtc_port != _mmc_port || !mmc_control) && _mtc_port->selectable() >= 0) { + if (_mtc_port && (_mtc_port != _mmc_port || !Config->get_mmc_control()) && _mtc_port->selectable() >= 0) { pfd[nfds].fd = _mtc_port->selectable(); pfd[nfds].events = POLLIN|POLLHUP|POLLERR; ports[nfds] = _mtc_port; nfds++; } - if (_midi_port && (_midi_port != _mmc_port || !mmc_control) && (_midi_port != _mtc_port) && _midi_port->selectable() >= 0) { + if (_midi_port && (_midi_port != _mmc_port || !Config->get_mmc_control()) && (_midi_port != _mtc_port) && _midi_port->selectable() >= 0) { pfd[nfds].fd = _midi_port->selectable(); pfd[nfds].events = POLLIN|POLLHUP|POLLERR; ports[nfds] = _midi_port; @@ -1450,14 +1347,3 @@ Session::midi_thread_work () } } -bool -Session::get_mmc_control () const -{ - return mmc_control; -} - -bool -Session::get_midi_control () const -{ - return midi_control; -} diff --git a/libs/ardour/session_process.cc b/libs/ardour/session_process.cc index 43849793d4..db6d75beec 100644 --- a/libs/ardour/session_process.cc +++ b/libs/ardour/session_process.cc @@ -410,7 +410,7 @@ Session::process_with_events (jack_nframes_t nframes) summon_butler (); } - if (!_engine.freewheeling() && send_mtc) { + if (!_engine.freewheeling() && session_send_mtc) { send_midi_time_code_in_another_thread (); } @@ -431,7 +431,7 @@ Session::transport_locked () const { Slave* sl = _slave; - if (!locate_pending() && ((_slave_type == None) || (sl && sl->ok() && sl->locked()))) { + if (!locate_pending() && ((Config->get_slave_source() == None) || (sl && sl->ok() && sl->locked()))) { return true; } @@ -449,7 +449,7 @@ Session::follow_slave (jack_nframes_t nframes, jack_nframes_t offset) if (!_slave->ok()) { stop_transport (); - set_slave_source (None, 0); + Config->set_slave_source (None); goto noroll; } @@ -540,9 +540,9 @@ Session::follow_slave (jack_nframes_t nframes, jack_nframes_t offset) Location* al = _locations.auto_loop_location(); - if (al && auto_loop && (slave_transport_frame < al->start() || slave_transport_frame > al->end())) { + if (al && play_loop && (slave_transport_frame < al->start() || slave_transport_frame > al->end())) { // cancel looping - request_auto_loop(false); + request_play_loop(false); } if (slave_transport_frame != _transport_frame) { @@ -614,7 +614,7 @@ Session::follow_slave (jack_nframes_t nframes, jack_nframes_t offset) // << " tf = " << _transport_frame // << endl; - if (_slave_type == JACK) { + if (Config->get_slave_source() == JACK) { last_stop_frame = _transport_frame; } @@ -784,7 +784,7 @@ Session::process_without_events (jack_nframes_t nframes) } else { increment_transport_position (frames_moved); } - + maybe_stop (stop_limit); check_declick_out (); @@ -794,7 +794,7 @@ Session::process_without_events (jack_nframes_t nframes) summon_butler (); } - if (!_engine.freewheeling() && send_mtc) { + if (!_engine.freewheeling() && session_send_mtc) { send_midi_time_code_in_another_thread (); } diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index d721eecce9..cddf5514bb 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -99,10 +99,11 @@ Session::first_stage_init (string fullpath, string snapshot_name) } char buf[PATH_MAX+1]; - if (!realpath(fullpath.c_str(), buf) && (errno != ENOENT)) { + if (!realpath (fullpath.c_str(), buf) && (errno != ENOENT)) { error << string_compose(_("Could not use path %1 (%s)"), buf, strerror(errno)) << endmsg; throw failed_constructor(); } + _path = string(buf); if (_path[_path.length()-1] != '/') { @@ -131,16 +132,8 @@ Session::first_stage_init (string fullpath, string snapshot_name) start_location = new Location (0, 0, _("start"), Location::Flags ((Location::IsMark|Location::IsStart))); _end_location_is_free = true; g_atomic_int_set (&_record_status, Disabled); - auto_play = false; - punch_in = false; - punch_out = false; - auto_loop = false; - seamless_loop = false; loop_changing = false; - auto_input = true; - crossfades_active = false; - all_safe = false; - auto_return = false; + play_loop = false; _last_roll_location = 0; _last_record_location = 0; pending_locate_frame = 0; @@ -153,8 +146,6 @@ Session::first_stage_init (string fullpath, string snapshot_name) outbound_mtc_smpte_frame = 0; next_quarter_frame_to_send = -1; current_block_size = 0; - _solo_latched = true; - _solo_model = InverseMute; solo_update_disabled = false; currently_soloing = false; _have_captured = false; @@ -163,12 +154,12 @@ Session::first_stage_init (string fullpath, string snapshot_name) _worst_track_latency = 0; _state_of_the_state = StateOfTheState(CannotSave|InitialConnecting|Loading); _slave = 0; - _slave_type = None; butler_mixdown_buffer = 0; butler_gain_buffer = 0; - mmc_control = false; - midi_control = true; mmc = 0; + session_send_mmc = false; + session_send_mtc = false; + session_midi_feedback = false; post_transport_work = PostTransportWork (0); g_atomic_int_set (&butler_should_do_transport_work, 0); g_atomic_int_set (&butler_active, 0); @@ -176,48 +167,37 @@ Session::first_stage_init (string fullpath, string snapshot_name) g_atomic_int_set (&_capture_load, 100); g_atomic_int_set (&_playback_load_min, 100); g_atomic_int_set (&_capture_load_min, 100); - _edit_mode = Slide; - pending_edit_mode = _edit_mode; + pending_edit_mode = Config->get_edit_mode (); _play_range = false; - input_auto_connect = AutoConnectOption (0); - output_auto_connect = AutoConnectOption (0); waiting_to_start = false; _exporting = false; _gain_automation_buffer = 0; _pan_automation_buffer = 0; _npan_buffers = 0; pending_abort = false; - layer_model = MoveAddHigher; - xfade_model = ShortCrossfade; destructive_index = 0; current_trans = 0; - + AudioDiskstream::allocate_working_buffers(); /* default short fade = 15ms */ - Crossfade::set_short_xfade_length ((jack_nframes_t) floor ((15.0 * frame_rate()) / 1000.0)); + Crossfade::set_short_xfade_length ((jack_nframes_t) floor (Config->get_short_xfade_seconds() * frame_rate())); DestructiveFileSource::setup_standard_crossfades (frame_rate()); last_mmc_step.tv_sec = 0; last_mmc_step.tv_usec = 0; step_speed = 0.0; - preroll.type = AnyTime::Frames; - preroll.frames = 0; - postroll.type = AnyTime::Frames; - postroll.frames = 0; - /* click sounds are unset by default, which causes us to internal waveforms for clicks. */ - _clicking = false; - click_requested = false; click_data = 0; click_emphasis_data = 0; click_length = 0; click_emphasis_length = 0; + _clicking = false; process_function = &Session::process_with_events; @@ -230,34 +210,18 @@ Session::first_stage_init (string fullpath, string snapshot_name) _current_frame_rate = 48000; _base_frame_rate = 48000; - smpte_frames_per_second = 30; - video_pullup = 0.0; - smpte_drop_frames = false; last_smpte_when = 0; _smpte_offset = 0; _smpte_offset_negative = true; last_smpte_valid = false; + sync_time_vars (); + last_rr_session_dir = session_dirs.begin(); refresh_disk_space (); // set_default_fade (0.2, 5.0); /* steepness, millisecs */ - /* default configuration */ - - do_not_record_plugins = false; - over_length_short = 2; - over_length_long = 10; - send_midi_timecode = false; - send_midi_machine_control = false; - shuttle_speed_factor = 1.0; - shuttle_speed_threshold = 5; - rf_speed = 2.0; - _meter_hold = 100; // XXX unknown units: number of calls to meter::set() - _meter_falloff = 0.375f; // XXX unknown units: refresh_rate - max_level = 0; - min_level = 0; - /* slave stuff */ average_slave_delta = 1800; @@ -265,11 +229,6 @@ Session::first_stage_init (string fullpath, string snapshot_name) delta_accumulator_cnt = 0; slave_state = Stopped; - /* default SMPTE type is 30 FPS, non-drop */ - - set_smpte_type (30.0, false); - set_video_pullup (0.0); - _engine.GraphReordered.connect (mem_fun (*this, &Session::graph_reordered)); /* These are all static "per-class" signals */ @@ -382,14 +341,6 @@ Session::raid_path () const return path.substr (0, path.length() - 1); // drop final colon } -void -Session::set_raid_path (string path) -{ - /* public-access to setup_raid_path() */ - - setup_raid_path (path); -} - void Session::setup_raid_path (string path) { @@ -762,40 +713,9 @@ Session::load_options (const XMLNode& node) { XMLNode* child; XMLProperty* prop; - bool have_fade_msecs = false; - bool have_fade_steepness = false; - float fade_msecs = 0; - float fade_steepness = 0; - SlaveSource slave_src = None; - int x; LocaleGuard lg (X_("POSIX")); - - if ((child = find_named_node (node, "input-auto-connect")) != 0) { - if ((prop = child->property ("val")) != 0) { - sscanf (prop->value().c_str(), "%x", &x); - input_auto_connect = AutoConnectOption (x); - } - } - if ((child = find_named_node (node, "output-auto-connect")) != 0) { - if ((prop = child->property ("val")) != 0) { - sscanf (prop->value().c_str(), "%x", &x); - output_auto_connect = AutoConnectOption (x); - } - } - - if ((child = find_named_node (node, "slave")) != 0) { - if ((prop = child->property ("type")) != 0) { - if (prop->value() == "none") { - slave_src = None; - } else if (prop->value() == "mtc") { - slave_src = MTC; - } else if (prop->value() == "jack") { - slave_src = JACK; - } - set_slave_source (slave_src, 0); - } - } + Config->set_variables (node, ConfigVariableBase::Session); /* we cannot set edit mode if we are loading a session, because it might destroy the playlist's positioning @@ -810,184 +730,6 @@ Session::load_options (const XMLNode& node) } } } - - if ((child = find_named_node (node, "send-midi-timecode")) != 0) { - if ((prop = child->property ("val")) != 0) { - bool x = (prop->value() == "yes"); - send_mtc = !x; /* force change in value */ - set_send_mtc (x); - } - } - if ((child = find_named_node (node, "send-midi-machine-control")) != 0) { - if ((prop = child->property ("val")) != 0) { - bool x = (prop->value() == "yes"); - send_mmc = !x; /* force change in value */ - set_send_mmc (prop->value() == "yes"); - } - } - if ((child = find_named_node (node, "max-level")) != 0) { - if ((prop = child->property ("val")) != 0) { - max_level = atoi (prop->value().c_str()); - } - } - if ((child = find_named_node (node, "min-level")) != 0) { - if ((prop = child->property ("val")) != 0) { - min_level = atoi (prop->value().c_str()); - } - } - if ((child = find_named_node (node, "meter-hold")) != 0) { - if ((prop = child->property ("val")) != 0) { - _meter_hold = atof (prop->value().c_str()); - } - } - if ((child = find_named_node (node, "meter-falloff")) != 0) { - if ((prop = child->property ("val")) != 0) { - _meter_falloff = atof (prop->value().c_str()); - } - } - if ((child = find_named_node (node, "long-over-length")) != 0) { - if ((prop = child->property ("val")) != 0) { - over_length_long = atoi (prop->value().c_str()); - } - } - if ((child = find_named_node (node, "short-over-length")) != 0) { - if ((prop = child->property ("val")) != 0) { - over_length_short = atoi (prop->value().c_str()); - } - } - if ((child = find_named_node (node, "shuttle-speed-factor")) != 0) { - if ((prop = child->property ("val")) != 0) { - shuttle_speed_factor = atof (prop->value().c_str()); - } - } - if ((child = find_named_node (node, "shuttle-speed-threshold")) != 0) { - if ((prop = child->property ("val")) != 0) { - shuttle_speed_threshold = atof (prop->value().c_str()); - } - } - if ((child = find_named_node (node, "rf-speed")) != 0) { - if ((prop = child->property ("val")) != 0) { - rf_speed = atof (prop->value().c_str()); - } - } - if ((child = find_named_node (node, "video-pullup")) != 0) { - if ((prop = child->property ("val")) != 0) { - set_video_pullup( atof (prop->value().c_str()) ); - } - } - if ((child = find_named_node (node, "smpte-frames-per-second")) != 0) { - if ((prop = child->property ("val")) != 0) { - set_smpte_type( atof (prop->value().c_str()), smpte_drop_frames ); - } - } - if ((child = find_named_node (node, "smpte-drop-frames")) != 0) { - if ((prop = child->property ("val")) != 0) { - set_smpte_type( smpte_frames_per_second, (prop->value() == "yes") ); - } - } - if ((child = find_named_node (node, "smpte-offset")) != 0) { - if ((prop = child->property ("val")) != 0) { - set_smpte_offset( atoi (prop->value().c_str()) ); - } - } - if ((child = find_named_node (node, "smpte-offset-negative")) != 0) { - if ((prop = child->property ("val")) != 0) { - set_smpte_offset_negative( (prop->value() == "yes") ); - } - } - if ((child = find_named_node (node, "click-sound")) != 0) { - if ((prop = child->property ("val")) != 0) { - click_sound = prop->value(); - } - } - if ((child = find_named_node (node, "click-emphasis-sound")) != 0) { - if ((prop = child->property ("val")) != 0) { - click_emphasis_sound = prop->value(); - } - } - - if ((child = find_named_node (node, "solo-model")) != 0) { - if ((prop = child->property ("val")) != 0) { - if (prop->value() == "SoloBus") - _solo_model = SoloBus; - else - _solo_model = InverseMute; - } - } - - /* BOOLEAN OPTIONS */ - - if ((child = find_named_node (node, "auto-play")) != 0) { - if ((prop = child->property ("val")) != 0) { - set_auto_play (prop->value() == "yes"); - } - } - if ((child = find_named_node (node, "auto-input")) != 0) { - if ((prop = child->property ("val")) != 0) { - set_auto_input (prop->value() == "yes"); - } - } - if ((child = find_named_node (node, "seamless-loop")) != 0) { - if ((prop = child->property ("val")) != 0) { - set_seamless_loop (prop->value() == "yes"); - } - } - if ((child = find_named_node (node, "punch-in")) != 0) { - if ((prop = child->property ("val")) != 0) { - set_punch_in (prop->value() == "yes"); - } - } - if ((child = find_named_node (node, "punch-out")) != 0) { - if ((prop = child->property ("val")) != 0) { - set_punch_out (prop->value() == "yes"); - } - } - if ((child = find_named_node (node, "auto-return")) != 0) { - if ((prop = child->property ("val")) != 0) { - set_auto_return (prop->value() == "yes"); - } - } - if ((child = find_named_node (node, "send-mtc")) != 0) { - if ((prop = child->property ("val")) != 0) { - set_send_mtc (prop->value() == "yes"); - } - } - if ((child = find_named_node (node, "mmc-control")) != 0) { - if ((prop = child->property ("val")) != 0) { - set_mmc_control (prop->value() == "yes"); - } - } - if ((child = find_named_node (node, "midi-control")) != 0) { - if ((prop = child->property ("val")) != 0) { - set_midi_control (prop->value() == "yes"); - } - } - if ((child = find_named_node (node, "midi-feedback")) != 0) { - if ((prop = child->property ("val")) != 0) { - set_midi_feedback (prop->value() == "yes"); - } - } - // Legacy support for - if ((child = find_named_node (node, "recording-plugins")) != 0) { - if ((prop = child->property ("val")) != 0) { - set_do_not_record_plugins (prop->value() == "no"); - } - } - if ((child = find_named_node (node, "do-not-record-plugins")) != 0) { - if ((prop = child->property ("val")) != 0) { - set_do_not_record_plugins (prop->value() == "yes"); - } - } - if ((child = find_named_node (node, "crossfades-active")) != 0) { - if ((prop = child->property ("val")) != 0) { - set_crossfades_active (prop->value() == "yes"); - } - } - if ((child = find_named_node (node, "audible-click")) != 0) { - if ((prop = child->property ("val")) != 0) { - set_clicking (prop->value() == "yes"); - } - } if ((child = find_named_node (node, "end-marker-is-free")) != 0) { if ((prop = child->property ("val")) != 0) { @@ -995,243 +737,23 @@ Session::load_options (const XMLNode& node) } } - if ((child = find_named_node (node, "layer-model")) != 0) { - if ((prop = child->property ("val")) != 0) { - if (prop->value() == X_("LaterHigher")) { - set_layer_model (LaterHigher); - } else if (prop->value() == X_("AddHigher")) { - set_layer_model (AddHigher); - } else { - set_layer_model (MoveAddHigher); - } - } - } - - if ((child = find_named_node (node, "xfade-model")) != 0) { - if ((prop = child->property ("val")) != 0) { - if (prop->value() == X_("Short")) { - set_xfade_model (ShortCrossfade); - } else { - set_xfade_model (FullCrossfade); - } - } - } - - if ((child = find_named_node (node, "short-xfade-length")) != 0) { - if ((prop = child->property ("val")) != 0) { - /* value is stored as a fractional seconds */ - float secs = atof (prop->value().c_str()); - Crossfade::set_short_xfade_length ((jack_nframes_t) floor (secs * frame_rate())); - } - } - - if ((child = find_named_node (node, "full-xfades-unmuted")) != 0) { - if ((prop = child->property ("val")) != 0) { - crossfades_active = (prop->value() == "yes"); - } - } - - /* TIED OPTIONS */ - - if ((child = find_named_node (node, "default-fade-steepness")) != 0) { - if ((prop = child->property ("val")) != 0) { - fade_steepness = atof (prop->value().c_str()); - have_fade_steepness = true; - } - } - if ((child = find_named_node (node, "default-fade-msec")) != 0) { - if ((prop = child->property ("val")) != 0) { - fade_msecs = atof (prop->value().c_str()); - have_fade_msecs = true; - } - } - - if (have_fade_steepness || have_fade_msecs) { - // set_default_fade (fade_steepness, fade_msecs); - } - return 0; } XMLNode& Session::get_options () const { - XMLNode* opthead; XMLNode* child; - char buf[32]; LocaleGuard lg (X_("POSIX")); - opthead = new XMLNode ("Options"); - - SlaveSource src = slave_source (); - string src_string; - switch (src) { - case None: - src_string = "none"; - break; - case MTC: - src_string = "mtc"; - break; - case JACK: - src_string = "jack"; - break; - } - child = opthead->add_child ("slave"); - child->add_property ("type", src_string); - - child = opthead->add_child ("send-midi-timecode"); - child->add_property ("val", send_midi_timecode?"yes":"no"); + XMLNode& option_root = Config->get_partial_state (ConfigVariableBase::Interface); - child = opthead->add_child ("send-midi-machine-control"); - child->add_property ("val", send_midi_machine_control?"yes":"no"); - - snprintf (buf, sizeof(buf)-1, "%x", (int) input_auto_connect); - child = opthead->add_child ("input-auto-connect"); - child->add_property ("val", buf); - - snprintf (buf, sizeof(buf)-1, "%x", (int) output_auto_connect); - child = opthead->add_child ("output-auto-connect"); - child->add_property ("val", buf); - - snprintf (buf, sizeof(buf)-1, "%d", max_level); - child = opthead->add_child ("max-level"); - child->add_property ("val", buf); - - snprintf (buf, sizeof(buf)-1, "%d", min_level); - child = opthead->add_child ("min-level"); - child->add_property ("val", buf); - - snprintf (buf, sizeof(buf)-1, "%f", _meter_hold); - child = opthead->add_child ("meter-hold"); - child->add_property ("val", buf); - - snprintf (buf, sizeof(buf)-1, "%f", _meter_falloff); - child = opthead->add_child ("meter-falloff"); - child->add_property ("val", buf); - - snprintf (buf, sizeof(buf)-1, "%u", over_length_long); - child = opthead->add_child ("long-over-length"); - child->add_property ("val", buf); - - snprintf (buf, sizeof(buf)-1, "%u", over_length_short); - child = opthead->add_child ("short-over-length"); - child->add_property ("val", buf); - - snprintf (buf, sizeof(buf)-1, "%f", shuttle_speed_factor); - child = opthead->add_child ("shuttle-speed-factor"); - child->add_property ("val", buf); - - snprintf (buf, sizeof(buf)-1, "%f", shuttle_speed_threshold); - child = opthead->add_child ("shuttle-speed-threshold"); - child->add_property ("val", buf); - - snprintf (buf, sizeof(buf)-1, "%f", rf_speed); - child = opthead->add_child ("rf-speed"); - child->add_property ("val", buf); - - snprintf (buf, sizeof(buf)-1, "%.4f", video_pullup); - child = opthead->add_child ("video-pullup"); - child->add_property ("val", buf); - - snprintf (buf, sizeof(buf)-1, "%.2f", smpte_frames_per_second); - child = opthead->add_child ("smpte-frames-per-second"); - child->add_property ("val", buf); - - child = opthead->add_child ("smpte-drop-frames"); - child->add_property ("val", smpte_drop_frames ? "yes" : "no"); - - snprintf (buf, sizeof(buf)-1, "%u", smpte_offset ()); - child = opthead->add_child ("smpte-offset"); - child->add_property ("val", buf); - - child = opthead->add_child ("smpte-offset-negative"); - child->add_property ("val", smpte_offset_negative () ? "yes" : "no"); - - child = opthead->add_child ("edit-mode"); - switch (_edit_mode) { - case Splice: - child->add_property ("val", "splice"); - break; - - case Slide: - child->add_property ("val", "slide"); - break; - } - - child = opthead->add_child ("auto-play"); - child->add_property ("val", get_auto_play () ? "yes" : "no"); - child = opthead->add_child ("auto-input"); - child->add_property ("val", get_auto_input () ? "yes" : "no"); - child = opthead->add_child ("seamless-loop"); - child->add_property ("val", get_seamless_loop () ? "yes" : "no"); - child = opthead->add_child ("punch-in"); - child->add_property ("val", get_punch_in () ? "yes" : "no"); - child = opthead->add_child ("punch-out"); - child->add_property ("val", get_punch_out () ? "yes" : "no"); - child = opthead->add_child ("all-safe"); - child->add_property ("val", get_all_safe () ? "yes" : "no"); - child = opthead->add_child ("auto-return"); - child->add_property ("val", get_auto_return () ? "yes" : "no"); - child = opthead->add_child ("mmc-control"); - child->add_property ("val", get_mmc_control () ? "yes" : "no"); - child = opthead->add_child ("midi-control"); - child->add_property ("val", get_midi_control () ? "yes" : "no"); - child = opthead->add_child ("midi-feedback"); - child->add_property ("val", get_midi_feedback () ? "yes" : "no"); - child = opthead->add_child ("do-not-record-plugins"); - child->add_property ("val", get_do_not_record_plugins () ? "yes" : "no"); - child = opthead->add_child ("auto-crossfade"); - child->add_property ("val", get_crossfades_active () ? "yes" : "no"); - child = opthead->add_child ("audible-click"); - child->add_property ("val", get_clicking () ? "yes" : "no"); - child = opthead->add_child ("end-marker-is-free"); + child = option_root.add_child ("end-marker-is-free"); child->add_property ("val", _end_location_is_free ? "yes" : "no"); - if (click_sound.length()) { - child = opthead->add_child ("click-sound"); - child->add_property ("val", click_sound); - } - - if (click_emphasis_sound.length()) { - child = opthead->add_child ("click-emphasis-sound"); - child->add_property ("val", click_emphasis_sound); - } - - child = opthead->add_child ("solo-model"); - child->add_property ("val", _solo_model == SoloBus ? "SoloBus" : "InverseMute"); - - child = opthead->add_child ("layer-model"); - switch (layer_model) { - case LaterHigher: - child->add_property ("val", X_("LaterHigher")); - break; - case MoveAddHigher: - child->add_property ("val", X_("MoveAddHigher")); - break; - case AddHigher: - child->add_property ("val", X_("AddHigher")); - break; - } - - child = opthead->add_child ("xfade-model"); - switch (xfade_model) { - case FullCrossfade: - child->add_property ("val", X_("Full")); - break; - case ShortCrossfade: - child->add_property ("val", X_("Short")); - } - - child = opthead->add_child ("short-xfade-length"); - /* store as fractions of a second */ - snprintf (buf, sizeof(buf)-1, "%f", - (float) Crossfade::short_xfade_length() / frame_rate()); - child->add_property ("val", buf); + child = option_root.add_child ("full-xfades-unmuted"); - child = opthead->add_child ("full-xfades-unmuted"); - child->add_property ("val", crossfades_active ? "yes" : "no"); - - return *opthead; + return option_root; } XMLNode& @@ -1504,7 +1026,7 @@ Session::set_state (const XMLNode& node) MIDI Path extra - Options + Options/Config Sources AudioRegions AudioDiskstreams @@ -1519,21 +1041,16 @@ Session::set_state (const XMLNode& node) if (use_config_midi_ports ()) { } - if ((child = find_named_node (node, "Path")) != 0) { - /* XXX this XML content stuff horrible API design */ - string raid_path = _path + ':' + child->children().front()->content(); - setup_raid_path (raid_path); - } else { - /* the path is already set */ - } - if ((child = find_named_node (node, "extra")) != 0) { _extra_xml = new XMLNode (*child); } - if ((child = find_named_node (node, "Options")) == 0) { + if (((child = find_named_node (node, "Options")) != 0)) { /* old style */ + load_options (*child); + } else if ((child = find_named_node (node, "Config")) != 0) { /* new style */ + load_options (*child); + } else { error << _("Session: XML state has no options section") << endmsg; - } else if (load_options (*child)) { } if ((child = find_named_node (node, "Sources")) == 0) { @@ -1652,7 +1169,7 @@ Session::set_state (const XMLNode& node) /* OK, now we can set edit mode */ - set_edit_mode (pending_edit_mode); + Config->set_edit_mode (pending_edit_mode); /* here beginneth the second phase ... */ @@ -2536,21 +2053,6 @@ Session::edit_group_by_name (string name) return 0; } -void -Session::set_meter_hold (float val) -{ - _meter_hold = val; - MeterHoldChanged(); // emit -} - -void -Session::set_meter_falloff (float val) -{ - _meter_falloff = val; - MeterFalloffChanged(); // emit -} - - void Session::begin_reversible_command (string name) { @@ -3374,3 +2876,159 @@ Session::restore_history (string snapshot_name) return 0; } + +void +Session::config_changed (const char* parameter_name) +{ +#define PARAM_IS(x) (!strcmp (parameter_name, (x))) + + if (PARAM_IS ("seamless-loop")) { + + } else if (PARAM_IS ("rf-speed")) { + + } else if (PARAM_IS ("auto-loop")) { + + } else if (PARAM_IS ("auto-input")) { + + if (Config->get_use_hardware_monitoring() && transport_rolling()) { + /* auto-input only makes a difference if we're rolling */ + + boost::shared_ptr dsl = diskstreams.reader(); + + for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) { + if ((*i)->record_enabled ()) { + //cerr << "switching to input = " << !auto_input << __FILE__ << __LINE__ << endl << endl; + (*i)->monitor_input (!Config->get_auto_input()); + } + } + } + + } else if (PARAM_IS ("punch-in")) { + + Location* location; + + if ((location = _locations.auto_punch_location()) != 0) { + + if (Config->get_punch_in ()) { + replace_event (Event::PunchIn, location->start()); + } else { + remove_event (location->start(), Event::PunchIn); + } + } + + } else if (PARAM_IS ("punch-out")) { + + Location* location; + + if ((location = _locations.auto_punch_location()) != 0) { + + if (Config->get_punch_out()) { + replace_event (Event::PunchOut, location->end()); + } else { + clear_events (Event::PunchOut); + } + } + + } else if (PARAM_IS ("edit-mode")) { + + Glib::Mutex::Lock lm (playlist_lock); + + for (PlaylistList::iterator i = playlists.begin(); i != playlists.end(); ++i) { + (*i)->set_edit_mode (Config->get_edit_mode ()); + } + + } else if (PARAM_IS ("use-video-sync")) { + + if (transport_stopped()) { + if (Config->get_use_video_sync()) { + waiting_for_sync_offset = true; + } + } + + } else if (PARAM_IS ("mmc-control")) { + + poke_midi_thread (); + + } else if (PARAM_IS ("midi-control")) { + + poke_midi_thread (); + + } else if (PARAM_IS ("raid-path")) { + + setup_raid_path (Config->get_raid_path()); + + } else if (PARAM_IS ("smpte-frames-per-second") || PARAM_IS ("smpte-drop-frames")) { + + sync_time_vars (); + + } else if (PARAM_IS ("video-pullup")) { + + sync_time_vars (); + + } else if (PARAM_IS ("seamless-loop")) { + + if (play_loop && transport_rolling()) { + // to reset diskstreams etc + request_play_loop (true); + } + + } else if (PARAM_IS ("rf-speed")) { + + cumulative_rf_motion = 0; + reset_rf_scale (0); + + } else if (PARAM_IS ("click-sound")) { + + setup_click_sounds (1); + + } else if (PARAM_IS ("click-emphasis-sound")) { + + setup_click_sounds (-1); + + } else if (PARAM_IS ("clicking")) { + + if (Config->get_clicking()) { + if (_click_io && click_data) { // don't require emphasis data + _clicking = true; + } + } else { + _clicking = false; + } + + } else if (PARAM_IS ("send-mtc")) { + + /* only set the internal flag if we have + a port. + */ + + if (_mtc_port != 0) { + session_send_mtc = Config->get_send_mtc(); + } + + } else if (PARAM_IS ("send-mmc")) { + + /* only set the internal flag if we have + a port. + */ + + if (_mmc_port != 0) { + session_send_mmc = Config->get_send_mmc(); + } + + } else if (PARAM_IS ("midi-feedback")) { + + /* only set the internal flag if we have + a port. + */ + + if (_mtc_port != 0) { + session_midi_feedback = Config->get_midi_feedback(); + } + + } + + set_dirty (); + +#undef PARAM_IS + +} diff --git a/libs/ardour/session_time.cc b/libs/ardour/session_time.cc index 69138f1c8b..e8fbbdbc4e 100644 --- a/libs/ardour/session_time.cc +++ b/libs/ardour/session_time.cc @@ -51,17 +51,17 @@ Session::bbt_time (jack_nframes_t when, BBT_Time& bbt) void Session::sync_time_vars () { - _current_frame_rate = (jack_nframes_t) round (_base_frame_rate * (1.0 + (video_pullup/100.0))); + _current_frame_rate = (jack_nframes_t) round (_base_frame_rate * (1.0 + (Config->get_video_pullup()/100.0))); _frames_per_hour = _current_frame_rate * 3600; - _frames_per_smpte_frame = (double) _current_frame_rate / (double) smpte_frames_per_second; - _smpte_frames_per_hour = (unsigned long) (smpte_frames_per_second * 3600.0); + _frames_per_smpte_frame = (double) _current_frame_rate / (double) Config->get_smpte_frames_per_second(); + _smpte_frames_per_hour = (unsigned long) (Config->get_smpte_frames_per_second() * 3600.0); } int Session::set_smpte_type (float fps, bool drop_frames) { - smpte_frames_per_second = fps; - smpte_drop_frames = drop_frames; + Config->set_smpte_frames_per_second (fps); + Config->set_smpte_drop_frames (drop_frames); last_smpte_valid = false; // smpte type bits are the middle two in the upper nibble @@ -84,26 +84,6 @@ Session::set_smpte_type (float fps, bool drop_frames) break; }; - sync_time_vars(); - - SMPTETypeChanged (); /* EMIT SIGNAL */ - - set_dirty(); - - return 0; -} - -int -Session::set_video_pullup (float pull) -{ - video_pullup = pull; - - sync_time_vars(); - - PullupChanged (); /* EMIT SIGNAL */ - - set_dirty(); - return 0; } @@ -128,7 +108,7 @@ Session::set_smpte_offset_negative (bool neg) void Session::smpte_to_sample( SMPTE::Time& smpte, jack_nframes_t& sample, bool use_offset, bool use_subframes ) const { - if (smpte_drop_frames) { + if (Config->get_smpte_drop_frames()) { // The drop frame format was created to better approximate the 30000/1001 = 29.97002997002997.... // framerate of NTSC color TV. The used frame rate of drop frame is 29.97, which drifts by about // 0.108 frame per hour, or about 1.3 frames per 12 hours. This is not perfect, but a lot better @@ -255,7 +235,7 @@ Session::sample_to_smpte( jack_nframes_t sample, SMPTE::Time& smpte, bool use_of // Extract hour-exceeding frames for minute, second and frame calculations smpte_frames_left = ((long) floor( smpte_frames_left_exact )); - if (smpte_drop_frames) { + if (Config->get_smpte_drop_frames()) { // See long explanation in smpte_to_sample()... // Number of 10 minute chunks @@ -291,10 +271,10 @@ Session::sample_to_smpte( jack_nframes_t sample, SMPTE::Time& smpte, bool use_of } } else { // Non drop is easy - smpte.minutes = smpte_frames_left / ((long) smpte_frames_per_second * 60); - smpte_frames_left = smpte_frames_left % ((long) smpte_frames_per_second * 60); - smpte.seconds = smpte_frames_left / (long) smpte_frames_per_second; - smpte.frames = smpte_frames_left % (long) smpte_frames_per_second; + smpte.minutes = smpte_frames_left / ((long) Config->get_smpte_frames_per_second () * 60); + smpte_frames_left = smpte_frames_left % ((long) Config->get_smpte_frames_per_second () * 60); + smpte.seconds = smpte_frames_left / (long) Config->get_smpte_frames_per_second (); + smpte.frames = smpte_frames_left % (long) Config->get_smpte_frames_per_second (); } if (!use_subframes) { @@ -430,7 +410,7 @@ Session::jack_timebase_callback (jack_transport_state_t state, #ifdef HAVE_JACK_VIDEO_SUPPORT //poke audio video ratio so Ardour can track Video Sync - pos->audio_frames_per_video_frame = frame_rate() / smpte_frames_per_second; + pos->audio_frames_per_video_frame = frame_rate() / Config->get_smpte_frames_per_second (); pos->valid = jack_position_bits_t (pos->valid | JackAudioVideoRatio); #endif @@ -438,11 +418,11 @@ Session::jack_timebase_callback (jack_transport_state_t state, /* SMPTE info */ t.smpte_offset = _smpte_offset; - t.smpte_frame_rate = smpte_frames_per_second; + t.smpte_frame_rate = Config->get_smpte_frames_per_second (); if (_transport_speed) { - if (auto_loop) { + if (play_loop) { Location* location = _locations.auto_loop_location(); @@ -489,7 +469,7 @@ Session::convert_to_frames_at (jack_nframes_t position, AnyTime& any) secs = any.smpte.hours * 60 * 60; secs += any.smpte.minutes * 60; secs += any.smpte.seconds; - secs += any.smpte.frames / smpte_frames_per_second; + secs += any.smpte.frames / Config->get_smpte_frames_per_second (); if (_smpte_offset_negative) { return (jack_nframes_t) floor (secs * frame_rate()) - _smpte_offset; diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc index 1138d97664..963c232083 100644 --- a/libs/ardour/session_transport.cc +++ b/libs/ardour/session_transport.cc @@ -57,16 +57,15 @@ Session::request_input_change_handling () } void -Session::request_slave_source (SlaveSource src, jack_nframes_t pos) +Session::request_slave_source (SlaveSource src) { - Event* ev = new Event (Event::SetSlaveSource, Event::Add, Event::Immediate, pos, 0.0); + Event* ev = new Event (Event::SetSlaveSource, Event::Add, Event::Immediate, 0, 0.0); - if (src == Session::JACK) { - /* could set_seamless_loop() be disposed of entirely?*/ - set_seamless_loop (false); + if (src == JACK) { + /* could set_seamless_loop() be disposed of entirely?*/ + Config->set_seamless_loop (false); } else { - - set_seamless_loop (true); + Config->set_seamless_loop (true); } ev->slave = src; queue_event (ev); @@ -109,7 +108,7 @@ Session::force_locate (jack_nframes_t target_frame, bool with_roll) } void -Session::request_auto_loop (bool yn) +Session::request_play_loop (bool yn) { Event* ev; Location *location = _locations.auto_loop_location(); @@ -123,28 +122,13 @@ Session::request_auto_loop (bool yn) ev = new Event (Event::SetLoop, Event::Add, Event::Immediate, 0, 0.0, yn); queue_event (ev); - if (!yn && seamless_loop && transport_rolling()) { + if (!yn && Config->get_seamless_loop() && transport_rolling()) { // request an immediate locate to refresh the diskstreams // after disabling looping request_locate (_transport_frame-1, true); } } -void -Session::set_seamless_loop (bool yn) -{ - if (seamless_loop != yn) { - seamless_loop = yn; - - if (auto_loop && transport_rolling()) { - // to reset diskstreams etc - request_auto_loop (true); - } - - ControlChanged (SeamlessLoop); /* EMIT */ - } -} - void Session::realtime_stop (bool abort) { @@ -190,7 +174,7 @@ Session::realtime_stop (bool abort) waiting_for_sync_offset = true; } - transport_sub_state = (auto_return ? AutoReturning : 0); + transport_sub_state = (Config->get_auto_return() ? AutoReturning : 0); } void @@ -357,13 +341,13 @@ Session::non_realtime_stop (bool abort) update_latency_compensation (true, abort); } - if (auto_return || (post_transport_work & PostTransportLocate) || synced_to_jack()) { + if (Config->get_auto_return() || (post_transport_work & PostTransportLocate) || synced_to_jack()) { if (pending_locate_flush) { flush_all_redirects (); } - if ((auto_return || synced_to_jack()) && !(post_transport_work & PostTransportLocate)) { + if ((Config->get_auto_return() || synced_to_jack()) && !(post_transport_work & PostTransportLocate)) { _transport_frame = last_stop_frame; @@ -445,7 +429,7 @@ Session::non_realtime_stop (bool abort) /* and start it up again if relevant */ - if ((post_transport_work & PostTransportLocate) && _slave_type == None && pending_locate_roll) { + if ((post_transport_work & PostTransportLocate) && Config->get_slave_source() == None && pending_locate_roll) { request_transport_speed (1.0); pending_locate_roll = false; } @@ -476,7 +460,7 @@ Session::check_declick_out () } void -Session::set_auto_loop (bool yn) +Session::set_play_loop (bool yn) { /* Called from event-handling context */ @@ -486,7 +470,7 @@ Session::set_auto_loop (bool yn) set_dirty(); - if (yn && seamless_loop && synced_to_jack()) { + if (yn && Config->get_seamless_loop() && synced_to_jack()) { warning << _("Seamless looping cannot be supported while Ardour is using JACK transport.\n" "Recommend changing the configured options") << endmsg; @@ -494,14 +478,14 @@ Session::set_auto_loop (bool yn) } - if ((auto_loop = yn)) { + if ((play_loop = yn)) { Location *loc; if ((loc = _locations.auto_loop_location()) != 0) { - if (seamless_loop) { + if (Config->get_seamless_loop()) { // set all diskstreams to use internal looping boost::shared_ptr dsl = diskstreams.reader(); for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) { @@ -551,8 +535,6 @@ Session::set_auto_loop (bool yn) } } - - ControlChanged (AutoLoop); /* EMIT SIGNAL */ } void @@ -624,7 +606,7 @@ Session::locate (jack_nframes_t target_frame, bool with_roll, bool with_flush, b } } - if (transport_rolling() && !auto_play && !with_roll && !(synced_to_jack() && auto_loop)) { + if (transport_rolling() && !Config->get_auto_play() && !with_roll && !(synced_to_jack() && play_loop)) { realtime_stop (false); } @@ -663,7 +645,7 @@ Session::locate (jack_nframes_t target_frame, bool with_roll, bool with_flush, b for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) { if ((*i)->record_enabled ()) { //cerr << "switching from input" << __FILE__ << __LINE__ << endl << endl; - (*i)->monitor_input (!auto_input); + (*i)->monitor_input (!Config->get_auto_input()); } } } @@ -681,13 +663,13 @@ Session::locate (jack_nframes_t target_frame, bool with_roll, bool with_flush, b } } - /* cancel autoloop if transport pos outside of loop range */ - if (auto_loop) { + /* cancel looped playback if transport pos outside of loop range */ + if (play_loop) { Location* al = _locations.auto_loop_location(); if (al && (_transport_frame < al->start() || _transport_frame > al->end())) { // cancel looping directly, this is called from event handling context - set_auto_loop(false); + set_play_loop (false); } } @@ -738,7 +720,7 @@ Session::set_transport_speed (float speed, bool abort) boost::shared_ptr dsl = diskstreams.reader(); for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) { - if (auto_input && (*i)->record_enabled ()) { + if (Config->get_auto_input() && (*i)->record_enabled ()) { //cerr << "switching from input" << __FILE__ << __LINE__ << endl << endl; (*i)->monitor_input (false); } @@ -851,7 +833,7 @@ Session::start_transport () switch (record_status()) { case Enabled: - if (!punch_in) { + if (!Config->get_punch_in()) { enable_record (); } break; @@ -907,7 +889,7 @@ Session::post_transport () if (post_transport_work & PostTransportLocate) { - if ((auto_play && !_exporting) || (post_transport_work & PostTransportRoll)) { + if ((Config->get_auto_play() && !_exporting) || (post_transport_work & PostTransportRoll)) { start_transport (); @@ -921,14 +903,6 @@ Session::post_transport () post_transport_work = PostTransportWork (0); } -void -Session::set_rf_speed (float speed) -{ - rf_speed = speed; - cumulative_rf_motion = 0; - reset_rf_scale (0); -} - void Session::reset_rf_scale (jack_nframes_t motion) { @@ -949,31 +923,24 @@ Session::reset_rf_scale (jack_nframes_t motion) } } -int -Session::set_slave_source (SlaveSource src, jack_nframes_t frame) +void +Session::set_slave_source (SlaveSource src) { bool reverse = false; bool non_rt_required = false; - if (src == _slave_type) { - return 0; - } - if (_transport_speed) { error << _("please stop the transport before adjusting slave settings") << endmsg; - /* help out non-MVC friendly UI's by telling them the slave type changed */ - ControlChanged (SlaveType); /* EMIT SIGNAL */ - return 0; + return; } // if (src == JACK && Config->get_jack_time_master()) { -// return -1; +// return; // } if (_slave) { delete _slave; _slave = 0; - _slave_type = None; } if (_transport_speed < 0.0) { @@ -992,12 +959,12 @@ Session::set_slave_source (SlaveSource src, jack_nframes_t frame) } catch (failed_constructor& err) { - return -1; + return; } } else { error << _("No MTC port defined: MTC slaving is impossible.") << endmsg; - return -1; + return; } _desired_transport_speed = _transport_speed; break; @@ -1007,9 +974,9 @@ Session::set_slave_source (SlaveSource src, jack_nframes_t frame) _desired_transport_speed = _transport_speed; break; }; - - _slave_type = src; + Config->set_slave_source (src); + boost::shared_ptr dsl = diskstreams.reader(); for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) { if (!(*i)->hidden()) { @@ -1030,9 +997,6 @@ Session::set_slave_source (SlaveSource src, jack_nframes_t frame) } set_dirty(); - ControlChanged (SlaveType); /* EMIT SIGNAL */ - - return 0; } void @@ -1081,8 +1045,6 @@ Session::set_play_range (bool yn) Event* ev = new Event (Event::SetTransportSpeed, Event::Add, Event::Immediate, 0, 0.0f, false); merge_event (ev); } - - ControlChanged (PlayRange); /* EMIT SIGNAL */ } } diff --git a/libs/ardour/utils.cc b/libs/ardour/utils.cc index 9e8603827a..83b0c3101e 100644 --- a/libs/ardour/utils.cc +++ b/libs/ardour/utils.cc @@ -281,7 +281,7 @@ compute_equal_power_fades (jack_nframes_t nframes, float* in, float* out) in[0] = 0.0f; - for (int i = 1; i < nframes - 1; ++i) { + for (jack_nframes_t i = 1; i < nframes - 1; ++i) { in[i] = in[i-1] + step; } @@ -297,3 +297,40 @@ compute_equal_power_fades (jack_nframes_t nframes, float* in, float* out) in[n] = inVal * (scale * inVal + 1.0f - scale); } } + +SlaveSource +string_to_slave_source (string str) +{ + if (str == _("Internal")) { + return None; + } + + if (str == _("MTC")) { + return MTC; + } + + if (str == _("JACK")) { + return JACK; + } + + fatal << string_compose (_("programming error: unknown slave source string \"%1\""), str) << endmsg; + /*NOTREACHED*/ + return None; +} + +const char* +slave_source_to_string (SlaveSource src) +{ + switch (src) { + case JACK: + return _("JACK"); + + case MTC: + return _("MTC"); + + default: + case None: + return _("Internal"); + + } +} diff --git a/libs/surfaces/control_protocol/basic_ui.cc b/libs/surfaces/control_protocol/basic_ui.cc index 3dc93cc64a..32b4137f51 100644 --- a/libs/surfaces/control_protocol/basic_ui.cc +++ b/libs/surfaces/control_protocol/basic_ui.cc @@ -54,10 +54,10 @@ BasicUI::register_thread (std::string name) void BasicUI::loop_toggle () { - if (session->get_auto_loop()) { - session->request_auto_loop (false); + if (Config->get_auto_loop()) { + session->request_play_loop (false); } else { - session->request_auto_loop (true); + session->request_play_loop (true); if (!session->transport_rolling()) { session->request_transport_speed (1.0); } @@ -106,8 +106,8 @@ BasicUI::transport_play (bool from_last_start) { bool rolling = session->transport_rolling (); - if (session->get_auto_loop()) { - session->request_auto_loop (false); + if (Config->get_auto_loop()) { + session->request_play_loop (false); } if (session->get_play_range ()) { @@ -208,13 +208,13 @@ BasicUI::toggle_all_rec_enables () void BasicUI::toggle_punch_in () { - session->set_punch_in (!session->get_punch_in()); + Config->set_punch_in (!Config->get_punch_in()); } void BasicUI::toggle_punch_out () { - session->set_punch_out (!session->get_punch_out()); + Config->set_punch_out (!Config->get_punch_out()); } bool -- cgit v1.2.3