the BIG CONFIG patch
authorPaul Davis <paul@linuxaudiosystems.com>
Mon, 25 Sep 2006 21:24:00 +0000 (21:24 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Mon, 25 Sep 2006 21:24:00 +0000 (21:24 +0000)
git-svn-id: svn://localhost/ardour2/trunk@926 d708f5d6-7413-0410-9779-e7cbd77b26cf

45 files changed:
gtk2_ardour/ardour_ui.cc
gtk2_ardour/ardour_ui.h
gtk2_ardour/ardour_ui2.cc
gtk2_ardour/ardour_ui_ed.cc
gtk2_ardour/ardour_ui_options.cc
gtk2_ardour/audio_clock.cc
gtk2_ardour/canvas-waveview.c
gtk2_ardour/editor.cc
gtk2_ardour/editor.h
gtk2_ardour/editor_actions.cc
gtk2_ardour/editor_audio_import.cc
gtk2_ardour/editor_audiotrack.cc
gtk2_ardour/editor_markers.cc
gtk2_ardour/editor_mouse.cc
gtk2_ardour/editor_ops.cc
gtk2_ardour/gain_meter.cc
gtk2_ardour/gain_meter.h
gtk2_ardour/main.cc
gtk2_ardour/option_editor.cc
gtk2_ardour/send_ui.cc
libs/ardour/ardour/configuration.h
libs/ardour/ardour/configuration_variable.h
libs/ardour/ardour/configuration_vars.h
libs/ardour/ardour/session.h
libs/ardour/ardour/types.h
libs/ardour/ardour/utils.h
libs/ardour/audio_diskstream.cc
libs/ardour/audio_playlist.cc
libs/ardour/audio_track.cc
libs/ardour/configuration.cc
libs/ardour/globals.cc
libs/ardour/io.cc
libs/ardour/playlist.cc
libs/ardour/route.cc
libs/ardour/session.cc
libs/ardour/session_click.cc
libs/ardour/session_events.cc
libs/ardour/session_export.cc
libs/ardour/session_midi.cc
libs/ardour/session_process.cc
libs/ardour/session_state.cc
libs/ardour/session_time.cc
libs/ardour/session_transport.cc
libs/ardour/utils.cc
libs/surfaces/control_protocol/basic_ui.cc

index c67697ba4a3224cda02d69bdc0433bff761dc547..d9fc95a649b2bea9f247ac91e2b224a893a6071f 100644 (file)
@@ -172,9 +172,6 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], string rcfile)
        shuttle_fract = 0.0;
        shuttle_max_speed = 8.0f;
 
-       set_shuttle_units (Percentage);
-       set_shuttle_behaviour (Sprung);
-
        shuttle_style_menu = 0;
        shuttle_unit_menu = 0;
 
@@ -935,10 +932,11 @@ restart JACK with more ports."));
 void
 ARDOUR_UI::do_transport_locate (jack_nframes_t new_position)
 {
-       jack_nframes_t _preroll;
+       jack_nframes_t _preroll = 0;
 
        if (session) {
-               _preroll = session->convert_to_frames_at (new_position, session->preroll);
+               // XXX CONFIG_CHANGE FIX - requires AnyTime handling
+               // _preroll = session->convert_to_frames_at (new_position, Config->get_preroll());
 
                if (new_position > _preroll) {
                        new_position -= _preroll;
@@ -1013,8 +1011,8 @@ ARDOUR_UI::transport_stop ()
                return;
        }
        
-       if (session->get_auto_loop()) {
-               session->request_auto_loop (false);
+       if (Config->get_auto_loop()) {
+               session->request_play_loop (false);
        }
        
        session->request_stop ();
@@ -1068,8 +1066,8 @@ ARDOUR_UI::transport_roll ()
 
        rolling = session->transport_rolling ();
 
-       if (session->get_auto_loop()) {
-               session->request_auto_loop (false);
+       if (Config->get_auto_loop()) {
+               session->request_play_loop (false);
                auto_loop_button.set_active (false);
                roll_button.set_active (true);
        } else if (session->get_play_range ()) {
@@ -1086,7 +1084,7 @@ void
 ARDOUR_UI::transport_loop()
 {
        if (session) {
-               if (session->get_auto_loop()) {
+               if (Config->get_auto_loop()) {
                        if (session->transport_rolling()) {
                                Location * looploc = session->locations()->auto_loop_location();
                                if (looploc) {
@@ -1095,7 +1093,7 @@ ARDOUR_UI::transport_loop()
                        }
                }
                else {
-                       session->request_auto_loop (true);
+                       session->request_play_loop (true);
                }
        }
 }
@@ -1725,8 +1723,8 @@ ARDOUR_UI::new_session (bool startup, std::string predetermined_path)
                                                        
                                        uint32_t cchns;
                                        uint32_t mchns;
-                                       Session::AutoConnectOption iconnect;
-                                       Session::AutoConnectOption oconnect;
+                                       AutoConnectOption iconnect;
+                                       AutoConnectOption oconnect;
                                                        
                                        if (new_session_dialog->create_control_bus()) {
                                                cchns = (uint32_t) new_session_dialog->control_channel_count();
@@ -1741,19 +1739,19 @@ ARDOUR_UI::new_session (bool startup, std::string predetermined_path)
                                        }
                                                        
                                        if (new_session_dialog->connect_inputs()) {
-                                               iconnect = Session::AutoConnectPhysical;
+                                               iconnect = AutoConnectPhysical;
                                        } else {
-                                               iconnect = Session::AutoConnectOption (0);
+                                               iconnect = AutoConnectOption (0);
                                        }
                                                        
                                        /// @todo some minor tweaks.
                                                        
                                        if (new_session_dialog->connect_outs_to_master()) {
-                                               oconnect = Session::AutoConnectMaster;
+                                               oconnect = AutoConnectMaster;
                                        } else if (new_session_dialog->connect_outs_to_physical()) {
-                                               oconnect = Session::AutoConnectPhysical;
+                                               oconnect = AutoConnectPhysical;
                                        } else {
-                                               oconnect = Session::AutoConnectOption (0);
+                                               oconnect = AutoConnectOption (0);
                                        } 
                                                        
                                        uint32_t nphysin = (uint32_t) new_session_dialog->input_limit_count();
@@ -1822,6 +1820,8 @@ This prevents the session from being loaded."));
 
        connect_to_session (new_session);
 
+       Config->set_current_owner (ConfigVariableBase::Interface);
+
        session_loaded = true;
        return 0;
 }
@@ -1842,8 +1842,8 @@ int
 ARDOUR_UI::build_session (const string & path, const string & snap_name, 
                          uint32_t control_channels,
                          uint32_t master_channels, 
-                         Session::AutoConnectOption input_connect,
-                         Session::AutoConnectOption output_connect,
+                         AutoConnectOption input_connect,
+                         AutoConnectOption output_connect,
                          uint32_t nphysin,
                          uint32_t nphysout,
                          jack_nframes_t initial_length)
@@ -2127,9 +2127,9 @@ ARDOUR_UI::add_route ()
        string name_template = add_route_dialog->name_template ();
        bool track = add_route_dialog->track ();
 
-       Session::AutoConnectOption oac = session->get_output_auto_connect();
+       AutoConnectOption oac = Config->get_output_auto_connect();
 
-       if (oac & Session::AutoConnectMaster) {
+       if (oac & AutoConnectMaster) {
                output_chan = (session->master_out() ? session->master_out()->n_inputs() : input_chan);
        } else {
                output_chan = input_chan;
index 5d494bc48efca2bd9f8002557be75ee530feead5..9dcfece76069c52c3b9bd61db17e0384267ab193 100644 (file)
@@ -112,8 +112,8 @@ class ARDOUR_UI : public Gtkmm2ext::UI
        int build_session (const string & path, const string & snapshot, 
                           uint32_t ctl_chns, 
                           uint32_t master_chns,
-                          ARDOUR::Session::AutoConnectOption input_connect,
-                          ARDOUR::Session::AutoConnectOption output_connect,
+                          ARDOUR::AutoConnectOption input_connect,
+                          ARDOUR::AutoConnectOption output_connect,
                           uint32_t nphysin,
                           uint32_t nphysout,
                           jack_nframes_t initial_length);
@@ -373,16 +373,6 @@ class ARDOUR_UI : public Gtkmm2ext::UI
        void toggle_time_master ();
        void toggle_video_sync ();
 
-       enum ShuttleBehaviour {
-               Sprung,
-               Wheel
-       };
-
-       enum ShuttleUnits {
-               Percentage,
-               Semitones
-       };
-
        Gtk::DrawingArea  shuttle_box;
        Gtk::EventBox     speed_display_box;
        Gtk::Label        speed_display_label;
@@ -390,8 +380,6 @@ class ARDOUR_UI : public Gtkmm2ext::UI
        Gtk::ComboBoxText shuttle_style_button;
        Gtk::Menu*        shuttle_unit_menu;
        Gtk::Menu*        shuttle_style_menu;
-       ShuttleBehaviour  shuttle_behaviour;
-       ShuttleUnits      shuttle_units;
        float             shuttle_max_speed;
        Gtk::Menu*        shuttle_context_menu;
 
@@ -399,8 +387,6 @@ class ARDOUR_UI : public Gtkmm2ext::UI
        void show_shuttle_context_menu ();
        void shuttle_style_changed();
        void shuttle_unit_clicked ();
-       void set_shuttle_behaviour (ShuttleBehaviour);
-       void set_shuttle_units (ShuttleUnits);
        void set_shuttle_max_speed (float);
        void update_speed_display ();
        float last_speed_displayed;
@@ -416,6 +402,8 @@ class ARDOUR_UI : public Gtkmm2ext::UI
        bool   shuttle_grabbed;
        double shuttle_fract;
 
+       static const double SHUTTLE_FRACT_SPEED1=0.48412291827; /* derived from A1,A2 */
+
        Gtk::ToggleButton punch_in_button;
        Gtk::ToggleButton punch_out_button;
        Gtk::ToggleButton auto_return_button;
@@ -565,7 +553,6 @@ class ARDOUR_UI : public Gtkmm2ext::UI
        void we_have_dependents ();
        void setup_keybindings ();
        void setup_session_options ();
-       void setup_config_options ();
        
        guint32  last_key_press_time;
 
@@ -670,9 +657,8 @@ class ARDOUR_UI : public Gtkmm2ext::UI
 
        std::vector<std::string> positional_sync_strings;
 
-       void toggle_config_state (const char* group, const char* action, void (ARDOUR::Configuration::*set)(bool));
-       void toggle_session_state (const char* group, const char* action, void (ARDOUR::Session::*set)(bool), bool (ARDOUR::Session::*get)(void) const);
-       void toggle_session_state (const char* group, const char* action, sigc::slot<void> theSlot);
+       void toggle_config_state (const char* group, const char* action, bool (ARDOUR::Configuration::*set)(bool), bool (ARDOUR::Configuration::*get)(void) const);
+       void toggle_config_state (const char* group, const char* action, sigc::slot<void> theSlot);
        void toggle_send_midi_feedback ();
        void toggle_use_mmc ();
        void toggle_send_mmc ();
@@ -699,9 +685,8 @@ class ARDOUR_UI : public Gtkmm2ext::UI
        void toggle_LatchedRecordEnable ();
 
        void mtc_port_changed ();
-       void map_some_session_state (const char* group, const char* action, bool (ARDOUR::Session::*get)() const);
-       void queue_session_control_changed (ARDOUR::Session::ControlType t);
-       void session_control_changed (ARDOUR::Session::ControlType t);
+       void map_some_state (const char* group, const char* action, bool (ARDOUR::Configuration::*get)() const);
+       void parameter_changed (const char*);
 
        void toggle_control_protocol (ARDOUR::ControlProtocolInfo*);
 };
index 44287fe61e79b8757a9fbaa6a45d3b3b096f3210..337362d9da07eae2ff41db3777372cdcd098fcd8 100644 (file)
@@ -130,20 +130,16 @@ ARDOUR_UI::transport_stopped ()
        update_disk_space ();
 }
 
-static const double SHUTTLE_FRACT_SPEED1=0.48412291827; /* derived from A1,A2 */
-
 void
 ARDOUR_UI::transport_rolling ()
 {
        stop_button.set_active (false);
        if (session->get_play_range()) {
-
                play_selection_button.set_active (true);
                roll_button.set_active (false);
                auto_loop_button.set_active (false);
 
-       } else if (session->get_auto_loop ()) {
-
+       } else if (Config->get_auto_loop ()) {
                auto_loop_button.set_active (true);
                play_selection_button.set_active (false);
                roll_button.set_active (false);
@@ -396,9 +392,9 @@ ARDOUR_UI::setup_transport ()
        sdframe->add (speed_display_box);
 
        mtc_port_changed ();
-       sync_option_combo.set_active_text (positional_sync_strings.front());
        sync_option_combo.signal_changed().connect (mem_fun (*this, &ARDOUR_UI::sync_option_changed));
-       Gtkmm2ext::set_size_request_to_display_given_text (sync_option_combo, "Internal", 22, 10);
+       const guint32 FUDGE = 25; // Combo's are stupid - they steal space from the entry for the button
+       set_size_request_to_display_given_text (sync_option_combo, X_("Igternal"), 2+FUDGE, 10);
 
        shbox->pack_start (*sdframe, false, false);
        shbox->pack_start (shuttle_units_button, true, true);
@@ -514,7 +510,7 @@ ARDOUR_UI::_auditioning_changed (bool onoff)
 void
 ARDOUR_UI::auditioning_changed (bool onoff)
 {
-       Gtkmm2ext::UI::instance()->call_slot(bind (mem_fun(*this, &ARDOUR_UI::_auditioning_changed), onoff));
+       UI::instance()->call_slot(bind (mem_fun(*this, &ARDOUR_UI::_auditioning_changed), onoff));
 }
 
 void
@@ -668,8 +664,8 @@ ARDOUR_UI::shuttle_box_button_release (GdkEventButton* ev)
                mouse_shuttle (ev->x, true);
                shuttle_grabbed = false;
                shuttle_box.remove_modal_grab ();
-               if (shuttle_behaviour == Sprung) {
-                       if (session->get_auto_play() || roll_button.get_state()) {
+               if (Config->get_shuttle_behaviour() == Sprung) {
+                       if (Config->get_auto_play() || roll_button.get_state()) {
                                shuttle_fract = SHUTTLE_FRACT_SPEED1;                           
                                session->request_transport_speed (1.0);
                                stop_button.set_active (false);
@@ -828,50 +824,15 @@ ARDOUR_UI::shuttle_unit_clicked ()
        shuttle_unit_menu->popup (1, 0);
 }
 
-void
-ARDOUR_UI::set_shuttle_units (ShuttleUnits u)
-{
-       switch ((shuttle_units = u)) {
-       case Percentage:
-               shuttle_units_button.set_label("% ");
-               break;
-       case Semitones:
-               shuttle_units_button.set_label(_("ST"));
-               break;
-       }
-}
-
 void
 ARDOUR_UI::shuttle_style_changed ()
 {
        ustring str = shuttle_style_button.get_active_text ();
 
        if (str == _("sprung")) {
-               set_shuttle_behaviour (Sprung);
+               Config->set_shuttle_behaviour (Sprung);
        } else if (str == _("wheel")) {
-               set_shuttle_behaviour (Wheel);
-       }
-}
-
-
-void
-ARDOUR_UI::set_shuttle_behaviour (ShuttleBehaviour b)
-{
-       switch ((shuttle_behaviour = b)) {
-       case Sprung:
-               shuttle_style_button.set_active_text (_("sprung"));
-               shuttle_fract = 0.0;
-               shuttle_box.queue_draw ();
-               if (session) {
-                       if (session->transport_rolling()) {
-                               shuttle_fract = SHUTTLE_FRACT_SPEED1;
-                               session->request_transport_speed (1.0);
-                       }
-               }
-               break;
-       case Wheel:
-               shuttle_style_button.set_active_text (_("wheel"));
-               break;
+               Config->set_shuttle_behaviour (Wheel);
        }
 }
 
@@ -892,7 +853,7 @@ ARDOUR_UI::update_speed_display ()
        if (x != last_speed_displayed) {
 
                if (x != 0) {
-                       if (shuttle_units == Percentage) {
+                       if (Config->get_shuttle_units() == Percentage) {
                                snprintf (buf, sizeof (buf), "%.2f", x);
                        } else {
                                if (x < 0) {
@@ -920,31 +881,19 @@ ARDOUR_UI::set_transport_sensitivity (bool yn)
 void
 ARDOUR_UI::editor_realized ()
 {
+       Config->map_parameters (mem_fun (*this, &ARDOUR_UI::parameter_changed));
+
        set_size_request_to_display_given_text (speed_display_box, _("-0.55"), 2, 2);
-       /* XXX: this should really be saved in instant.xml or something similar and restored from there */
-       shuttle_style_button.set_active_text (_("sprung"));
-       const guint32 FUDGE = 20; // Combo's are stupid - they steal space from the entry for the button
+       const guint32 FUDGE = 25; // Combo's are stupid - they steal space from the entry for the button
        set_size_request_to_display_given_text (shuttle_style_button, _("sprung"), 2+FUDGE, 10);
 }
 
 void
 ARDOUR_UI::sync_option_changed ()
 {
-       string which;
-
-       if (session == 0) {
-               return;
+       if (session) {
+               session->request_slave_source (string_to_slave_source (sync_option_combo.get_active_text()));
        }
-
-       which = sync_option_combo.get_active_text();
-
-       if (which == positional_sync_strings[Session::None]) {
-               session->request_slave_source (Session::None);
-       } else if (which == positional_sync_strings[Session::MTC]) {
-               session->request_slave_source (Session::MTC);
-       } else if (which == positional_sync_strings[Session::JACK]) {
-               session->request_slave_source (Session::JACK);
-       } 
 }
 
 void
index ef1906f3f5a720dd9dd1a943a1230abb0827f045..944ecdaa3317faf517b6d65b1ca911d0eb7cb8c2 100644 (file)
@@ -354,8 +354,8 @@ ARDOUR_UI::install_actions ()
 
        Glib::RefPtr<ActionGroup> shuttle_actions = ActionGroup::create ("ShuttleActions");
        
-       shuttle_actions->add (Action::create (X_("SetShuttleUnitsPercentage"), _("Percentage")), bind (mem_fun(*this, &ARDOUR_UI::set_shuttle_units), Percentage));
-       shuttle_actions->add (Action::create (X_("SetShuttleUnitsSemitones"), _("Semitones")), bind (mem_fun(*this, &ARDOUR_UI::set_shuttle_units), Semitones));
+       shuttle_actions->add (Action::create (X_("SetShuttleUnitsPercentage"), _("Percentage")), sigc::hide_return (sigc::bind (sigc::mem_fun (*Config, &Configuration::set_shuttle_units), Percentage)));
+       shuttle_actions->add (Action::create (X_("SetShuttleUnitsSemitones"), _("Semitones")), sigc::hide_return (sigc::bind (sigc::mem_fun (*Config, &Configuration::set_shuttle_units), Semitones)));
 
        Glib::RefPtr<ActionGroup> option_actions = ActionGroup::create ("options");
 
@@ -437,10 +437,6 @@ ARDOUR_UI::install_actions ()
        ActionManager::add_action_group (transport_actions);
        ActionManager::add_action_group (main_actions);
        ActionManager::add_action_group (common_actions);
-
-       /* initialize state of non-session dependent options */
-       
-       setup_config_options ();
 }
 
 void
index 21afbcde212752d62ca2a0df06a5e96982f1b0db..c77273f3ea95df4ac9fef39d4f04dbbcd5a5ce65 100644 (file)
@@ -36,99 +36,27 @@ using namespace Gtk;
 using namespace Gtkmm2ext;
 using namespace ARDOUR;
 using namespace PBD;
+using namespace sigc;
 
 void
-ARDOUR_UI::setup_config_options ()
-{
-       std::vector<Glib::ustring> groups;
-       groups.push_back("options");
-       groups.push_back("Editor");
-       groups.push_back("Transport");  
-
-       struct { 
-           char* name;
-           bool (Configuration::*method)(void) const;
-           char act_type;  //(t)oggle or (r)adio
-       } options[] = {
-               { "ToggleTimeMaster", &Configuration::get_jack_time_master, 't' },
-               { "StopPluginsWithTransport", &Configuration::get_plugins_stop_with_transport, 't' },
-               { "LatchedRecordEnable", &Configuration::get_latched_record_enable, 't' },
-               { "VerifyRemoveLastCapture", &Configuration::get_verify_remove_last_capture, 't' },
-               { "StopRecordingOnXrun", &Configuration::get_stop_recording_on_xrun, 't' },
-               { "StopTransportAtEndOfSession", &Configuration::get_stop_at_session_end, 't' },
-               { "UseHardwareMonitoring", &Configuration::get_use_hardware_monitoring, 'r' },
-               { "UseSoftwareMonitoring", &Configuration::get_use_sw_monitoring, 'r' },
-               { "UseExternalMonitoring", &Configuration::get_use_external_monitoring, 'r' },
-               { "MeterFalloffOff", &Configuration::get_meter_falloff_off, 'r' },
-               { "MeterFalloffSlowest", &Configuration::get_meter_falloff_slowest, 'r' },
-               { "MeterFalloffSlow", &Configuration::get_meter_falloff_slow, 'r' },
-               { "MeterFalloffMedium", &Configuration::get_meter_falloff_medium, 'r' },
-               { "MeterFalloffFast", &Configuration::get_meter_falloff_fast, 'r' },
-               { "MeterFalloffFaster", &Configuration::get_meter_falloff_faster, 'r' },
-               { "MeterFalloffFastest", &Configuration::get_meter_falloff_fastest, 'r' },
-               { "MeterHoldOff", &Configuration::get_meter_hold_off, 'r' },
-               { "MeterHoldShort", &Configuration::get_meter_hold_short, 'r' },
-               { "MeterHoldMedium", &Configuration::get_meter_hold_medium, 'r' },
-               { "MeterHoldLong", &Configuration::get_meter_hold_long, 'r' },
-               { "ToggleVideoSync", &Configuration::get_use_video_sync, 't' },
-               { 0, 0, 0 }
-       };
-       
-       for (uint32_t n = 0; options[n].name; ++n) {
-               for (std::vector<Glib::ustring>::iterator i = groups.begin(); i != groups.end(); i++) {
-                       Glib::RefPtr<Action> act = ActionManager::get_action (i->c_str(), options[n].name);
-                       if (act) {
-                               Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
-                               if (options[n].act_type == 't' || options[n].act_type == 'r') {
-                                       if ((Config->*(options[n].method))()) {
-                                               tact->set_active (true);
-                                       } else {
-                                               tact->set_active (false);
-                                       }
-                               }
-                               continue;
-                       }
-               }
-       }
-}
-
-void
-ARDOUR_UI::toggle_time_master ()
-{
-       toggle_config_state ("Transport", "ToggleTimeMaster", &Configuration::set_jack_time_master);
-       if (session) {
-               session->engine().reset_timebase ();
-       }
-}
-
-void
-ARDOUR_UI::toggle_config_state (const char* group, const char* action, void (Configuration::*set)(bool))
+ARDOUR_UI::toggle_config_state (const char* group, const char* action, bool (Configuration::*set)(bool), bool (Configuration::*get)(void) const)
 {
        Glib::RefPtr<Action> act = ActionManager::get_action (group, action);
        if (act) {
                Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
-               (Config->*set) (tact->get_active());
-       }
-}
-
-void
-ARDOUR_UI::toggle_session_state (const char* group, const char* action, void (Session::*set)(bool), bool (Session::*get)(void) const)
-{
-       if (session) {
-               Glib::RefPtr<Action> act = ActionManager::get_action (group, action);
-               if (act) {
-                       Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
-                       bool x = (session->*get)();
 
+               if (tact) {
+                       bool x = (Config->*get)();
+                       
                        if (x != tact->get_active()) {
-                               (session->*set) (!x);
+                               (Config->*set) (!x);
                        }
                }
        }
 }
 
 void
-ARDOUR_UI::toggle_session_state (const char* group, const char* action, sigc::slot<void> theSlot)
+ARDOUR_UI::toggle_config_state (const char* group, const char* action, sigc::slot<void> theSlot)
 {
        if (session) {
                Glib::RefPtr<Action> act = ActionManager::get_action (group, action);
@@ -141,93 +69,102 @@ ARDOUR_UI::toggle_session_state (const char* group, const char* action, sigc::sl
        }
 }
 
+void
+ARDOUR_UI::toggle_time_master ()
+{
+       toggle_config_state ("Transport", "ToggleTimeMaster", &Configuration::set_jack_time_master, &Configuration::get_jack_time_master);
+       if (session) {
+               session->engine().reset_timebase ();
+       }
+}
+
 void
 ARDOUR_UI::toggle_send_mtc ()
 {
-       toggle_session_state ("options", "SendMTC", &Session::set_send_mtc, &Session::get_send_mtc);
+       toggle_config_state ("options", "SendMTC", &Configuration::set_send_mtc, &Configuration::get_send_mtc);
 }
 
 void
 ARDOUR_UI::toggle_send_mmc ()
 {
-       toggle_session_state ("options", "SendMMC", &Session::set_send_mmc, &Session::get_send_mmc);
+       toggle_config_state ("options", "SendMMC", &Configuration::set_send_mmc, &Configuration::get_send_mmc);
 }
 
 void
 ARDOUR_UI::toggle_use_mmc ()
 {
-       toggle_session_state ("options", "UseMMC", &Session::set_mmc_control, &Session::get_mmc_control);
+       toggle_config_state ("options", "UseMMC", &Configuration::set_mmc_control, &Configuration::get_mmc_control);
 }
 
 void
 ARDOUR_UI::toggle_use_midi_control ()
 {
-       toggle_session_state ("options", "UseMIDIcontrol", &Session::set_midi_control, &Session::get_midi_control);
+       toggle_config_state ("options", "UseMIDIcontrol", &Configuration::set_midi_control, &Configuration::get_midi_control);
 }
 
 void
 ARDOUR_UI::toggle_send_midi_feedback ()
 {
-       toggle_session_state ("options", "SendMIDIfeedback", &Session::set_midi_feedback, &Session::get_midi_feedback);
+       toggle_config_state ("options", "SendMIDIfeedback", &Configuration::set_midi_feedback, &Configuration::get_midi_feedback);
 }
 
 void
 ARDOUR_UI::toggle_AutoConnectNewTrackInputsToHardware()
 {
-       toggle_session_state ("options", "AutoConnectNewTrackInputsToHardware", &Session::set_input_auto_connect, &Session::get_input_auto_connect);
+       toggle_config_state ("options", "AutoConnectNewTrackInputsToHardware", hide_return (bind (mem_fun (*Config, &Configuration::set_input_auto_connect), AutoConnectPhysical)));
 }
 void
 ARDOUR_UI::toggle_AutoConnectNewTrackOutputsToHardware()
 {
-       toggle_session_state ("options", "AutoConnectNewTrackOutputsToHardware", bind (mem_fun (session, &Session::set_output_auto_connect), Session::AutoConnectPhysical));
+       toggle_config_state ("options", "AutoConnectNewTrackOutputsToHardware", hide_return (bind (mem_fun (*Config, &Configuration::set_output_auto_connect), AutoConnectPhysical)));
 }
 void
 ARDOUR_UI::toggle_AutoConnectNewTrackOutputsToMaster()
 {
-       toggle_session_state ("options", "AutoConnectNewTrackOutputsToHardware", bind (mem_fun (session, &Session::set_output_auto_connect), Session::AutoConnectMaster));
+       toggle_config_state ("options", "AutoConnectNewTrackOutputsToHardware", hide_return (bind (mem_fun (*Config, &Configuration::set_output_auto_connect), AutoConnectMaster)));
 }
 void
 ARDOUR_UI::toggle_ManuallyConnectNewTrackOutputs()
 {
-       toggle_session_state ("options", "AutoConnectNewTrackOutputsToHardware", bind (mem_fun (session, &Session::set_output_auto_connect), Session::AutoConnectOption (0)));
+       toggle_config_state ("options", "AutoConnectNewTrackOutputsToHardware", hide_return (bind (mem_fun (*Config, &Configuration::set_output_auto_connect), AutoConnectOption (0))));
 }
 
 void
 ARDOUR_UI::toggle_auto_input ()
 {
-       toggle_session_state ("Transport", "ToggleAutoInput", &Session::set_auto_input, &Session::get_auto_input);
+       toggle_config_state ("Transport", "ToggleAutoInput", &Configuration::set_auto_input, &Configuration::get_auto_input);
 }
 
 void
 ARDOUR_UI::toggle_auto_play ()
 {
-       toggle_session_state ("Transport", "ToggleAutoPlay", &Session::set_auto_play, &Session::get_auto_play);
+       toggle_config_state ("Transport", "ToggleAutoPlay", &Configuration::set_auto_play, &Configuration::get_auto_play);
 }
 
 void
 ARDOUR_UI::toggle_auto_return ()
 {
-       toggle_session_state ("Transport", "ToggleAutoReturn", &Session::set_auto_return, &Session::get_auto_return);
+       toggle_config_state ("Transport", "ToggleAutoReturn", &Configuration::set_auto_return, &Configuration::get_auto_return);
 }
 
 void
 ARDOUR_UI::toggle_click ()
 {
-       toggle_session_state ("Transport", "ToggleClick", &Session::set_clicking, &Session::get_clicking);
+       toggle_config_state ("Transport", "ToggleClick", &Configuration::set_clicking, &Configuration::get_clicking);
 }
 
 void
 ARDOUR_UI::toggle_session_auto_loop ()
 {
        if (session) {
-               if (session->get_auto_loop()) {
+               if (Config->get_auto_loop()) {
                        if (session->transport_rolling()) {
                                transport_roll();
                        } else {
-                               session->request_auto_loop (false);
+                               session->request_play_loop (false);
                        }
                } else {
-                       session->request_auto_loop (true);
+                       session->request_play_loop (true);
                }
        }
 }
@@ -235,16 +172,16 @@ ARDOUR_UI::toggle_session_auto_loop ()
 void
 ARDOUR_UI::toggle_punch_in ()
 {
-       toggle_session_state ("Transport", "TogglePunchIn", &Session::set_punch_in, &Session::get_punch_in);
+       toggle_config_state ("Transport", "TogglePunchIn", &Configuration::set_punch_in, &Configuration::get_punch_in);
 }
 
 void
 ARDOUR_UI::toggle_punch_out ()
 {
-       toggle_session_state ("Transport", "TogglePunchOut", &Session::set_punch_out, &Session::get_punch_out);
+       toggle_config_state ("Transport", "TogglePunchOut", &Configuration::set_punch_out, &Configuration::get_punch_out);
 }
 
- void
+void
 ARDOUR_UI::toggle_video_sync()
 {
        Glib::RefPtr<Action> act = ActionManager::get_action ("Transport", "ToggleVideoSync");
@@ -322,37 +259,37 @@ ARDOUR_UI::toggle_UseExternalMonitoring()
 void
 ARDOUR_UI::toggle_StopPluginsWithTransport()
 {
-       toggle_config_state ("options", "StopPluginsWithTransport", &Configuration::set_plugins_stop_with_transport);
+       toggle_config_state ("options", "StopPluginsWithTransport", &Configuration::set_plugins_stop_with_transport, &Configuration::get_plugins_stop_with_transport);
 }
 
 void
 ARDOUR_UI::toggle_LatchedRecordEnable()
 {
-       toggle_config_state ("options", "LatchedRecordEnable", &Configuration::set_latched_record_enable);
+       toggle_config_state ("options", "LatchedRecordEnable", &Configuration::set_latched_record_enable, &Configuration::get_latched_record_enable);
 }
 
 void
 ARDOUR_UI::toggle_DoNotRunPluginsWhileRecording()
 {
-       toggle_session_state ("options", "DoNotRunPluginsWhileRecording", &Session::set_do_not_record_plugins, &Session::get_do_not_record_plugins);
+       toggle_config_state ("options", "DoNotRunPluginsWhileRecording", &Configuration::set_do_not_record_plugins, &Configuration::get_do_not_record_plugins);
 }
 
 void
 ARDOUR_UI::toggle_VerifyRemoveLastCapture()
 {
-       toggle_config_state ("options", "VerifyRemoveLastCapture", &Configuration::set_verify_remove_last_capture);
+       toggle_config_state ("options", "VerifyRemoveLastCapture", &Configuration::set_verify_remove_last_capture, &Configuration::get_verify_remove_last_capture);
 }
 
 void
 ARDOUR_UI::toggle_StopRecordingOnXrun()
 {
-       toggle_config_state ("options", "StopRecordingOnXrun", &Configuration::set_stop_recording_on_xrun);
+       toggle_config_state ("options", "StopRecordingOnXrun", &Configuration::set_stop_recording_on_xrun, &Configuration::get_stop_recording_on_xrun);
 }
 
 void
 ARDOUR_UI::toggle_StopTransportAtEndOfSession()
 {
-       toggle_config_state ("options", "StopTransportAtEndOfSession", &Configuration::set_stop_at_session_end);
+       toggle_config_state ("options", "StopTransportAtEndOfSession", &Configuration::set_stop_at_session_end, &Configuration::get_stop_at_session_end);
 }
 
 void
@@ -372,7 +309,7 @@ ARDOUR_UI::toggle_GainReduceFastTransport()
 void
 ARDOUR_UI::toggle_LatchedSolo()
 {
-       toggle_session_state ("options", "LatchedSolo", &Session::set_solo_latched, &Session::solo_latched);
+       toggle_config_state ("options", "LatchedSolo", &Configuration::set_solo_latched, &Configuration::get_solo_latched);
 }
 
 void
@@ -387,9 +324,9 @@ ARDOUR_UI::toggle_SoloViaBus()
                Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
 
                if (tact->get_active()) {
-                       session->set_solo_model (Session::SoloBus);
+                       Config->set_solo_model (SoloBus);
                } else {
-                       session->set_solo_model (Session::InverseMute);
+                       Config->set_solo_model (InverseMute);
                }
        }
 }
@@ -398,6 +335,7 @@ void
 ARDOUR_UI::toggle_AutomaticallyCreateCrossfades()
 {
 }
+
 void
 ARDOUR_UI::toggle_UnmuteNewFullCrossfades()
 {
@@ -418,24 +356,12 @@ ARDOUR_UI::mtc_port_changed ()
                have_mtc = false;
        }
 
+       positional_sync_strings.clear ();
+       positional_sync_strings.push_back (slave_source_to_string (None));
        if (have_mtc) {
-               const gchar *psync_strings[] = {
-                       N_("Internal"),
-                       N_("MTC"),
-                       N_("JACK"),
-                       0
-               };
-               
-               positional_sync_strings = PBD::internationalize (psync_strings);
-               
-       } else {
-               const gchar *psync_strings[] = {
-                       N_("Internal"),
-                       N_("JACK"),
-                       0
-               };
-               positional_sync_strings = PBD::internationalize (psync_strings);
+               positional_sync_strings.push_back (slave_source_to_string (MTC));
        }
+       positional_sync_strings.push_back (slave_source_to_string (JACK));
        
        set_popdown_strings (sync_option_combo, positional_sync_strings);
 }
@@ -445,147 +371,126 @@ ARDOUR_UI::setup_session_options ()
 {
        mtc_port_changed ();
 
-       session_control_changed (Session::SlaveType);
-       session_control_changed (Session::SendMTC);
-       session_control_changed (Session::SendMMC);
-       session_control_changed (Session::MMCControl);
-       session_control_changed (Session::MidiFeedback);
-       session_control_changed (Session::MidiControl);
-       session_control_changed (Session::RecordingPlugins);
-       session_control_changed (Session::CrossFadesActive);
-       session_control_changed (Session::SoloLatch);
-       session_control_changed (Session::SoloingModel);
-       session_control_changed (Session::LayeringModel);
-       session_control_changed (Session::CrossfadingModel);
-       session_control_changed (Session::PunchOut);
-       session_control_changed (Session::PunchIn);
-       session_control_changed (Session::AutoPlay);
-       session_control_changed (Session::AutoReturn);
-       session_control_changed (Session::AutoInput);
-       session_control_changed (Session::Clicking);
-       session_control_changed (Session::SmpteMode);
-       
-       session->ControlChanged.connect (mem_fun (*this, &ARDOUR_UI::queue_session_control_changed));
+       Config->ParameterChanged.connect (mem_fun (*this, &ARDOUR_UI::parameter_changed));
 }
 
 void
-ARDOUR_UI::map_some_session_state (const char* group, const char* action, bool (Session::*get)() const)
+ARDOUR_UI::map_some_state (const char* group, const char* action, bool (Configuration::*get)() const)
 {
-       if (!session) {
-               return;
-       }
-
        Glib::RefPtr<Action> act = ActionManager::get_action (group, action);
        if (act) {
                Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
-               bool x = (session->*get)();
-               if (tact->get_active() != x) {
-                       tact->set_active (x);
+
+               if (tact) {
+                       bool x = (Config->*get)();
+                       
+                       if (tact->get_active() != x) {
+                               tact->set_active (x);
+                       }
                }
        }
 }
 
 void
-ARDOUR_UI::queue_session_control_changed (Session::ControlType t)
-{
-       ENSURE_GUI_THREAD (bind (mem_fun (*this, &ARDOUR_UI::session_control_changed), t));
-}
-
-void
-ARDOUR_UI::session_control_changed (Session::ControlType t)
-{
-       switch (t) {
-       case Session::SlaveType:
-               switch (session->slave_source()) {
-               case Session::None:
-                       sync_option_combo.set_active_text (_("Internal"));
-                       break;
-               case Session::MTC:
-                       sync_option_combo.set_active_text (_("MTC"));
+ARDOUR_UI::parameter_changed (const char* parameter_name)
+{
+#define PARAM_IS(x) (!strcmp (parameter_name, (x)))
+
+       if (PARAM_IS ("slave-source")) {
+
+               sync_option_combo.set_active_text (slave_source_to_string (Config->get_slave_source()));
+
+       } else if (PARAM_IS ("send-mtc")) {
+
+               map_some_state ("options", "SendMTC", &Configuration::get_send_mtc);
+
+       } else if (PARAM_IS ("send-mmc")) {
+
+               map_some_state ("options", "SendMMC", &Configuration::get_send_mmc);
+
+       } else if (PARAM_IS ("mmc-control")) {
+               map_some_state ("options", "UseMMC", &Configuration::get_mmc_control);
+       } else if (PARAM_IS ("midi-feedback")) {
+               map_some_state ("options", "SendMIDIfeedback", &Configuration::get_midi_feedback);
+       } else if (PARAM_IS ("midi-control")) {
+               map_some_state ("options", "UseMIDIcontrol", &Configuration::get_midi_control);
+       } else if (PARAM_IS ("do-not-record-plugins")) {
+               map_some_state ("options", "DoNotRunPluginsWhileRecording", &Configuration::get_do_not_record_plugins);
+       } else if (PARAM_IS ("crossfades-active")) {
+               map_some_state ("options", "CrossfadesActive", &Configuration::get_crossfades_active);
+       } else if (PARAM_IS ("latched-record-enable")) {
+               map_some_state ("options", "LatchedRecordEnable", &Configuration::get_latched_record_enable);
+       } else if (PARAM_IS ("solo-latch")) {
+               map_some_state ("options", "LatchedSolo", &Configuration::get_solo_latched);
+       } else if (PARAM_IS ("solo-model")) {
+       } else if (PARAM_IS ("layer-model")) {
+       } else if (PARAM_IS ("crossfade-model")) {
+       } else if (PARAM_IS ("auto-play")) {
+               map_some_state ("Transport", "ToggleAutoPlay", &Configuration::get_auto_play);
+       } else if (PARAM_IS ("auto-loop")) {
+               map_some_state ("Transport", "Loop", &Configuration::get_auto_loop);
+       } else if (PARAM_IS ("auto-return")) {
+               map_some_state ("Transport", "ToggleAutoReturn", &Configuration::get_auto_return);
+       } else if (PARAM_IS ("auto-input")) {
+               map_some_state ("Transport", "ToggleAutoInput", &Configuration::get_auto_input);
+       } else if (PARAM_IS ("punch-out")) {
+               map_some_state ("Transport", "TogglePunchOut", &Configuration::get_punch_out);
+       } else if (PARAM_IS ("punch-in")) {
+               map_some_state ("Transport", "TogglePunchIn", &Configuration::get_punch_in);
+       } else if (PARAM_IS ("clicking")) {
+               map_some_state ("Transport", "ToggleClick", &Configuration::get_clicking);
+       } else if (PARAM_IS ("jack-time-master")) {
+               map_some_state ("Transport",  "ToggleTimeMaster", &Configuration::get_jack_time_master);
+       } else if (PARAM_IS ("plugins-stop-with-transport")) {
+               map_some_state ("options",  "StopPluginsWithTransport", &Configuration::get_plugins_stop_with_transport);
+       } else if (PARAM_IS ("latched-record-enable")) {
+               map_some_state ("options", "LatchedRecordEnable", &Configuration::get_latched_record_enable);
+       } else if (PARAM_IS ("verify-remove-last-capture")) {
+               map_some_state ("options",  "VerifyRemoveLastCapture", &Configuration::get_verify_remove_last_capture);
+       } else if (PARAM_IS ("stop-recording-on-xrun")) {
+               map_some_state ("options",  "StopRecordingOnXrun", &Configuration::get_stop_recording_on_xrun);
+       } else if (PARAM_IS ("stop-at-session-end")) {
+               map_some_state ("options",  "StopTransportAtEndOfSession", &Configuration::get_stop_at_session_end);
+       } else if (PARAM_IS ("use-hardware-monitoring")) {
+               map_some_state ("options",  "UseHardwareMonitoring", &Configuration::get_use_hardware_monitoring);
+       } else if (PARAM_IS ("use-sw-monitoring")) {
+               map_some_state ("options",  "UseSoftwareMonitoring", &Configuration::get_use_sw_monitoring);
+       } else if (PARAM_IS ("use-external-monitoring")) {
+               map_some_state ("options",  "UseExternalMonitoring", &Configuration::get_use_external_monitoring);
+       } else if (PARAM_IS ("use-video-sync")) {
+               map_some_state ("Transport",  "ToggleVideoSync", &Configuration::get_use_video_sync);
+       } else if (PARAM_IS ("quieten-at-speed")) {
+               map_some_state ("options",  "GainReduceFastTransport", &Configuration::get_quieten_at_speed);
+       } else if (PARAM_IS ("shuttle-behaviour")) {
+
+               switch (Config->get_shuttle_behaviour ()) {
+               case Sprung:
+                       shuttle_style_button.set_active_text (_("sprung"));
+                       shuttle_fract = 0.0;
+                       shuttle_box.queue_draw ();
+                       if (session) {
+                               if (session->transport_rolling()) {
+                                       shuttle_fract = SHUTTLE_FRACT_SPEED1;
+                                       session->request_transport_speed (1.0);
+                               }
+                       }
                        break;
-               case Session::JACK:
-                       sync_option_combo.set_active_text (_("JACK"));
+               case Wheel:
+                       shuttle_style_button.set_active_text (_("wheel"));
                        break;
                }
-               
-               break;
-
-       case Session::SendMTC:
-               map_some_session_state ("options", "SendMTC", &Session::get_send_mtc);
-               break;
-
-       case Session::SendMMC:
-               map_some_session_state ("options", "SendMMC", &Session::get_send_mmc);
-               break;
 
-       case Session::MMCControl:       
-               map_some_session_state ("options", "UseMMC", &Session::get_mmc_control);
-               break;
-
-       case Session::MidiFeedback:       
-               map_some_session_state ("options", "SendMIDIfeedback", &Session::get_midi_feedback);
-               break;
-
-       case Session::MidiControl:       
-               map_some_session_state ("options", "UseMIDIcontrol", &Session::get_midi_control);
-               break;
-
-       case Session::RecordingPlugins:
-               map_some_session_state ("options", "DoNotRunPluginsWhileRecording", &Session::get_do_not_record_plugins);
-               break;
-
-       case Session::CrossFadesActive:
-               map_some_session_state ("options", "CrossfadesActive", &Session::get_crossfades_active);
-               break;
-
-       case Session::SoloLatch:
-               break;
-
-       case Session::SoloingModel:
-               switch (session->solo_model()) {
-               case Session::InverseMute:
+       } else if (PARAM_IS ("shuttle-units")) {
+               
+               switch (Config->get_shuttle_units()) {
+               case Percentage:
+                       shuttle_units_button.set_label("% ");
                        break;
-               case Session::SoloBus:
+               case Semitones:
+                       shuttle_units_button.set_label(_("ST"));
                        break;
                }
-               break;
-
-       case Session::LayeringModel:
-               break;
-
-       case Session::CrossfadingModel:
-               break;
-
-       case Session::AutoPlay:
-               map_some_session_state ("Transport", "ToggleAutoPlay", &Session::get_auto_play);
-               break;
-
-       case Session::AutoLoop:
-               break;
-
-       case Session::AutoReturn:
-               map_some_session_state ("Transport", "ToggleAutoReturn", &Session::get_auto_return);
-               break;
-
-       case Session::AutoInput:
-               map_some_session_state ("Transport", "ToggleAutoInput", &Session::get_auto_input);
-               break;
-
-       case Session::PunchOut:
-               map_some_session_state ("Transport", "TogglePunchOut", &Session::get_punch_out);
-               break;
-
-       case Session::PunchIn:
-               map_some_session_state ("Transport", "TogglePunchIn", &Session::get_punch_in);
-               break;
-
-       case Session::Clicking:
-               map_some_session_state ("Transport", "ToggleClick", &Session::get_clicking);
-               break;
-
-       default:
-               // somebody else handles this 
-               break;
-
        }
+       
+#undef PARAM_IS
 }
index 8c6f3a7d8277f7ffddafe4f9821a7b708b89ff2f..d629a1a9727edebce2ea77d7eec881f71306e160 100644 (file)
@@ -1140,7 +1140,7 @@ AudioClock::get_frames (Field field,jack_nframes_t pos,int dir)
                frames = session->frame_rate();
                break;
        case SMPTE_Frames:
-               frames = (jack_nframes_t) floor (session->frame_rate() / session->smpte_frames_per_second);
+               frames = (jack_nframes_t) floor (session->frame_rate() / Config->get_smpte_frames_per_second());
                break;
 
        case AudioFrames:
@@ -1248,7 +1248,7 @@ AudioClock::smpte_sanitize_display()
                seconds_label.set_text("59");
        }
        
-       switch ((long)rint(session->smpte_frames_per_second)) {
+       switch ((long)rint(Config->get_smpte_frames_per_second())) {
        case 24:
                if (atoi(frames_label.get_text()) > 23) {
                        frames_label.set_text("23");
@@ -1268,7 +1268,7 @@ AudioClock::smpte_sanitize_display()
                break;
        }
        
-       if (session->smpte_drop_frames) {
+       if (Config->get_smpte_drop_frames()) {
                if ((atoi(minutes_label.get_text()) % 10) && (atoi(seconds_label.get_text()) == 0) && (atoi(frames_label.get_text()) < 2)) {
                        frames_label.set_text("02");
                }
index 3e4a14d86a482dd48b9505fa383c729703474351..f491da43b213ac961cd5b090f497eeaf23214244 100644 (file)
@@ -861,6 +861,7 @@ gnome_canvas_waveview_get_property (GObject      *object,
 
        case PROP_RECTIFIED:
                g_value_set_boolean (value, waveview->rectified);
+               break;
 
        case PROP_REGION_START:
                g_value_set_uint (value, waveview->region_start);
index 0729533f76febe22fd1bb25cd1e1cefe06522ce2..9011e3efa2c5624f9c8460f9509cba3954d01665 100644 (file)
@@ -1003,36 +1003,28 @@ Editor::on_realize ()
 }
 
 void
-Editor::queue_session_control_changed (Session::ControlType t)
+Editor::parameter_changed (const char* parameter_name)
 {
-       Gtkmm2ext::UI::instance()->call_slot (bind (mem_fun(*this, &Editor::session_control_changed), t));
-}
+#define PARAM_IS(x) (!strcmp (parameter_name, (x)))
 
-void
-Editor::session_control_changed (Session::ControlType t)
-{
-       // right now we're only tracking some state here 
+       ENSURE_GUI_THREAD (bind (mem_fun (*this, &Editor::parameter_changed), parameter_name));
 
-       switch (t) {
-       case Session::AutoLoop:
+       if (PARAM_IS ("auto-loop")) {
                update_loop_range_view (true);
-               break;
-       case Session::PunchIn:
-       case Session::PunchOut:
+       } else if (PARAM_IS ("punch-in")) {
                update_punch_range_view (true);
-               break;
-
-       case Session::LayeringModel:
+       } else if (PARAM_IS ("punch-out")) {
+               update_punch_range_view (true);
+       } else if (PARAM_IS ("layer-model")) {
                update_layering_model ();
-               break;
-
-       case Session::SmpteMode:
+       } else if (PARAM_IS ("smpte-frames-per-second") || PARAM_IS ("smpte-drop-frames")) {
                update_smpte_mode ();
-               break;
+               update_just_smpte ();
+       } else if (PARAM_IS ("video-pullup")) {
+               update_video_pullup ();
+       } 
 
-       default:
-               break;
-       }
+#undef PARAM_IS
 }
 
 void
@@ -1174,10 +1166,6 @@ Editor::connect_to_session (Session *t)
        session_connections.push_back (session->RegionHiddenChange.connect (mem_fun(*this, &Editor::region_hidden)));
 
        session_connections.push_back (session->SMPTEOffsetChanged.connect (mem_fun(*this, &Editor::update_just_smpte)));
-       session_connections.push_back (session->SMPTETypeChanged.connect (mem_fun(*this, &Editor::update_just_smpte)));
-
-       session_connections.push_back (session->SMPTETypeChanged.connect (mem_fun(*this, &Editor::update_smpte_mode)));
-       session_connections.push_back (session->PullupChanged.connect (mem_fun(*this, &Editor::update_video_pullup)));
 
        session_connections.push_back (session->tempo_map().StateChanged.connect (mem_fun(*this, &Editor::tempo_map_changed)));
 
@@ -1193,7 +1181,7 @@ Editor::connect_to_session (Session *t)
                analysis_window->set_session (session);
 #endif
 
-       switch (session->get_edit_mode()) {
+       switch (Config->get_edit_mode()) {
        case Splice:
                edit_mode_selector.set_active_text (edit_mode_strings[splice_index]);
                break;
@@ -1234,7 +1222,6 @@ Editor::connect_to_session (Session *t)
        update_loop_range_view (true);
        update_punch_range_view (true);
        
-       session->ControlChanged.connect (mem_fun(*this, &Editor::queue_session_control_changed));
        session->StateSaved.connect (mem_fun(*this, &Editor::session_state_saved));
        
        refresh_location_display ();
@@ -1251,7 +1238,7 @@ Editor::connect_to_session (Session *t)
        if (act) {
                RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act);
                /* do it twice to force the change */
-               yn = session->get_crossfades_active();
+               yn = Config->get_crossfades_active();
                tact->set_active (!yn);
                tact->set_active (yn);
        }
@@ -3522,7 +3509,7 @@ Editor::edit_mode_selection_done ()
                mode = Slide;
        }
 
-       session->set_edit_mode (mode);
+       Config->set_edit_mode (mode);
 }      
 
 void
@@ -4156,8 +4143,8 @@ Editor::update_smpte_mode ()
 
        RefPtr<Action> act;
 
-       float frames = session->smpte_frames_per_second;
-       bool drop = session->smpte_drop_frames;
+       float frames = Config->get_smpte_frames_per_second();
+       bool drop = Config->get_smpte_drop_frames();
 
        if ((frames < 23.976 * 1.0005) && !drop)
                act = ActionManager::get_action (X_("Editor"), X_("Smpte23976"));
@@ -4198,7 +4185,7 @@ Editor::update_video_pullup ()
 
        RefPtr<Action> act;
 
-       float pullup = session->video_pullup;
+       float pullup = Config->get_video_pullup();
 
        if ( pullup < (-4.1667 - 0.1) * 0.99) {
                act = ActionManager::get_action (X_("Editor"), X_("PullupMinus4Minus1"));
@@ -4235,14 +4222,14 @@ Editor::update_layering_model ()
 {
        RefPtr<Action> act;
 
-       switch (session->get_layer_model()) {
-       case Session::LaterHigher:
+       switch (Config->get_layer_model()) {
+       case LaterHigher:
                act = ActionManager::get_action (X_("Editor"), X_("LayerLaterHigher"));
                break;
-       case Session::MoveAddHigher:
+       case MoveAddHigher:
                act = ActionManager::get_action (X_("Editor"), X_("LayerMoveAddHigher"));
                break;
-       case Session::AddHigher:
+       case AddHigher:
                act = ActionManager::get_action (X_("Editor"), X_("LayerAddHigher"));
                break;
        }
@@ -4260,7 +4247,7 @@ Editor::update_crossfade_model ()
 {
        RefPtr<Action> act;
 
-       switch (session->get_xfade_model()) {
+       switch (Config->get_xfade_model()) {
        case FullCrossfade:
                act = ActionManager::get_action (X_("Editor"), X_("CrossfadesFull"));
                break;
index f5fb65e7e9c2bc1d87e2a5c389da651d434f7fa1..b69febb8b1fc6a9a4f301a104b860cbe8828f5a5 100644 (file)
@@ -298,9 +298,6 @@ class Editor : public PublicEditor
        void toggle_waveforms_while_recording ();
        void toggle_measure_visibility ();
 
-       void set_meter_falloff (int);
-       void set_meter_hold (int32_t);
-
        /* SMPTE timecode & video sync */
 
        void smpte_fps_chosen (ARDOUR::Session::SmpteFormat format);
@@ -320,7 +317,7 @@ class Editor : public PublicEditor
 
 
        /* layers */
-       void set_layer_model (ARDOUR::Session::LayerModel);
+       void set_layer_model (ARDOUR::LayerModel);
        void update_layering_model ();
 
        /* redirect shared ops menu. caller must free returned menu */
@@ -488,9 +485,7 @@ class Editor : public PublicEditor
        ArdourCanvas::Text* verbose_canvas_cursor;
        bool                 verbose_cursor_visible;
 
-       void session_control_changed (ARDOUR::Session::ControlType);
-       void queue_session_control_changed (ARDOUR::Session::ControlType);
-
+       void parameter_changed (const char *);
        
        bool track_canvas_motion (GdkEvent*);
 
index f1b9ef4b83a76d086b7b79640e71d70b29f92384..229177d5c306e5fbdf4b0b69957245b58ec148bc 100644 (file)
@@ -376,24 +376,24 @@ Editor::register_actions ()
            Slow    = 6.8dB/sec falloff at update rate of 40ms
        */
 
-       ActionManager::register_radio_action (editor_actions, meter_falloff_group, X_("MeterFalloffOff"), _("Off"), bind (mem_fun (*this, &Editor::set_meter_falloff), 0));
-       ActionManager::register_radio_action (editor_actions, meter_falloff_group, X_("MeterFalloffSlowest"), _("Slowest"), bind (mem_fun (*this, &Editor::set_meter_falloff), 1)); 
-       ActionManager::register_radio_action (editor_actions, meter_falloff_group, X_("MeterFalloffSlow"), _("Slow"), bind (mem_fun (*this, &Editor::set_meter_falloff), 2));
-       ActionManager::register_radio_action (editor_actions, meter_falloff_group, X_("MeterFalloffMedium"), _("Medium"), bind (mem_fun (*this, &Editor::set_meter_falloff), 3));
-       ActionManager::register_radio_action (editor_actions, meter_falloff_group, X_("MeterFalloffFast"), _("Fast"), bind (mem_fun (*this, &Editor::set_meter_falloff), 4));
-       ActionManager::register_radio_action (editor_actions, meter_falloff_group, X_("MeterFalloffFaster"), _("Faster"), bind (mem_fun (*this, &Editor::set_meter_falloff), 5));
-       ActionManager::register_radio_action (editor_actions, meter_falloff_group, X_("MeterFalloffFastest"), _("Fastest"), bind (mem_fun (*this, &Editor::set_meter_falloff), 6));
-
-       ActionManager::register_radio_action (editor_actions, meter_hold_group,  X_("MeterHoldOff"), _("Off"), bind (mem_fun (*this, &Editor::set_meter_hold), 0));
-       ActionManager::register_radio_action (editor_actions, meter_hold_group,  X_("MeterHoldShort"), _("Short"), bind (mem_fun (*this, &Editor::set_meter_hold), 40));
-       ActionManager::register_radio_action (editor_actions, meter_hold_group,  X_("MeterHoldMedium"), _("Medium"), bind (mem_fun (*this, &Editor::set_meter_hold), 100));
-       ActionManager::register_radio_action (editor_actions, meter_hold_group,  X_("MeterHoldLong"), _("Long"), bind (mem_fun (*this, &Editor::set_meter_hold), 200));
+       ActionManager::register_radio_action (editor_actions, meter_falloff_group, X_("MeterFalloffOff"), _("Off"), hide_return (bind (mem_fun (*Config, &Configuration::set_meter_falloff), 0.0f)));
+       ActionManager::register_radio_action (editor_actions, meter_falloff_group, X_("MeterFalloffSlowest"), _("Slowest"), hide_return (bind (mem_fun (*Config, &Configuration::set_meter_falloff), 1.0f)));
+       ActionManager::register_radio_action (editor_actions, meter_falloff_group, X_("MeterFalloffSlow"), _("Slow"), hide_return (bind (mem_fun (*Config, &Configuration::set_meter_falloff), 2.0f)));
+       ActionManager::register_radio_action (editor_actions, meter_falloff_group, X_("MeterFalloffMedium"), _("Medium"), hide_return (bind (mem_fun (*Config, &Configuration::set_meter_falloff), 3.0f)));
+       ActionManager::register_radio_action (editor_actions, meter_falloff_group, X_("MeterFalloffFast"), _("Fast"), hide_return (bind (mem_fun (*Config, &Configuration::set_meter_falloff), 4.0f)));
+       ActionManager::register_radio_action (editor_actions, meter_falloff_group, X_("MeterFalloffFaster"), _("Faster"), hide_return (bind (mem_fun (*Config, &Configuration::set_meter_falloff), 5.0f)));
+       ActionManager::register_radio_action (editor_actions, meter_falloff_group, X_("MeterFalloffFastest"), _("Fastest"), hide_return (bind (mem_fun (*Config, &Configuration::set_meter_falloff), 6.0f)));
+
+       ActionManager::register_radio_action (editor_actions, meter_hold_group,  X_("MeterHoldOff"), _("Off"), hide_return (bind (mem_fun (*Config, &Configuration::set_meter_hold), 0.0f)));
+       ActionManager::register_radio_action (editor_actions, meter_hold_group,  X_("MeterHoldShort"), _("Short"), hide_return (bind (mem_fun (*Config, &Configuration::set_meter_hold), 40.0f)));
+       ActionManager::register_radio_action (editor_actions, meter_hold_group,  X_("MeterHoldMedium"), _("Medium"), hide_return (bind (mem_fun (*Config, &Configuration::set_meter_hold), 100.0f)));
+       ActionManager::register_radio_action (editor_actions, meter_hold_group,  X_("MeterHoldLong"), _("Long"), hide_return (bind (mem_fun (*Config, &Configuration::set_meter_hold), 200.0f)));
 
        RadioAction::Group layer_model_group;
 
-       ActionManager::register_radio_action (editor_actions, layer_model_group,  X_("LayerLaterHigher"), _("Later is Higher"), bind (mem_fun (*this, &Editor::set_layer_model), Session::LaterHigher));
-       ActionManager::register_radio_action (editor_actions, layer_model_group,  X_("LayerMoveAddHigher"), _("Most Recently Moved/Added is Higher"), bind (mem_fun (*this, &Editor::set_layer_model), Session::MoveAddHigher));
-       ActionManager::register_radio_action (editor_actions, layer_model_group,  X_("LayerAddHigher"), _("Most Recently Added is Higher"), bind (mem_fun (*this, &Editor::set_layer_model), Session::AddHigher));
+       ActionManager::register_radio_action (editor_actions, layer_model_group,  X_("LayerLaterHigher"), _("Later is Higher"), bind (mem_fun (*this, &Editor::set_layer_model), LaterHigher));
+       ActionManager::register_radio_action (editor_actions, layer_model_group,  X_("LayerMoveAddHigher"), _("Most Recently Moved/Added is Higher"), bind (mem_fun (*this, &Editor::set_layer_model), MoveAddHigher));
+       ActionManager::register_radio_action (editor_actions, layer_model_group,  X_("LayerAddHigher"), _("Most Recently Added is Higher"), bind (mem_fun (*this, &Editor::set_layer_model), AddHigher));
 
        RadioAction::Group smpte_group;
 
@@ -473,7 +473,7 @@ Editor::toggle_xfades_active ()
        Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("toggle-xfades-active"));
        if (session && act) {
                Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
-               session->set_crossfades_active (tact->get_active());
+               Config->set_crossfades_active (tact->get_active());
        }
 }
 
@@ -488,7 +488,7 @@ Editor::toggle_xfade_visibility ()
 }
 
 void
-Editor::set_layer_model (Session::LayerModel model)
+Editor::set_layer_model (LayerModel model)
 {
        /* this is driven by a toggle on a radio group, and so is invoked twice,
           once for the item that became inactive and once for the one that became
@@ -499,13 +499,13 @@ Editor::set_layer_model (Session::LayerModel model)
 
        if (session) {
                switch (model) {
-               case Session::LaterHigher:
+               case LaterHigher:
                        act = ActionManager::get_action (X_("Editor"), X_("LayerLaterHigher"));
                        break;
-               case Session::MoveAddHigher:
+               case MoveAddHigher:
                        act = ActionManager::get_action (X_("Editor"), X_("LayerMoveAddHigher"));
                        break;
-               case Session::AddHigher:
+               case AddHigher:
                        act = ActionManager::get_action (X_("Editor"), X_("LayerAddHigher"));
                        break;
                }
@@ -513,7 +513,7 @@ Editor::set_layer_model (Session::LayerModel model)
                if (act) {
                        RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
                        if (ract && ract->get_active()) {
-                               session->set_layer_model (model);
+                               Config->set_layer_model (model);
                        }
                }
        }
@@ -656,7 +656,7 @@ Editor::video_pullup_chosen (Session::PullupFormat pullup)
                if (act) {
                        RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
                        if (ract && ract->get_active()) {
-                               session->set_video_pullup ( pull );
+                               Config->set_video_pullup ( pull );
                        }
                } else  cerr << "Editor::video_pullup_chosen could not find action to match pullup." << endl;
        }
@@ -686,7 +686,7 @@ Editor::set_crossfade_model (CrossfadeModel model)
                if (act) {
                        RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
                        if (ract && ract->get_active()) {
-                               session->set_xfade_model (model);
+                               Config->set_xfade_model (model);
                        }
                }
        }
index 2b3d983ab412c0ecd0e6ce6a806d514c4168d46b..8f964cc1c4e90265605f3d5b8efe453fd1def3c6 100644 (file)
@@ -294,7 +294,7 @@ Editor::embed_sndfile (Glib::ustring path, bool split, bool multiple_files, bool
        
        input_chan = finfo.channels;
        
-       if (session->get_output_auto_connect() & Session::AutoConnectMaster) {
+       if (Config->get_output_auto_connect() & AutoConnectMaster) {
                output_chan = (session->master_out() ? session->master_out()->n_inputs() : input_chan);
        } else {
                output_chan = input_chan;
index 5b575b4814f48ae25a12295822ef04706c14fd76..aaf271f9b76da8a2e66d3b8ece53c739ad220643 100644 (file)
@@ -27,7 +27,7 @@ Editor::set_route_loop_selection ()
                loc->set (start, end);
 
                // enable looping, reposition and start rolling
-               session->request_auto_loop (true);
+               session->request_play_loop (true);
                session->request_locate (loc->start(), true);
        }
 
index 40f00c2e109be2e24c8621f4badc5a0dec96e8f4..66c54c14b7cb8425d9d6b411b07e52540c1bccf6 100644 (file)
@@ -745,7 +745,7 @@ Editor::marker_menu_loop_range ()
                        l2->set (l->start(), l->end());
                        
                        // enable looping, reposition and start rolling
-                       session->request_auto_loop(true);
+                       session->request_play_loop(true);
                        session->request_locate (l2->start(), true);
                }
        }
@@ -925,7 +925,7 @@ Editor::update_loop_range_view (bool visibility)
 
        Location* tll;
 
-       if (session->get_auto_loop() && ((tll = transport_loop_location()) != 0)) {
+       if (Config->get_auto_loop() && ((tll = transport_loop_location()) != 0)) {
 
                double x1 = frame_to_pixel (tll->start());
                double x2 = frame_to_pixel (tll->end());
@@ -951,7 +951,7 @@ Editor::update_punch_range_view (bool visibility)
 
        Location* tpl;
 
-       if ((session->get_punch_in() || session->get_punch_out()) && ((tpl = transport_punch_location()) != 0)) {
+       if ((Config->get_punch_in() || Config->get_punch_out()) && ((tpl = transport_punch_location()) != 0)) {
 
                double x1 = frame_to_pixel (tpl->start());
                double x2 = frame_to_pixel (tpl->end());
index 62f7d7be0dd643f6951e10977deb06136bcab7a2..70c6694152a1b327c2f59115e2c751c3e75ec584 100644 (file)
@@ -3513,7 +3513,7 @@ Editor::show_verbose_time_cursor (jack_nframes_t frame, double offset, double xp
        case AudioClock::MinSec:
                /* XXX fix this to compute min/sec properly */
                session->smpte_time (frame, smpte);
-               secs = smpte.seconds + ((float) smpte.frames / session->smpte_frames_per_second);
+               secs = smpte.seconds + ((float) smpte.frames / Config->get_smpte_frames_per_second());
                snprintf (buf, sizeof (buf), "%02" PRId32 ":%02" PRId32 ":%.4f", smpte.hours, smpte.minutes, secs);
                break;
 
@@ -3580,7 +3580,7 @@ Editor::show_verbose_duration_cursor (jack_nframes_t start, jack_nframes_t end,
        case AudioClock::MinSec:
                /* XXX fix this to compute min/sec properly */
                session->smpte_duration (end - start, smpte);
-               secs = smpte.seconds + ((float) smpte.frames / session->smpte_frames_per_second);
+               secs = smpte.seconds + ((float) smpte.frames / Config->get_smpte_frames_per_second());
                snprintf (buf, sizeof (buf), "%02" PRId32 ":%02" PRId32 ":%.4f", smpte.hours, smpte.minutes, secs);
                break;
 
index 637ba1c6769504677a841bb218d76afdb274c32b..9c100521a792bc506945e6dabbf757ac46a0df42 100644 (file)
@@ -90,87 +90,6 @@ Editor::redo (uint32_t n)
        }
 }
 
-void
-Editor::set_meter_hold (int32_t cnt)
-{
-       Config->set_meter_hold_off(false);
-       Config->set_meter_hold_short(false);
-       Config->set_meter_hold_medium(false);
-       Config->set_meter_hold_long(false);
-
-       switch (cnt)
-       {
-               case 0:
-                Config->set_meter_hold_off(true);
-                break;
-               case 40:
-                Config->set_meter_hold_short(true);
-                break;
-               case 100:
-                Config->set_meter_hold_medium(true);
-                break;
-               case 200:
-                Config->set_meter_hold_long(true);
-                break;
-       }
-                
-       if (session) {
-               session->set_meter_hold (cnt);
-       }
-}
-
-void
-Editor::set_meter_falloff (int intval)
-{
-       float val = 0.0f; /* off */
-       std::string str;
-
-       Config->set_meter_falloff_off(false);
-       Config->set_meter_falloff_slowest(false);
-       Config->set_meter_falloff_slow(false);
-       Config->set_meter_falloff_medium(false);
-       Config->set_meter_falloff_fast(false);
-       Config->set_meter_falloff_faster(false);
-       Config->set_meter_falloff_fastest(false);
-       
-       switch (intval)
-       {
-               case 0:
-                val = 0.0f;
-                Config->set_meter_falloff_off(true);
-                break;
-               case 1:
-                val = 0.125f;
-                Config->set_meter_falloff_slowest(true);
-                break;
-               case 2:
-                val = 0.250f;
-                Config->set_meter_falloff_slow(true);
-                break;
-               case 3:
-                val = 0.375f;
-                Config->set_meter_falloff_medium(true);
-                break;
-               case 4:
-                val = 0.500f;
-                Config->set_meter_falloff_fast(true);
-                break;
-               case 5:
-                val = 0.750f;
-                Config->set_meter_falloff_faster(true);
-                break;
-               case 6:
-                val = 0.875f;
-                Config->set_meter_falloff_fastest(true);
-                break;
-       }
-       
-       if (session) {
-               session->set_meter_falloff (val);
-       }
-}
-
-
 int
 Editor::ensure_cursor (jack_nframes_t *pos)
 {
@@ -1898,9 +1817,9 @@ Editor::toggle_playback (bool with_abort)
                return;
        }
 
-       switch (session->slave_source()) {
-       case Session::None:
-       case Session::JACK:
+       switch (Config->get_slave_source()) {
+       case None:
+       case JACK:
                break;
        default:
                /* transport controlled by the master */
@@ -1914,8 +1833,8 @@ Editor::toggle_playback (bool with_abort)
        
        if (session->transport_rolling()) {
                session->request_stop (with_abort);
-               if (session->get_auto_loop()) {
-                       session->request_auto_loop (false);
+               if (Config->get_auto_loop()) {
+                       session->request_play_loop (false);
                }
        } else {
                session->request_transport_speed (1.0f);
@@ -1961,7 +1880,7 @@ Editor::loop_selected_region ()
                        
                        // enable looping, reposition and start rolling
 
-                       session->request_auto_loop (true);
+                       session->request_play_loop (true);
                        session->request_locate (tll->start(), false);
                        session->request_transport_speed (1.0f);
                }
@@ -1991,7 +1910,7 @@ Editor::loop_location (Location& location)
                tll->set (location.start(), location.end());
 
                // enable looping, reposition and start rolling
-               session->request_auto_loop (true);
+               session->request_play_loop (true);
                session->request_locate (tll->start(), true);
        }
 }
index d2e829581a4c50b3957b346d755c1ba254468776..d55301189837f0b67a02ab753dcca975812ff7fe 100644 (file)
@@ -201,7 +201,7 @@ GainMeter::GainMeter (boost::shared_ptr<IO> io, Session& s)
        gain_adjustment.signal_value_changed().connect (mem_fun(*this, &GainMeter::gain_adjusted));
        peak_display.signal_button_release_event().connect (mem_fun(*this, &GainMeter::peak_button_release));
 
-       _session.MeterHoldChanged.connect (mem_fun(*this, &GainMeter::meter_hold_changed));
+       Config->ParameterChanged.connect (mem_fun (*this, &GainMeter::parameter_changed));
 
        gain_changed (0);
        update_gain_sensitive ();
@@ -346,17 +346,24 @@ GainMeter::update_meters ()
 }
 
 void
-GainMeter::meter_hold_changed()
+GainMeter::parameter_changed(const char* parameter_name)
 {
-       ENSURE_GUI_THREAD(mem_fun(*this, &GainMeter::meter_hold_changed));
-       
-       vector<MeterInfo>::iterator i;
-       uint32_t n;
+#define PARAM_IS(x) (!strcmp (parameter_name, (x)))
+
+       ENSURE_GUI_THREAD (bind (mem_fun(*this, &GainMeter::parameter_changed), parameter_name));
+
+       if (PARAM_IS ("meter-hold")) {
        
-       for (n = 0, i = meters.begin(); i != meters.end(); ++i, ++n) {
+               vector<MeterInfo>::iterator i;
+               uint32_t n;
                
-               (*i).meter->set_hold_count ((uint32_t) floor(_session.meter_hold()));
+               for (n = 0, i = meters.begin(); i != meters.end(); ++i, ++n) {
+                       
+                       (*i).meter->set_hold_count ((uint32_t) floor(Config->get_meter_hold()));
+               }
        }
+
+#undef PARAM_IS
 }
 
 void
@@ -424,7 +431,7 @@ GainMeter::setup_meters ()
        for (uint32_t n = 0; n < nmeters; ++n) {
                if (meters[n].width != width) {
                        delete meters[n].meter;
-                       meters[n].meter = new FastMeter ((uint32_t) floor (_session.meter_hold()), width, FastMeter::Vertical);
+                       meters[n].meter = new FastMeter ((uint32_t) floor (Config->get_meter_hold()), width, FastMeter::Vertical);
                        meters[n].width = width;
 
                        meters[n].meter->add_events (Gdk::BUTTON_RELEASE_MASK);
index 1dfc088248b200448687e7e0e907e9854b10e913..bbc12ccb6ce37567c906f2cb3747c8da14e003ef 100644 (file)
@@ -172,7 +172,7 @@ class GainMeter : public Gtk::VBox
        bool wait_for_release;
        ARDOUR::MeterPoint old_meter_point;
 
-       void meter_hold_changed();
+       void parameter_changed (const char*);
 
        void reset_peak_display ();
        void reset_group_peak_display (ARDOUR::RouteGroup*);
index 7d716e1bb894881a8fa3bf6e93f936e3ecde3822..ce7a129d081dbf28a0cc8a8d30df6d20bafd7086 100644 (file)
@@ -441,6 +441,7 @@ int main (int argc, char *argv[])
 
        try {
                ARDOUR::init (use_vst, try_hw_optimization);
+               Config->set_current_owner (ConfigVariableBase::Interface);
                ui->set_engine (*engine);
        } catch (failed_constructor& err) {
                error << _("could not initialize Ardour.") << endmsg;
index 013761a86a091b08cd76b23a7243042431efe863..ac2296ea55ba8056dd38836e9c7b37ad5ad201b8 100644 (file)
@@ -248,16 +248,16 @@ OptionEditor::add_session_paths ()
        click_emphasis_path_entry.set_sensitive (true);
        session_raid_entry.set_sensitive (true);
 
-       if (session->click_sound.length() == 0) {
+       if (Config->get_click_sound().empty()) {
                click_path_entry.set_text (_("internal"));
        } else {
-               click_path_entry.set_text (session->click_sound);
+               click_path_entry.set_text (Config->get_click_sound());
        }
 
-       if (session->click_emphasis_sound.length() == 0) {
+       if (Config->get_click_emphasis_sound().empty()) {
                click_emphasis_path_entry.set_text (_("internal"));
        } else {
-               click_emphasis_path_entry.set_text (session->click_emphasis_sound);
+               click_emphasis_path_entry.set_text (Config->get_click_emphasis_sound());
        }
 
        session_raid_entry.set_text(session->raid_path());
@@ -607,7 +607,7 @@ void
 OptionEditor::raid_path_changed ()
 {
        if (session) {
-               session->set_raid_path (session_raid_entry.get_text());
+               Config->set_raid_path (session_raid_entry.get_text());
        }
 }
 
@@ -655,22 +655,22 @@ OptionEditor::click_sound_changed ()
        if (session) {
                string path = click_path_entry.get_text();
 
-               if (path == session->click_sound) {
+               if (path == Config->get_click_sound()) {
                        return;
                }
 
-               if (path.length() == 0) {
+               if (path.empty()) {
 
-                       session->set_click_sound ("");
+                       Config->set_click_sound ("");
 
                } else {
 
                        strip_whitespace_edges (path);
                        
                        if (path == _("internal")) {
-                               session->set_click_sound ("");
+                               Config->set_click_sound ("");
                        } else {
-                               session->set_click_sound (path);
+                               Config->set_click_sound (path);
                        }
                }
        }
@@ -682,22 +682,22 @@ OptionEditor::click_emphasis_sound_changed ()
        if (session) {
                string path = click_emphasis_path_entry.get_text();
 
-               if (path == session->click_emphasis_sound) {
+               if (path == Config->get_click_emphasis_sound()) {
                        return;
                }
 
-               if (path.length() == 0) {
+               if (path.empty()) {
 
-                       session->set_click_emphasis_sound ("");
+                       Config->set_click_emphasis_sound ("");
 
                } else {
 
                        strip_whitespace_edges (path);
 
                        if (path == _("internal")) {
-                               session->set_click_emphasis_sound ("");
+                               Config->set_click_emphasis_sound ("");
                        } else {
-                               session->set_click_emphasis_sound (path);
+                               Config->set_click_emphasis_sound (path);
                        }
                }
        }
index 897f5f384777f74f84130c5ca57eb4c65c532fa9..88b8b304e4cf0e7ffc26ec7d70b1dff5fd422386 100644 (file)
@@ -113,7 +113,7 @@ SendUI::update ()
 void
 SendUI::fast_update ()
 {
-       if (_session.meter_falloff() > 0.0f) {
+       if (Config->get_meter_falloff() > 0.0f) {
                gpm.update_meters ();
        }
 }
index 8d51343ffbd1bad6a48c117aedd66c688d550bb6..0b933cc5ac4169aafcaf46e07352c255f8cdbcc8 100644 (file)
@@ -55,11 +55,17 @@ class Configuration : public Stateful
 
        std::map<std::string,MidiPortDescriptor *> midi_ports;
 
+       void map_parameters (sigc::slot<void,const char*> 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;
index cdd9b2428449de6b94f1e44281a2f93bc36abae5..4eba3101a230ec8d10696532f6a50bc62370edbd 100644 (file)
@@ -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<class T>
@@ -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<T>
        ConfigVariableWithMutation (std::string name, T val, T (*m)(T)) 
                : ConfigVariable<T> (name, val), mutator (m) {}
 
-       void set (T val) {
-               unmutated_value = val;
-               ConfigVariable<T>::set (mutator (val));
+       bool set (T val, ConfigVariableBase::Owner owner) {
+               if (unmutated_value != val) {
+                       unmutated_value = val;
+                       return ConfigVariable<T>::set (mutator (val), owner);
+               } 
+               return false;
        }
 
   protected:
index 5222eefb0a4da087eabee287c86feecae216eb77..124a500d9ffff7c23496b6bb9aa78269eefd045a 100644 (file)
@@ -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 */
 
index 8b4123d4f0edd1e0698f283d5ee9d5caf8defa8a..36a8393ccdffcf0c4ee58a08c7c87c944b2cd42e 100644 (file)
@@ -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<void,ControlType> 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<void> MeterHoldChanged;
-
-       float   meter_falloff () { return _meter_falloff; }
-       void    set_meter_falloff (float);
-       sigc::signal<void> 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<void> StartTimeChanged;
        static sigc::signal<void> EndTimeChanged;
        static sigc::signal<void> SMPTEOffsetChanged;
-       static sigc::signal<void> SMPTETypeChanged;
-       static sigc::signal<void> 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<void,Connection *> 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<IO>  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<AudioRegion> 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<Event*> 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<Route*> 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
index 39c06b6dcce76107109cf433c3d3feafc8e5bb11..b70448e8a560c7f3bc37f816ef51cc3a21e8c417 100644 (file)
@@ -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<boost::shared_ptr<AudioSource> > 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)
index 214e74156c6732cb1fe42848e64bc172758dfa06..ab9f2ad952e03aa72ea42e6da56fa7dfac884ad9 100644 (file)
@@ -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
index f0ea938ca61e8b008453907efc719a21952442f0..f1d6cb2db8de61d5dbe8ebcb106e154eb814b8a2 100644 (file)
@@ -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());
index 59425fcf1d7797a2107a39865eecb396db9c1a7c..e7e410afe3889afa2f13a44548369306e62191f0 100644 (file)
@@ -450,7 +450,7 @@ AudioPlaylist::check_dependents (boost::shared_ptr<Region> 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);
                                }
                        } 
index 18a13f5f3fa4fd4b97105437d21311837e14f885..7d6fd7520643369f55d9a8ea76b78b8baf06a4f7 100644 (file)
@@ -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 */
index 84c3e3a83444d9e1685d9b9f9daaeb07bdb93b93..d811be0f6e2f641167ce36befbc114ddede797fd 100644 (file)
@@ -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<string, MidiPortDescriptor*>::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<string, MidiPortDescriptor*>::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<void,const char*> theSlot)
+{
+#undef  CONFIG_VARIABLE
+#undef  CONFIG_VARIABLE_SPECIAL        
+#define CONFIG_VARIABLE(type,var,name,value)                 theSlot (name);
+#define CONFIG_VARIABLE_SPECIAL(type,var,name,value,mutator) theSlot (name);
+#include "ardour/configuration_vars.h"
+#undef  CONFIG_VARIABLE
+#undef  CONFIG_VARIABLE_SPECIAL        
+}
index 59a12a29170e76c5dba2aa0a3666e4f52a046bd6..c9c244ca3c12bee53032f5dbf937a3fb5a5c813e 100644 (file)
@@ -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<class T>
+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<HeaderFormat> (o, var); }
+std::istream& operator>>(std::istream& o, SampleFormat& var) { return int_to_type<SampleFormat> (o, var); }
+std::istream& operator>>(std::istream& o, AutoConnectOption& var) { return int_to_type<AutoConnectOption> (o, var); }
+std::istream& operator>>(std::istream& o, EditMode& var) { return int_to_type<EditMode> (o, var); }
+std::istream& operator>>(std::istream& o, SoloModel& var) { return int_to_type<SoloModel> (o, var); }
+std::istream& operator>>(std::istream& o, LayerModel& var) { return int_to_type<LayerModel> (o, var); }
+std::istream& operator>>(std::istream& o, CrossfadeModel& var) { return int_to_type<CrossfadeModel> (o, var); }
+std::istream& operator>>(std::istream& o, SlaveSource& var) { return int_to_type<SlaveSource> (o, var); }
+std::istream& operator>>(std::istream& o, ShuttleBehaviour& var) { return int_to_type<ShuttleBehaviour> (o, var); }
+std::istream& operator>>(std::istream& o, ShuttleUnits& var) { return int_to_type<ShuttleUnits> (o, var); }
+
index a6a976705c4408a5645401367ffe69440d980d09..b6bff35c89696a1773338b81e5df721b8f8db05e 100644 (file)
@@ -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);
                }
        }
index eca7b67e38d1b7e20e5419a96bf216fe6b7abec9..776af75a36a5913b19c80d2ca063988eff669b30 100644 (file)
@@ -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<Region>
                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> 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> 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 ();
        }
index 4f8a6ffd18860274422dc89276fa9ae88c53e02c..82edb253ded0046584b5c5ed1a61385dd434a8c9 100644 (file)
@@ -311,7 +311,7 @@ Route::process_output_buffers (vector<Sample*>& 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<Sample*>& 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<Sample*>& 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<Sample*>& 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<Sample*>& 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
 
index 274fcf1b163335f06cb5632f0f60aba9c52e7b81..b2b36c9df5502984271adebc01ab2c0b7509c25b 100644 (file)
@@ -96,8 +96,6 @@ sigc::signal<int> Session::AskAboutPendingState;
 sigc::signal<void> Session::SendFeedback;
 
 sigc::signal<void> Session::SMPTEOffsetChanged;
-sigc::signal<void> Session::SMPTETypeChanged;
-sigc::signal<void> Session::PullupChanged;
 sigc::signal<void> Session::StartTimeChanged;
 sigc::signal<void> 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<DiskstreamList> 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<DiskstreamList> 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<DiskstreamList> 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<DiskstreamList> 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> 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)
 {
index 1d14fd4a80a77307365b0cb7369d0e5521377fe5..426e6e28649997e1c728676f979184bdc4a711f6 100644 (file)
@@ -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<Sample*> (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<Sample*> (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;
-}
-
index 371b5700691b7e68c1cf7a9cfdd6bdabeef2d126..a72a2e58d46c5890038aaa803b182d7c4dc18626 100644 (file)
@@ -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<AudioDiskstream*>(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:
index 98653314b022cb02fc1d268c7e1b29fbd1616806..81522dabec6eafb0e242298c5d94ba080dd71378 100644 (file)
@@ -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 */
 
index 821f894eeb1f4cb64d803c87c90c896c1e1fa16f..2a5b18962c12f2b31ee37df3cbe70d6224bee257 100644 (file)
@@ -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<RouteList> 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;
-}
index 43849793d467e176ae732e9577e483b739e613d4..db6d75beeca480c9de9edea8580bbefbc785120c 100644 (file)
@@ -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 ();
        }
 
index d721eecce9ce160d25f1da5812f313c8a21c793b..cddf5514bb8443b9a9685e238de00caa595bad45 100644 (file)
@@ -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 <recording-plugins>
-       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<DiskstreamList> 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
+
+}
index 69138f1c8bb81c677eb403c12f6171315a956fad..e8fbbdbc4e4fde9a65039371c2cb868475c13845 100644 (file)
@@ -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;
index 1138d976645970efc3c303c7bb12028acacd1e3d..963c2320836da557b5a38785590515b392256a93 100644 (file)
@@ -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<DiskstreamList> 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<DiskstreamList> 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<DiskstreamList> 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 */
        }
 }
 
index 9e8603827a106fd2584699f889f43f5dcf95e6b5..83b0c3101efea1fdd86d49cd32c4ef0fa8711f3c 100644 (file)
@@ -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");
+               
+       }
+}
index 3dc93cc64ad980070886d6215a613b25a5288260..32b4137f51c7919644d17f7de4c53a88f594679a 100644 (file)
@@ -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