diff options
-rw-r--r-- | gtk2_ardour/actions.cc | 55 | ||||
-rw-r--r-- | gtk2_ardour/actions.h | 4 | ||||
-rw-r--r-- | gtk2_ardour/ardour.menus | 10 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui.cc | 66 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui.h | 28 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui_ed.cc | 83 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui_options.cc | 733 | ||||
-rw-r--r-- | gtk2_ardour/editor.cc | 209 | ||||
-rw-r--r-- | gtk2_ardour/editor.h | 1 | ||||
-rw-r--r-- | gtk2_ardour/editor_actions.cc | 279 | ||||
-rw-r--r-- | gtk2_ardour/utils.cc | 27 | ||||
-rw-r--r-- | gtk2_ardour/utils.h | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/configuration_vars.h | 141 | ||||
-rw-r--r-- | libs/ardour/ardour/session.h | 12 | ||||
-rw-r--r-- | libs/ardour/ardour/types.h | 29 | ||||
-rw-r--r-- | libs/ardour/ardour/utils.h | 6 | ||||
-rw-r--r-- | libs/ardour/audio_diskstream.cc | 6 | ||||
-rw-r--r-- | libs/ardour/audio_track.cc | 4 | ||||
-rw-r--r-- | libs/ardour/configuration.cc | 6 | ||||
-rw-r--r-- | libs/ardour/globals.cc | 1 | ||||
-rw-r--r-- | libs/ardour/route.cc | 15 | ||||
-rw-r--r-- | libs/ardour/session.cc | 30 | ||||
-rw-r--r-- | libs/ardour/session_state.cc | 27 | ||||
-rw-r--r-- | libs/ardour/session_transport.cc | 8 | ||||
-rw-r--r-- | libs/ardour/utils.cc | 64 |
25 files changed, 1159 insertions, 687 deletions
diff --git a/gtk2_ardour/actions.cc b/gtk2_ardour/actions.cc index b2408620a5..8aa8ed0cbb 100644 --- a/gtk2_ardour/actions.cc +++ b/gtk2_ardour/actions.cc @@ -40,6 +40,7 @@ using namespace Gtk; using namespace Glib; using namespace sigc; using namespace PBD; +using namespace ARDOUR; vector<RefPtr<Gtk::Action> > ActionManager::session_sensitive_actions; vector<RefPtr<Gtk::Action> > ActionManager::region_list_selection_sensitive_actions; @@ -283,3 +284,57 @@ ActionManager::uncheck_toggleaction (const char * name) delete [] group_name; } +void +ActionManager::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); + + if (tact) { + bool x = (Config->*get)(); + + cerr << "\ttoggle config, action = " << tact->get_active() << " config = " << x << endl; + + if (x != tact->get_active()) { + (Config->*set) (!x); + } + } + } +} + +void +ActionManager::toggle_config_state (const char* group, const char* action, sigc::slot<void> theSlot) +{ + Glib::RefPtr<Action> act = ActionManager::get_action (group, action); + if (act) { + Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act); + if (tact->get_active()) { + theSlot (); + } + } +} + +void +ActionManager::map_some_state (const char* group, const char* action, bool (Configuration::*get)() const) +{ + Glib::RefPtr<Action> act = ActionManager::get_action (group, action); + if (act) { + Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act); + + if (tact) { + + bool x = (Config->*get)(); + + cerr << "\tmap state, action = " << tact->get_active() << " config = " << x << endl; + + if (tact->get_active() != x) { + tact->set_active (x); + } + } else { + cerr << "not a toggle\n"; + } + } else { + cerr << group << ':' << action << " not an action\n"; + } +} diff --git a/gtk2_ardour/actions.h b/gtk2_ardour/actions.h index 330caff1c2..e3ec57dbae 100644 --- a/gtk2_ardour/actions.h +++ b/gtk2_ardour/actions.h @@ -37,6 +37,10 @@ class ActionManager static std::vector<Glib::RefPtr<Gtk::Action> > jack_opposite_sensitive_actions; static std::vector<Glib::RefPtr<Gtk::Action> > edit_cursor_in_region_sensitive_actions; + static void map_some_state (const char* group, const char* action, bool (ARDOUR::Configuration::*get)() const); + static void toggle_config_state (const char* group, const char* action, bool (ARDOUR::Configuration::*set)(bool), bool (ARDOUR::Configuration::*get)(void) const); + static void toggle_config_state (const char* group, const char* action, sigc::slot<void> theSlot); + static void set_sensitive (std::vector<Glib::RefPtr<Gtk::Action> >& actions, bool); static std::string unbound_string; /* the key string returned if an action is not bound */ diff --git a/gtk2_ardour/ardour.menus b/gtk2_ardour/ardour.menus index aa6424b8b9..d9019dad06 100644 --- a/gtk2_ardour/ardour.menus +++ b/gtk2_ardour/ardour.menus @@ -239,11 +239,12 @@ </menu> <separator/> <menu action='Autoconnect'> - <menuitem action='AutoConnectNewTrackInputsToHardware'/> + <menuitem action='InputAutoConnectPhysical'/> + <menuitem action='InputAutoConnectManual'/> <separator/> - <menuitem action='AutoConnectNewTrackOutputsToHardware'/> - <menuitem action='AutoConnectNewTrackOutputsToMaster'/> - <menuitem action='ManuallyConnectNewTrackOutputs'/> + <menuitem action='OutputAutoConnectPhysical'/> + <menuitem action='OutputAutoConnectMaster'/> + <menuitem action='OutputAutoConnectManual'/> </menu> <menu action='ControlSurfaces'/> <menu action='Monitoring'> @@ -277,7 +278,6 @@ <menuitem action='toggle-xfades-active'/> <menuitem action='toggle-xfades-visible'/> <menuitem action='toggle-auto-xfades'/> - <menuitem action='UnmuteNewFullCrossfades'/> <separator/> <menuitem action='CrossfadesFull'/> <menuitem action='CrossfadesShort'/> diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index a6cd045fb2..701c69c996 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -2344,72 +2344,6 @@ ARDOUR_UI::cmdline_new_session (string path) } void -ARDOUR_UI::set_native_file_header_format (HeaderFormat hf) -{ - Glib::RefPtr<Action> act; - - switch (hf) { - case BWF: - act = ActionManager::get_action (X_("options"), X_("FileHeaderFormatBWF")); - break; - case WAVE: - act = ActionManager::get_action (X_("options"), X_("FileHeaderFormatWAVE")); - break; - case WAVE64: - act = ActionManager::get_action (X_("options"), X_("FileHeaderFormatWAVE64")); - break; - case iXML: - act = ActionManager::get_action (X_("options"), X_("FileHeaderFormatiXML")); - break; - case RF64: - act = ActionManager::get_action (X_("options"), X_("FileHeaderFormatRF64")); - break; - case CAF: - act = ActionManager::get_action (X_("options"), X_("FileHeaderFormatCAF")); - break; - case AIFF: - act = ActionManager::get_action (X_("options"), X_("FileHeaderFormatAIFF")); - break; - } - - if (act) { - Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic(act); - if (ract && ract->get_active() && Config->get_native_file_header_format() != hf) { - Config->set_native_file_header_format (hf); - if (session) { - session->reset_native_file_format (); - } - } - } -} - -void -ARDOUR_UI::set_native_file_data_format (SampleFormat sf) -{ - Glib::RefPtr<Action> act; - - switch (sf) { - case FormatFloat: - act = ActionManager::get_action (X_("options"), X_("FileDataFormatFloat")); - break; - case FormatInt24: - act = ActionManager::get_action (X_("options"), X_("FileDataFormat24bit")); - break; - } - - if (act) { - Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic(act); - - if (ract && ract->get_active() && Config->get_native_file_data_format() != sf) { - Config->set_native_file_data_format (sf); - if (session) { - session->reset_native_file_format (); - } - } - } -} - -void ARDOUR_UI::use_config () { Glib::RefPtr<Action> act; diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index 04db74b03f..cf6cda526a 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -655,21 +655,17 @@ class ARDOUR_UI : public Gtkmm2ext::UI std::vector<std::string> positional_sync_strings; - 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 (); void toggle_use_midi_control(); void toggle_send_mtc (); - void toggle_AutoConnectNewTrackInputsToHardware(); - void toggle_AutoConnectNewTrackOutputsToHardware(); - void toggle_AutoConnectNewTrackOutputsToMaster(); - void toggle_ManuallyConnectNewTrackOutputs(); - void toggle_UseHardwareMonitoring(); - void toggle_UseSoftwareMonitoring(); - void toggle_UseExternalMonitoring(); + void set_input_auto_connect (ARDOUR::AutoConnectOption); + void set_output_auto_connect (ARDOUR::AutoConnectOption); + void set_solo_model (ARDOUR::SoloModel); + void set_monitor_model (ARDOUR::MonitorModel); + void toggle_StopPluginsWithTransport(); void toggle_DoNotRunPluginsWhileRecording(); void toggle_VerifyRemoveLastCapture(); @@ -678,14 +674,22 @@ class ARDOUR_UI : public Gtkmm2ext::UI void toggle_GainReduceFastTransport(); void toggle_LatchedSolo(); void toggle_SoloViaBus(); - void toggle_AutomaticallyCreateCrossfades(); - void toggle_UnmuteNewFullCrossfades(); void toggle_LatchedRecordEnable (); void mtc_port_changed (); - void map_some_state (const char* group, const char* action, bool (ARDOUR::Configuration::*get)() const); + void map_solo_model (); + void map_monitor_model (); + void map_file_header_format (); + void map_file_data_format (); + void map_input_auto_connect (); + void map_output_auto_connect (); void parameter_changed (const char*); + void set_meter_hold (ARDOUR::MeterHold); + void set_meter_falloff (ARDOUR::MeterFalloff); + void map_meter_hold (); + void map_meter_falloff (); + void toggle_control_protocol (ARDOUR::ControlProtocolInfo*); }; diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index 3ae9a76c40..eebe33bf58 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -43,6 +43,7 @@ using namespace ARDOUR; using namespace PBD; using namespace Gtk; using namespace Gtkmm2ext; +using namespace sigc; int ARDOUR_UI::create_editor () @@ -81,6 +82,9 @@ ARDOUR_UI::install_actions () ActionManager::register_action (main_actions, X_("AudioFileFormatHeader"), _("Header")); ActionManager::register_action (main_actions, X_("AudioFileFormatData"), _("Data")); ActionManager::register_action (main_actions, X_("ControlSurfaces"), _("Control Surfaces")); + ActionManager::register_action (main_actions, X_("Metering"), _("Metering")); + ActionManager::register_action (main_actions, X_("MeteringFallOffRate"), _("Fall off rate")); + ActionManager::register_action (main_actions, X_("MeteringHoldTime"), _("Hold Time")); /* the real actions */ @@ -354,8 +358,8 @@ ARDOUR_UI::install_actions () Glib::RefPtr<ActionGroup> shuttle_actions = ActionGroup::create ("ShuttleActions"); - 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))); + shuttle_actions->add (Action::create (X_("SetShuttleUnitsPercentage"), _("Percentage")), hide_return (bind (mem_fun (*Config, &Configuration::set_shuttle_units), Percentage))); + shuttle_actions->add (Action::create (X_("SetShuttleUnitsSemitones"), _("Semitones")), hide_return (bind (mem_fun (*Config, &Configuration::set_shuttle_units), Semitones))); Glib::RefPtr<ActionGroup> option_actions = ActionGroup::create ("options"); @@ -370,9 +374,37 @@ ARDOUR_UI::install_actions () act = ActionManager::register_toggle_action (option_actions, X_("UseMIDIcontrol"), _("Use MIDI control"), mem_fun (*this, &ARDOUR_UI::toggle_use_midi_control)); ActionManager::session_sensitive_actions.push_back (act); - act = ActionManager::register_toggle_action (option_actions, X_("AutoConnectNewTrackInputsToHardware"), _("Connect new track inputs to hardware"), mem_fun (*this, &ARDOUR_UI::toggle_AutoConnectNewTrackInputsToHardware)); + ActionManager::register_toggle_action (option_actions, X_("StopPluginsWithTransport"), _("Stop plugins with transport"), mem_fun (*this, &ARDOUR_UI::toggle_StopPluginsWithTransport)); + ActionManager::register_toggle_action (option_actions, X_("VerifyRemoveLastCapture"), _("Verify remove last capture"), mem_fun (*this, &ARDOUR_UI::toggle_VerifyRemoveLastCapture)); + ActionManager::register_toggle_action (option_actions, X_("StopRecordingOnXrun"), _("Stop recording on xrun"), mem_fun (*this, &ARDOUR_UI::toggle_StopRecordingOnXrun)); + ActionManager::register_toggle_action (option_actions, X_("StopTransportAtEndOfSession"), _("Stop transport at session end"), mem_fun (*this, &ARDOUR_UI::toggle_StopTransportAtEndOfSession)); + ActionManager::register_toggle_action (option_actions, X_("GainReduceFastTransport"), _("-12dB gain reduce ffwd/rewind"), mem_fun (*this, &ARDOUR_UI::toggle_GainReduceFastTransport)); + ActionManager::register_toggle_action (option_actions, X_("LatchedRecordEnable"), _("Rec-enable stays engaged at stop"), mem_fun (*this, &ARDOUR_UI::toggle_LatchedRecordEnable)); + + act = ActionManager::register_toggle_action (option_actions, X_("DoNotRunPluginsWhileRecording"), _("Do not run plugins while recording"), mem_fun (*this, &ARDOUR_UI::toggle_DoNotRunPluginsWhileRecording)); + ActionManager::session_sensitive_actions.push_back (act); + + act = ActionManager::register_toggle_action (option_actions, X_("LatchedSolo"), _("Latched solo"), mem_fun (*this, &ARDOUR_UI::toggle_LatchedSolo)); ActionManager::session_sensitive_actions.push_back (act); + /* !!! REMEMBER THAT RADIO ACTIONS HAVE TO BE HANDLED WITH MORE FINESSE THAN SIMPLE TOGGLES !!! */ + + RadioAction::Group meter_falloff_group; + RadioAction::Group meter_hold_group; + + ActionManager::register_radio_action (option_actions, meter_falloff_group, X_("MeterFalloffOff"), _("Off"), bind (mem_fun (*this, &ARDOUR_UI::set_meter_falloff), MeterFalloffOff)); + ActionManager::register_radio_action (option_actions, meter_falloff_group, X_("MeterFalloffSlowest"), _("Slowest"), bind (mem_fun (*this, &ARDOUR_UI::set_meter_falloff), MeterFalloffSlowest)); + ActionManager::register_radio_action (option_actions, meter_falloff_group, X_("MeterFalloffSlow"), _("Slow"), bind (mem_fun (*this, &ARDOUR_UI::set_meter_falloff), MeterFalloffSlow)); + ActionManager::register_radio_action (option_actions, meter_falloff_group, X_("MeterFalloffMedium"), _("Medium"), bind (mem_fun (*this, &ARDOUR_UI::set_meter_falloff), MeterFalloffMedium)); + ActionManager::register_radio_action (option_actions, meter_falloff_group, X_("MeterFalloffFast"), _("Fast"), bind (mem_fun (*this, &ARDOUR_UI::set_meter_falloff), MeterFalloffFast)); + ActionManager::register_radio_action (option_actions, meter_falloff_group, X_("MeterFalloffFaster"), _("Faster"), bind (mem_fun (*this, &ARDOUR_UI::set_meter_falloff), MeterFalloffFaster)); + ActionManager::register_radio_action (option_actions, meter_falloff_group, X_("MeterFalloffFastest"), _("Fastest"), bind (mem_fun (*this, &ARDOUR_UI::set_meter_falloff), MeterFalloffFastest)); + + ActionManager::register_radio_action (option_actions, meter_hold_group, X_("MeterHoldOff"), _("Off"), bind (mem_fun (*this, &ARDOUR_UI::set_meter_hold), MeterHoldOff)); + ActionManager::register_radio_action (option_actions, meter_hold_group, X_("MeterHoldShort"), _("Short"), bind (mem_fun (*this, &ARDOUR_UI::set_meter_hold), MeterHoldShort)); + ActionManager::register_radio_action (option_actions, meter_hold_group, X_("MeterHoldMedium"), _("Medium"), bind (mem_fun (*this, &ARDOUR_UI::set_meter_hold), MeterHoldMedium)); + ActionManager::register_radio_action (option_actions, meter_hold_group, X_("MeterHoldLong"), _("Long"), bind (mem_fun (*this, &ARDOUR_UI::set_meter_hold), MeterHoldLong)); + RadioAction::Group file_header_group; act = ActionManager::register_radio_action (option_actions, file_header_group, X_("FileHeaderFormatBWF"), X_("Broadcast WAVE"), bind (mem_fun (*this, &ARDOUR_UI::set_native_file_header_format), ARDOUR::BWF)); @@ -387,48 +419,33 @@ ARDOUR_UI::install_actions () act = ActionManager::register_radio_action (option_actions, file_data_group, X_("FileDataFormatFloat"), X_("32-bit floating point"), bind (mem_fun (*this, &ARDOUR_UI::set_native_file_data_format), ARDOUR::FormatFloat)); act = ActionManager::register_radio_action (option_actions, file_data_group, X_("FileDataFormat24bit"), X_("24-bit signed integer"), bind (mem_fun (*this, &ARDOUR_UI::set_native_file_data_format), ARDOUR::FormatInt24)); - RadioAction::Group connect_outputs_group; - - act = ActionManager::register_radio_action (option_actions, connect_outputs_group, X_("AutoConnectNewTrackOutputsToHardware"), _("Connect new track outputs to hardware"), mem_fun (*this, &ARDOUR_UI::toggle_AutoConnectNewTrackOutputsToHardware)); - ActionManager::session_sensitive_actions.push_back (act); - act = ActionManager::register_radio_action (option_actions, connect_outputs_group, X_("AutoConnectNewTrackOutputsToMaster"), _("Connect new track outputs to master"), mem_fun (*this, &ARDOUR_UI::toggle_AutoConnectNewTrackOutputsToMaster)); - ActionManager::session_sensitive_actions.push_back (act); - act = ActionManager::register_radio_action (option_actions, connect_outputs_group, X_("ManuallyConnectNewTrackOutputs"), _("Manually connect new track outputs"), mem_fun (*this, &ARDOUR_UI::toggle_ManuallyConnectNewTrackOutputs)); - ActionManager::session_sensitive_actions.push_back (act); - RadioAction::Group monitoring_group; - act = ActionManager::register_radio_action (option_actions, monitoring_group, X_("UseHardwareMonitoring"), _("Hardware monitoring"), mem_fun (*this, &ARDOUR_UI::toggle_UseHardwareMonitoring)); - act = ActionManager::register_radio_action (option_actions, monitoring_group, X_("UseSoftwareMonitoring"), _("Software monitoring"), mem_fun (*this, &ARDOUR_UI::toggle_UseSoftwareMonitoring)); - act = ActionManager::register_radio_action (option_actions, monitoring_group, X_("UseExternalMonitoring"), _("External monitoring"), mem_fun (*this, &ARDOUR_UI::toggle_UseExternalMonitoring)); - - /* Configuration object options (i.e. not session specific) */ + act = ActionManager::register_radio_action (option_actions, monitoring_group, X_("UseHardwareMonitoring"), _("Hardware monitoring"), bind (mem_fun (*this, &ARDOUR_UI::set_monitor_model), HardwareMonitoring)); + act = ActionManager::register_radio_action (option_actions, monitoring_group, X_("UseSoftwareMonitoring"), _("Software monitoring"), bind (mem_fun (*this, &ARDOUR_UI::set_monitor_model), SoftwareMonitoring)); + act = ActionManager::register_radio_action (option_actions, monitoring_group, X_("UseExternalMonitoring"), _("External monitoring"), bind (mem_fun (*this, &ARDOUR_UI::set_monitor_model), ExternalMonitoring)); - ActionManager::register_toggle_action (option_actions, X_("StopPluginsWithTransport"), _("Stop plugins with transport"), mem_fun (*this, &ARDOUR_UI::toggle_StopPluginsWithTransport)); - ActionManager::register_toggle_action (option_actions, X_("VerifyRemoveLastCapture"), _("Verify remove last capture"), mem_fun (*this, &ARDOUR_UI::toggle_VerifyRemoveLastCapture)); - ActionManager::register_toggle_action (option_actions, X_("StopRecordingOnXrun"), _("Stop recording on xrun"), mem_fun (*this, &ARDOUR_UI::toggle_StopRecordingOnXrun)); - ActionManager::register_toggle_action (option_actions, X_("StopTransportAtEndOfSession"), _("Stop transport at session end"), mem_fun (*this, &ARDOUR_UI::toggle_StopTransportAtEndOfSession)); - ActionManager::register_toggle_action (option_actions, X_("GainReduceFastTransport"), _("-12dB gain reduce ffwd/rewind"), mem_fun (*this, &ARDOUR_UI::toggle_GainReduceFastTransport)); - ActionManager::register_toggle_action (option_actions, X_("LatchedRecordEnable"), _("Rec-enable stays engaged at stop"), mem_fun (*this, &ARDOUR_UI::toggle_LatchedRecordEnable)); + RadioAction::Group solo_group; - /* session options */ - - act = ActionManager::register_toggle_action (option_actions, X_("DoNotRunPluginsWhileRecording"), _("Do not run plugins while recording"), mem_fun (*this, &ARDOUR_UI::toggle_DoNotRunPluginsWhileRecording)); + act = ActionManager::register_radio_action (option_actions, solo_group, X_("SoloInPlace"), _("Solo in-place"), hide_return (bind (mem_fun (*this, &ARDOUR_UI::set_solo_model), InverseMute))); ActionManager::session_sensitive_actions.push_back (act); - - act = ActionManager::register_toggle_action (option_actions, X_("LatchedSolo"), _("Latched solo"), mem_fun (*this, &ARDOUR_UI::toggle_LatchedSolo)); + act = ActionManager::register_radio_action (option_actions, solo_group, X_("SoloViaBus"), _("Solo via bus"), hide_return (bind (mem_fun (*this, &ARDOUR_UI::set_solo_model), SoloBus))); ActionManager::session_sensitive_actions.push_back (act); - RadioAction::Group solo_group; + RadioAction::Group input_auto_connect_group; - act = ActionManager::register_radio_action (option_actions, solo_group, X_("SoloInPlace"), _("Solo in-place"), mem_fun (*this, &ARDOUR_UI::toggle_SoloViaBus)); + act = ActionManager::register_radio_action (option_actions, input_auto_connect_group, X_("InputAutoConnectPhysical"), _("Auto-connect inputs to physical inputs"), hide_return (bind (mem_fun (*this, &ARDOUR_UI::set_input_auto_connect), AutoConnectPhysical))); ActionManager::session_sensitive_actions.push_back (act); - act = ActionManager::register_radio_action (option_actions, solo_group, X_("SoloViaBus"), _("Solo via bus"), mem_fun (*this, &ARDOUR_UI::toggle_SoloViaBus)); + act = ActionManager::register_radio_action (option_actions, input_auto_connect_group, X_("InputAutoConnectManual"), _("Manually connect inputs"), hide_return (bind (mem_fun (*this, &ARDOUR_UI::set_input_auto_connect), (AutoConnectOption) 0))); ActionManager::session_sensitive_actions.push_back (act); - act = ActionManager::register_action (option_actions, X_("AutomaticallyCreateCrossfades"), _("Automatically create crossfades"), mem_fun (*this, &ARDOUR_UI::toggle_AutomaticallyCreateCrossfades)); + RadioAction::Group output_auto_connect_group; + + act = ActionManager::register_radio_action (option_actions, output_auto_connect_group, X_("OutputAutoConnectPhysical"), _("Auto-connect outputs to physical outs"), hide_return (bind (mem_fun (*this, &ARDOUR_UI::set_output_auto_connect), AutoConnectPhysical))); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_radio_action (option_actions, output_auto_connect_group, X_("OutputAutoConnectMaster"), _("Auto-connect outputs to master bus"), hide_return (bind (mem_fun (*this, &ARDOUR_UI::set_output_auto_connect), AutoConnectMaster))); ActionManager::session_sensitive_actions.push_back (act); - act = ActionManager::register_action (option_actions, X_("UnmuteNewFullCrossfades"), _("Unmute new full crossfades"), mem_fun (*this, &ARDOUR_UI::toggle_UnmuteNewFullCrossfades)); + act = ActionManager::register_radio_action (option_actions, output_auto_connect_group, X_("OutputAutoConnectManual"), _("Manually connect outputs"), hide_return (bind (mem_fun (*this, &ARDOUR_UI::set_output_auto_connect), (AutoConnectOption) 0))); ActionManager::session_sensitive_actions.push_back (act); ActionManager::add_action_group (shuttle_actions); diff --git a/gtk2_ardour/ardour_ui_options.cc b/gtk2_ardour/ardour_ui_options.cc index f7e1faa806..9ab4f07676 100644 --- a/gtk2_ardour/ardour_ui_options.cc +++ b/gtk2_ardour/ardour_ui_options.cc @@ -39,120 +39,241 @@ using namespace PBD; using namespace sigc; void -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); - - if (tact) { - bool x = (Config->*get)(); - - cerr << "\ttoggle config, action = " << tact->get_active() << " config = " << x << endl; - - if (x != tact->get_active()) { - (Config->*set) (!x); - } - } - } -} - -void -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); - if (act) { - Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act); - if (tact->get_active()) { - theSlot (); - } - } - } -} - -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 (); - } + ActionManager::toggle_config_state ("Transport", "ToggleTimeMaster", &Configuration::set_jack_time_master, &Configuration::get_jack_time_master); } void ARDOUR_UI::toggle_send_mtc () { - toggle_config_state ("options", "SendMTC", &Configuration::set_send_mtc, &Configuration::get_send_mtc); + ActionManager::toggle_config_state ("options", "SendMTC", &Configuration::set_send_mtc, &Configuration::get_send_mtc); } void ARDOUR_UI::toggle_send_mmc () { - toggle_config_state ("options", "SendMMC", &Configuration::set_send_mmc, &Configuration::get_send_mmc); + ActionManager::toggle_config_state ("options", "SendMMC", &Configuration::set_send_mmc, &Configuration::get_send_mmc); } void ARDOUR_UI::toggle_use_mmc () { - toggle_config_state ("options", "UseMMC", &Configuration::set_mmc_control, &Configuration::get_mmc_control); + ActionManager::toggle_config_state ("options", "UseMMC", &Configuration::set_mmc_control, &Configuration::get_mmc_control); } void ARDOUR_UI::toggle_use_midi_control () { - toggle_config_state ("options", "UseMIDIcontrol", &Configuration::set_midi_control, &Configuration::get_midi_control); + ActionManager::toggle_config_state ("options", "UseMIDIcontrol", &Configuration::set_midi_control, &Configuration::get_midi_control); } void ARDOUR_UI::toggle_send_midi_feedback () { - toggle_config_state ("options", "SendMIDIfeedback", &Configuration::set_midi_feedback, &Configuration::get_midi_feedback); + ActionManager::toggle_config_state ("options", "SendMIDIfeedback", &Configuration::set_midi_feedback, &Configuration::get_midi_feedback); +} + +void +ARDOUR_UI::set_native_file_header_format (HeaderFormat hf) +{ + const char *action; + + switch (hf) { + case BWF: + action = X_("FileHeaderFormatBWF"); + break; + case WAVE: + action = X_("FileHeaderFormatWAVE"); + break; + case WAVE64: + action = X_("FileHeaderFormatWAVE64"); + break; + case iXML: + action = X_("FileHeaderFormatiXML"); + break; + case RF64: + action = X_("FileHeaderFormatRF64"); + break; + case CAF: + action = X_("FileHeaderFormatCAF"); + break; + case AIFF: + action = X_("FileHeaderFormatAIFF"); + break; + } + + Glib::RefPtr<Action> act = ActionManager::get_action ("options", action); + + if (act) { + Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic(act); + if (ract && ract->get_active() && Config->get_native_file_header_format() != hf) { + Config->set_native_file_header_format (hf); + } + } } void -ARDOUR_UI::toggle_AutoConnectNewTrackInputsToHardware() +ARDOUR_UI::set_native_file_data_format (SampleFormat sf) { - toggle_config_state ("options", "AutoConnectNewTrackInputsToHardware", hide_return (bind (mem_fun (*Config, &Configuration::set_input_auto_connect), AutoConnectPhysical))); + const char* action; + + switch (sf) { + case FormatFloat: + action = X_("FileDataFormatFloat"); + break; + case FormatInt24: + action = X_("FileDataFormat24bit"); + break; + } + + Glib::RefPtr<Action> act = ActionManager::get_action ("options", action); + + if (act) { + Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic(act); + if (ract && ract->get_active() && Config->get_native_file_data_format() != sf) { + Config->set_native_file_data_format (sf); + } + } } + void -ARDOUR_UI::toggle_AutoConnectNewTrackOutputsToHardware() +ARDOUR_UI::set_input_auto_connect (AutoConnectOption option) { - toggle_config_state ("options", "AutoConnectNewTrackOutputsToHardware", hide_return (bind (mem_fun (*Config, &Configuration::set_output_auto_connect), AutoConnectPhysical))); + const char* action; + + switch (option) { + case AutoConnectPhysical: + action = X_("InputAutoConnectPhysical"); + break; + default: + action = X_("InputAutoConnectManual"); + } + + Glib::RefPtr<Action> act = ActionManager::get_action ("options", action); + + if (act) { + Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic(act); + + if (ract && ract->get_active() && Config->get_input_auto_connect() != option) { + Config->set_input_auto_connect (option); + } + } } + void -ARDOUR_UI::toggle_AutoConnectNewTrackOutputsToMaster() +ARDOUR_UI::set_output_auto_connect (AutoConnectOption option) { - toggle_config_state ("options", "AutoConnectNewTrackOutputsToHardware", hide_return (bind (mem_fun (*Config, &Configuration::set_output_auto_connect), AutoConnectMaster))); + const char* action; + + switch (option) { + case AutoConnectPhysical: + action = X_("OutputAutoConnectPhysical"); + break; + case AutoConnectMaster: + action = X_("OutputAutoConnectMaster"); + break; + default: + action = X_("OutputAutoConnectManual"); + } + + Glib::RefPtr<Action> act = ActionManager::get_action ("options", action); + + if (act) { + Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic(act); + + if (ract && ract->get_active() && Config->get_output_auto_connect() != option) { + Config->set_output_auto_connect (option); + } + } } + void -ARDOUR_UI::toggle_ManuallyConnectNewTrackOutputs() +ARDOUR_UI::set_solo_model (SoloModel model) { - toggle_config_state ("options", "AutoConnectNewTrackOutputsToHardware", hide_return (bind (mem_fun (*Config, &Configuration::set_output_auto_connect), AutoConnectOption (0)))); + const char* action = 0; + + switch (model) { + case SoloBus: + action = X_("SoloViaBus"); + break; + + case InverseMute: + action = X_("SoloInPlace"); + break; + default: + fatal << string_compose (_("programming error: unknown solo model in ARDOUR_UI::set_solo_model: %1"), model) << endmsg; + /*NOTREACHED*/ + } + + Glib::RefPtr<Action> act = ActionManager::get_action ("options", action); + + if (act) { + Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic(act); + + if (ract && ract->get_active() && Config->get_solo_model() != model) { + Config->set_solo_model (model); + } + } + +} + +void +ARDOUR_UI::set_monitor_model (MonitorModel model) +{ + const char* action = 0; + + switch (model) { + case HardwareMonitoring: + action = X_("UseHardwareMonitoring"); + break; + + case SoftwareMonitoring: + action = X_("UseSoftwareMonitoring"); + break; + case ExternalMonitoring: + action = X_("UseExternalMonitoring"); + break; + + default: + fatal << string_compose (_("programming error: unknown solo model in ARDOUR_UI::set_solo_model: %1"), model) << endmsg; + /*NOTREACHED*/ + } + + Glib::RefPtr<Action> act = ActionManager::get_action ("options", action); + + if (act) { + Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic(act); + + if (ract && ract->get_active() && Config->get_monitoring_model() != model) { + Config->set_monitoring_model (model); + } + } + } void ARDOUR_UI::toggle_auto_input () { - toggle_config_state ("Transport", "ToggleAutoInput", &Configuration::set_auto_input, &Configuration::get_auto_input); + ActionManager::toggle_config_state ("Transport", "ToggleAutoInput", &Configuration::set_auto_input, &Configuration::get_auto_input); } void ARDOUR_UI::toggle_auto_play () { - toggle_config_state ("Transport", "ToggleAutoPlay", &Configuration::set_auto_play, &Configuration::get_auto_play); + ActionManager::toggle_config_state ("Transport", "ToggleAutoPlay", &Configuration::set_auto_play, &Configuration::get_auto_play); } void ARDOUR_UI::toggle_auto_return () { - toggle_config_state ("Transport", "ToggleAutoReturn", &Configuration::set_auto_return, &Configuration::get_auto_return); + ActionManager::toggle_config_state ("Transport", "ToggleAutoReturn", &Configuration::set_auto_return, &Configuration::get_auto_return); } void ARDOUR_UI::toggle_click () { - toggle_config_state ("Transport", "ToggleClick", &Configuration::set_clicking, &Configuration::get_clicking); + ActionManager::toggle_config_state ("Transport", "ToggleClick", &Configuration::set_clicking, &Configuration::get_clicking); } void @@ -174,13 +295,13 @@ ARDOUR_UI::toggle_session_auto_loop () void ARDOUR_UI::toggle_punch_in () { - toggle_config_state ("Transport", "TogglePunchIn", &Configuration::set_punch_in, &Configuration::get_punch_in); + ActionManager::toggle_config_state ("Transport", "TogglePunchIn", &Configuration::set_punch_in, &Configuration::get_punch_in); } void ARDOUR_UI::toggle_punch_out () { - toggle_config_state ("Transport", "TogglePunchOut", &Configuration::set_punch_out, &Configuration::get_punch_out); + ActionManager::toggle_config_state ("Transport", "TogglePunchOut", &Configuration::set_punch_out, &Configuration::get_punch_out); } void @@ -208,90 +329,39 @@ ARDOUR_UI::toggle_editing_space() } void -ARDOUR_UI::toggle_UseHardwareMonitoring() -{ - Glib::RefPtr<Action> act = ActionManager::get_action ("options", "UseHardwareMonitoring"); - if (act) { - Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act); - if (tact->get_active()) { - Config->set_use_hardware_monitoring (true); - Config->set_use_sw_monitoring (false); - Config->set_use_external_monitoring (false); - if (session) { - session->reset_input_monitor_state(); - } - } - } -} - -void -ARDOUR_UI::toggle_UseSoftwareMonitoring() -{ - Glib::RefPtr<Action> act = ActionManager::get_action ("options", "UseSoftwareMonitoring"); - if (act) { - Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act); - if (tact->get_active()) { - Config->set_use_hardware_monitoring (false); - Config->set_use_sw_monitoring (true); - Config->set_use_external_monitoring (false); - if (session) { - session->reset_input_monitor_state(); - } - } - } -} - -void -ARDOUR_UI::toggle_UseExternalMonitoring() -{ - Glib::RefPtr<Action> act = ActionManager::get_action ("options", "UseExternalMonitoring"); - if (act) { - Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act); - if (tact->get_active()) { - Config->set_use_hardware_monitoring (false); - Config->set_use_sw_monitoring (false); - Config->set_use_external_monitoring (true); - if (session) { - session->reset_input_monitor_state(); - } - } - } -} - -void ARDOUR_UI::toggle_StopPluginsWithTransport() { - toggle_config_state ("options", "StopPluginsWithTransport", &Configuration::set_plugins_stop_with_transport, &Configuration::get_plugins_stop_with_transport); + ActionManager::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, &Configuration::get_latched_record_enable); + ActionManager::toggle_config_state ("options", "LatchedRecordEnable", &Configuration::set_latched_record_enable, &Configuration::get_latched_record_enable); } void ARDOUR_UI::toggle_DoNotRunPluginsWhileRecording() { - toggle_config_state ("options", "DoNotRunPluginsWhileRecording", &Configuration::set_do_not_record_plugins, &Configuration::get_do_not_record_plugins); + ActionManager::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, &Configuration::get_verify_remove_last_capture); + ActionManager::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, &Configuration::get_stop_recording_on_xrun); + ActionManager::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, &Configuration::get_stop_at_session_end); + ActionManager::toggle_config_state ("options", "StopTransportAtEndOfSession", &Configuration::set_stop_at_session_end, &Configuration::get_stop_at_session_end); } void @@ -311,36 +381,7 @@ ARDOUR_UI::toggle_GainReduceFastTransport() void ARDOUR_UI::toggle_LatchedSolo() { - toggle_config_state ("options", "LatchedSolo", &Configuration::set_solo_latched, &Configuration::get_solo_latched); -} - -void -ARDOUR_UI::toggle_SoloViaBus() -{ - if (!session) { - return; - } - - Glib::RefPtr<Action> act = ActionManager::get_action ("options", "SoloViaBus"); - if (act) { - Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act); - - if (tact->get_active()) { - Config->set_solo_model (SoloBus); - } else { - Config->set_solo_model (InverseMute); - } - } -} - -void -ARDOUR_UI::toggle_AutomaticallyCreateCrossfades() -{ -} - -void -ARDOUR_UI::toggle_UnmuteNewFullCrossfades() -{ + ActionManager::toggle_config_state ("options", "LatchedSolo", &Configuration::set_solo_latched, &Configuration::get_solo_latched); } void @@ -376,27 +417,330 @@ ARDOUR_UI::setup_session_options () Config->ParameterChanged.connect (mem_fun (*this, &ARDOUR_UI::parameter_changed)); } + void -ARDOUR_UI::map_some_state (const char* group, const char* action, bool (Configuration::*get)() const) +ARDOUR_UI::map_solo_model () { - Glib::RefPtr<Action> act = ActionManager::get_action (group, action); + const char* on; + + if (Config->get_solo_model() == InverseMute) { + on = "SoloInPlace"; + } else { + on = "SoloViaBus"; + } + + Glib::RefPtr<Action> act = ActionManager::get_action ("options", on); if (act) { Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act); - if (tact) { - - bool x = (Config->*get)(); + if (tact && !tact->get_active()) { + tact->set_active (true); + } + } +} - cerr << "\tmap state, action = " << tact->get_active() << " config = " << x << endl; - - if (tact->get_active() != x) { - tact->set_active (x); - } - } else { - cerr << "not a toggle\n"; +void +ARDOUR_UI::map_monitor_model () +{ + const char* on = 0; + + switch (Config->get_monitoring_model()) { + case HardwareMonitoring: + on = X_("UseHardwareMonitoring"); + break; + case SoftwareMonitoring: + on = X_("UseSoftwareMonitoring"); + break; + case ExternalMonitoring: + on = X_("UseExternalMonitoring"); + break; + } + + Glib::RefPtr<Action> act = ActionManager::get_action ("options", on); + if (act) { + Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act); + + if (tact && !tact->get_active()) { + tact->set_active (true); + } + } +} + +void +ARDOUR_UI::map_file_header_format () +{ + const char* action = 0; + + switch (Config->get_native_file_header_format()) { + case BWF: + action = X_("FileHeaderFormatBWF"); + break; + + case WAVE: + action = X_("FileHeaderFormatWAVE"); + break; + + case WAVE64: + action = X_("FileHeaderFormatWAVE64"); + break; + + case iXML: + action = X_("FileHeaderFormatiXML"); + break; + + case RF64: + action = X_("FileHeaderFormatRF64"); + break; + + case CAF: + action = X_("FileHeaderFormatCAF"); + break; + + default: + fatal << string_compose (_("programming error: unknown file header format passed to ARDOUR_UI::map_file_data_format: %1"), + Config->get_native_file_header_format()) << endmsg; + /*NOTREACHED*/ + } + + + Glib::RefPtr<Action> act = ActionManager::get_action ("options", action); + + if (act) { + Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act); + + if (tact && !tact->get_active()) { + tact->set_active (true); + } + } +} + +void +ARDOUR_UI::map_file_data_format () +{ + const char* action = 0; + + switch (Config->get_native_file_data_format()) { + case FormatFloat: + action = X_("FileDataFormatFloat"); + break; + + case FormatInt24: + action = X_("FileDataFormat24bit"); + break; + + default: + fatal << string_compose (_("programming error: unknown file data format passed to ARDOUR_UI::map_file_data_format: %1"), + Config->get_native_file_data_format()) << endmsg; + /*NOTREACHED*/ + } + + + Glib::RefPtr<Action> act = ActionManager::get_action ("options", action); + + if (act) { + Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act); + + if (tact && !tact->get_active()) { + tact->set_active (true); } + } +} + +void +ARDOUR_UI::map_input_auto_connect () +{ + const char* on; + + if (Config->get_input_auto_connect() == (AutoConnectOption) 0) { + on = "InputAutoConnectManual"; } else { - cerr << group << ':' << action << " not an action\n"; + on = "InputAutoConnectPhysical"; + } + + Glib::RefPtr<Action> act = ActionManager::get_action ("options", on); + if (act) { + Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act); + + if (tact && !tact->get_active()) { + tact->set_active (true); + } + } +} + +void +ARDOUR_UI::map_output_auto_connect () +{ + const char* on; + + if (Config->get_output_auto_connect() == (AutoConnectOption) 0) { + on = "OutputAutoConnectManual"; + } else if (Config->get_output_auto_connect() == AutoConnectPhysical) { + on = "OutputAutoConnectPhysical"; + } else { + on = "OutputAutoConnectMaster"; + } + + Glib::RefPtr<Action> act = ActionManager::get_action ("options", on); + if (act) { + Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act); + + if (tact && !tact->get_active()) { + tact->set_active (true); + } + } +} + +void +ARDOUR_UI::map_meter_falloff () +{ + const char* action = 0; + + /* XXX hack alert. Fix this. Please */ + + float val = Config->get_meter_falloff (); + MeterFalloff code = (MeterFalloff) (floor (val)); + + switch (code) { + case MeterFalloffOff: + action = X_("MeterFalloffOff"); + break; + case MeterFalloffSlowest: + action = X_("MeterFalloffSlowest"); + break; + case MeterFalloffSlow: + action = X_("MeterFalloffSlow"); + break; + case MeterFalloffMedium: + action = X_("MeterFalloffMedium"); + break; + case MeterFalloffFast: + action = X_("MeterFalloffFast"); + break; + case MeterFalloffFaster: + action = X_("MeterFalloffFaster"); + break; + case MeterFalloffFastest: + action = X_("MeterFalloffFastest"); + break; + } + + Glib::RefPtr<Action> act = ActionManager::get_action (X_("options"), action); + + if (act) { + Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic(act); + if (ract && !ract->get_active()) { + ract->set_active (true); + } + } +} + +void +ARDOUR_UI::map_meter_hold () +{ + const char* action = 0; + + /* XXX hack alert. Fix this. Please */ + + float val = Config->get_meter_hold (); + MeterHold code = (MeterHold) (floor (val)); + + switch (code) { + case MeterHoldOff: + action = X_("MeterHoldOff"); + break; + case MeterHoldShort: + action = X_("MeterHoldShort"); + break; + case MeterHoldMedium: + action = X_("MeterHoldMedium"); + break; + case MeterHoldLong: + action = X_("MeterHoldLong"); + break; + } + + Glib::RefPtr<Action> act = ActionManager::get_action (X_("options"), action); + + if (act) { + Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic(act); + if (ract && !ract->get_active()) { + ract->set_active (true); + } + } +} + +void +ARDOUR_UI::set_meter_hold (MeterHold val) +{ + const char* action = 0; + float fval; + + fval = meter_hold_to_float (val); + + switch (val) { + case MeterHoldOff: + action = X_("MeterHoldOff"); + break; + case MeterHoldShort: + action = X_("MeterHoldShort"); + break; + case MeterHoldMedium: + action = X_("MeterHoldMedium"); + break; + case MeterHoldLong: + action = X_("MeterHoldLong"); + break; + } + + Glib::RefPtr<Action> act = ActionManager::get_action (X_("options"), action); + + if (act) { + Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic(act); + if (ract && ract->get_active() && Config->get_meter_hold() != fval) { + Config->set_meter_hold (fval); + } + } +} + +void +ARDOUR_UI::set_meter_falloff (MeterFalloff val) +{ + const char* action = 0; + float fval; + + fval = meter_falloff_to_float (val); + + switch (val) { + case MeterFalloffOff: + action = X_("MeterFalloffOff"); + break; + case MeterFalloffSlowest: + action = X_("MeterFalloffSlowest"); + break; + case MeterFalloffSlow: + action = X_("MeterFalloffSlow"); + break; + case MeterFalloffMedium: + action = X_("MeterFalloffMedium"); + break; + case MeterFalloffFast: + action = X_("MeterFalloffFast"); + break; + case MeterFalloffFaster: + action = X_("MeterFalloffFaster"); + break; + case MeterFalloffFastest: + action = X_("MeterFalloffFastest"); + break; + } + + Glib::RefPtr<Action> act = ActionManager::get_action (X_("options"), action); + + if (act) { + Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic(act); + if (ract && ract->get_active() && Config->get_meter_falloff () != fval) { + Config->set_meter_falloff (fval); + } } } @@ -413,69 +757,58 @@ ARDOUR_UI::parameter_changed (const char* parameter_name) } else if (PARAM_IS ("send-mtc")) { - map_some_state ("options", "SendMTC", &Configuration::get_send_mtc); + ActionManager::map_some_state ("options", "SendMTC", &Configuration::get_send_mtc); } else if (PARAM_IS ("send-mmc")) { - map_some_state ("options", "SendMMC", &Configuration::get_send_mmc); + ActionManager::map_some_state ("options", "SendMMC", &Configuration::get_send_mmc); } else if (PARAM_IS ("mmc-control")) { - map_some_state ("options", "UseMMC", &Configuration::get_mmc_control); + ActionManager::map_some_state ("options", "UseMMC", &Configuration::get_mmc_control); } else if (PARAM_IS ("midi-feedback")) { - map_some_state ("options", "SendMIDIfeedback", &Configuration::get_midi_feedback); + ActionManager::map_some_state ("options", "SendMIDIfeedback", &Configuration::get_midi_feedback); } else if (PARAM_IS ("midi-control")) { - map_some_state ("options", "UseMIDIcontrol", &Configuration::get_midi_control); + ActionManager::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 ("automatic-crossfades")) { - map_some_state ("Editor", "toggle-auto-xfades", &Configuration::get_automatic_crossfades); - } else if (PARAM_IS ("crossfades-active")) { - map_some_state ("Editor", "toggle-xfades-active", &Configuration::get_crossfades_active); - } else if (PARAM_IS ("crossfades-visible")) { - map_some_state ("Editor", "toggle-xfades-visible", &Configuration::get_crossfades_visible); + ActionManager::map_some_state ("options", "DoNotRunPluginsWhileRecording", &Configuration::get_do_not_record_plugins); } else if (PARAM_IS ("latched-record-enable")) { - map_some_state ("options", "LatchedRecordEnable", &Configuration::get_latched_record_enable); + ActionManager::map_some_state ("options", "LatchedRecordEnable", &Configuration::get_latched_record_enable); } else if (PARAM_IS ("solo-latched")) { - map_some_state ("options", "LatchedSolo", &Configuration::get_solo_latched); + ActionManager::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")) { + map_solo_model (); } else if (PARAM_IS ("auto-play")) { - map_some_state ("Transport", "ToggleAutoPlay", &Configuration::get_auto_play); + ActionManager::map_some_state ("Transport", "ToggleAutoPlay", &Configuration::get_auto_play); } else if (PARAM_IS ("auto-loop")) { - map_some_state ("Transport", "Loop", &Configuration::get_auto_loop); + ActionManager::map_some_state ("Transport", "Loop", &Configuration::get_auto_loop); } else if (PARAM_IS ("auto-return")) { - map_some_state ("Transport", "ToggleAutoReturn", &Configuration::get_auto_return); + ActionManager::map_some_state ("Transport", "ToggleAutoReturn", &Configuration::get_auto_return); } else if (PARAM_IS ("auto-input")) { - map_some_state ("Transport", "ToggleAutoInput", &Configuration::get_auto_input); + ActionManager::map_some_state ("Transport", "ToggleAutoInput", &Configuration::get_auto_input); } else if (PARAM_IS ("punch-out")) { - map_some_state ("Transport", "TogglePunchOut", &Configuration::get_punch_out); + ActionManager::map_some_state ("Transport", "TogglePunchOut", &Configuration::get_punch_out); } else if (PARAM_IS ("punch-in")) { - map_some_state ("Transport", "TogglePunchIn", &Configuration::get_punch_in); + ActionManager::map_some_state ("Transport", "TogglePunchIn", &Configuration::get_punch_in); } else if (PARAM_IS ("clicking")) { - map_some_state ("Transport", "ToggleClick", &Configuration::get_clicking); + ActionManager::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); + ActionManager::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); + ActionManager::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); + ActionManager::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); + ActionManager::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); + ActionManager::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); + ActionManager::map_some_state ("options", "StopTransportAtEndOfSession", &Configuration::get_stop_at_session_end); + } else if (PARAM_IS ("monitoring-model")) { + map_monitor_model (); } else if (PARAM_IS ("use-video-sync")) { - map_some_state ("Transport", "ToggleVideoSync", &Configuration::get_use_video_sync); + ActionManager::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); + ActionManager::map_some_state ("options", "GainReduceFastTransport", &Configuration::get_quieten_at_speed); } else if (PARAM_IS ("shuttle-behaviour")) { switch (Config->get_shuttle_behaviour ()) { @@ -505,7 +838,19 @@ ARDOUR_UI::parameter_changed (const char* parameter_name) shuttle_units_button.set_label(_("ST")); break; } + } else if (PARAM_IS ("input-auto-connect")) { + map_input_auto_connect (); + } else if (PARAM_IS ("output-auto-connect")) { + map_output_auto_connect (); + } else if (PARAM_IS ("native-file-header-format")) { + map_file_header_format (); + } else if (PARAM_IS ("native-file-data-format")) { + map_file_data_format (); + } else if (PARAM_IS ("meter-hold")) { + map_meter_hold (); + } else if (PARAM_IS ("meter-falloff")) { + map_meter_falloff (); } - + #undef PARAM_IS } diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 22d9290b78..071f18d3ec 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -98,15 +98,6 @@ const double Editor::timebar_height = 15.0; #include "editor_xpms" -static const int32_t slide_index = 0; -static const int32_t splice_index = 1; - -static const gchar *edit_mode_strings[] = { - N_("Slide Edit"), - N_("Splice Edit"), - 0 -}; - static const gchar *snap_type_strings[] = { N_("None"), N_("CD Frames"), @@ -1003,31 +994,6 @@ Editor::on_realize () } void -Editor::parameter_changed (const char* parameter_name) -{ -#define PARAM_IS(x) (!strcmp (parameter_name, (x))) - - ENSURE_GUI_THREAD (bind (mem_fun (*this, &Editor::parameter_changed), parameter_name)); - - if (PARAM_IS ("auto-loop")) { - update_loop_range_view (true); - } else if (PARAM_IS ("punch-in")) { - update_punch_range_view (true); - } else if (PARAM_IS ("punch-out")) { - update_punch_range_view (true); - } else if (PARAM_IS ("layer-model")) { - update_layering_model (); - } else if (PARAM_IS ("smpte-frames-per-second") || PARAM_IS ("smpte-drop-frames")) { - update_smpte_mode (); - update_just_smpte (); - } else if (PARAM_IS ("video-pullup")) { - update_video_pullup (); - } - -#undef PARAM_IS -} - -void Editor::start_scrolling () { scroll_connection = ARDOUR_UI::instance()->SuperRapidScreenUpdate.connect @@ -1181,16 +1147,6 @@ Editor::connect_to_session (Session *t) analysis_window->set_session (session); #endif - switch (Config->get_edit_mode()) { - case Splice: - edit_mode_selector.set_active_text (edit_mode_strings[splice_index]); - break; - - case Slide: - edit_mode_selector.set_active_text (edit_mode_strings[slide_index]); - break; - } - Location* loc = session->locations()->auto_loop_location(); if (loc == 0) { loc = new Location (0, session->current_end_frame(), _("Loop"),(Location::Flags) (Location::IsAutoLoop | Location::IsHidden)); @@ -1231,35 +1187,6 @@ Editor::connect_to_session (Session *t) session->locations()->StateChanged.connect (mem_fun(*this, &Editor::refresh_location_display_s)); session->locations()->end_location()->changed.connect (mem_fun(*this, &Editor::end_location_changed)); - bool yn; - RefPtr<Action> act; - - act = ActionManager::get_action (X_("Editor"), X_("toggle-xfades-active")); - if (act) { - RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act); - /* do it twice to force the change */ - yn = Config->get_crossfades_active(); - tact->set_active (!yn); - tact->set_active (yn); - } - - act = ActionManager::get_action (X_("Editor"), X_("toggle-auto-xfades")); - if (act) { - RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act); - /* do it twice to force the change */ - yn = Config->get_auto_xfade (); - tact->set_active (!yn); - tact->set_active (yn); - } - - /* xfade visibility state set from editor::set_state() */ - - update_crossfade_model(); - update_layering_model(); - - update_smpte_mode(); - update_video_pullup(); - handle_new_duration (); redisplay_regions (); @@ -2569,9 +2496,13 @@ Editor::setup_toolbar () mouse_mode_button_box.pack_start(mouse_audition_button, true, true); mouse_mode_button_box.set_homogeneous(true); + vector<string> edit_mode_strings; + edit_mode_strings.push_back (edit_mode_to_string (Splice)); + edit_mode_strings.push_back (edit_mode_to_string (Slide)); + edit_mode_selector.set_name ("EditModeSelector"); - Gtkmm2ext::set_size_request_to_display_given_text (edit_mode_selector, "Splice Edit", 2+FUDGE, 10); - set_popdown_strings (edit_mode_selector, internationalize (edit_mode_strings)); + Gtkmm2ext::set_size_request_to_display_given_text (edit_mode_selector, longest (edit_mode_strings).c_str(), 2+FUDGE, 10); + set_popdown_strings (edit_mode_selector, edit_mode_strings); edit_mode_selector.signal_changed().connect (mem_fun(*this, &Editor::edit_mode_selection_done)); mode_box->pack_start(edit_mode_selector); @@ -4136,131 +4067,3 @@ Editor::on_key_press_event (GdkEventKey* ev) return key_press_focus_accelerator_handler (*this, ev); } -void -Editor::update_smpte_mode () -{ - ENSURE_GUI_THREAD(mem_fun(*this, &Editor::update_smpte_mode)); - - RefPtr<Action> act; - - 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")); - else if ((frames < 24 * 1.0005) && !drop) - act = ActionManager::get_action (X_("Editor"), X_("Smpte24")); - else if ((frames < 24.976 * 1.0005) && !drop) - act = ActionManager::get_action (X_("Editor"), X_("Smpte24976")); - else if ((frames < 25 * 1.0005) && !drop) - act = ActionManager::get_action (X_("Editor"), X_("Smpte25")); - else if ((frames < 29.97 * 1.0005) && !drop) - act = ActionManager::get_action (X_("Editor"), X_("Smpte2997")); - else if ((frames < 29.97 * 1.0005) && drop) - act = ActionManager::get_action (X_("Editor"), X_("Smpte2997drop")); - else if ((frames < 30 * 1.0005) && !drop) - act = ActionManager::get_action (X_("Editor"), X_("Smpte30")); - else if ((frames < 30 * 1.0005) && drop) - act = ActionManager::get_action (X_("Editor"), X_("Smpte30drop")); - else if ((frames < 59.94 * 1.0005) && !drop) - act = ActionManager::get_action (X_("Editor"), X_("Smpte5994")); - else if ((frames < 60 * 1.0005) && !drop) - act = ActionManager::get_action (X_("Editor"), X_("Smpte60")); - else - cerr << "Unexpected SMPTE value (" << frames << (drop ? "drop" : "") << ") in update_smpte_mode. Menu is probably wrong\n" << endl; - - - if (act) { - RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act); - if (ract && !ract->get_active()) { - ract->set_active (true); - } - } -} - -void -Editor::update_video_pullup () -{ - ENSURE_GUI_THREAD (mem_fun(*this, &Editor::update_video_pullup)); - - RefPtr<Action> act; - - float pullup = Config->get_video_pullup(); - - if ( pullup < (-4.1667 - 0.1) * 0.99) { - act = ActionManager::get_action (X_("Editor"), X_("PullupMinus4Minus1")); - } else if ( pullup < (-4.1667) * 0.99 ) { - act = ActionManager::get_action (X_("Editor"), X_("PullupMinus4")); - } else if ( pullup < (-4.1667 + 0.1) * 0.99 ) { - act = ActionManager::get_action (X_("Editor"), X_("PullupMinus4Plus1")); - } else if ( pullup < (-0.1) * 0.99 ) { - act = ActionManager::get_action (X_("Editor"), X_("PullupMinus1")); - } else if (pullup > (4.1667 + 0.1) * 0.99 ) { - act = ActionManager::get_action (X_("Editor"), X_("PullupPlus4Plus1")); - } else if ( pullup > (4.1667) * 0.99 ) { - act = ActionManager::get_action (X_("Editor"), X_("PullupPlus4")); - } else if ( pullup > (4.1667 - 0.1) * 0.99) { - act = ActionManager::get_action (X_("Editor"), X_("PullupPlus4Minus1")); - } else if ( pullup > (0.1) * 0.99 ) { - act = ActionManager::get_action (X_("Editor"), X_("PullupPlus1")); - } else - act = ActionManager::get_action (X_("Editor"), X_("PullupNone")); - - - if (act) { - RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act); - if (ract && !ract->get_active()) { - ract->set_active (true); - } - } - -} - - -void -Editor::update_layering_model () -{ - RefPtr<Action> act; - - switch (Config->get_layer_model()) { - case LaterHigher: - act = ActionManager::get_action (X_("Editor"), X_("LayerLaterHigher")); - break; - case MoveAddHigher: - act = ActionManager::get_action (X_("Editor"), X_("LayerMoveAddHigher")); - break; - case AddHigher: - act = ActionManager::get_action (X_("Editor"), X_("LayerAddHigher")); - break; - } - - if (act) { - RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act); - if (ract && !ract->get_active()) { - ract->set_active (true); - } - } -} - -void -Editor::update_crossfade_model () -{ - RefPtr<Action> act; - - switch (Config->get_xfade_model()) { - case FullCrossfade: - act = ActionManager::get_action (X_("Editor"), X_("CrossfadesFull")); - break; - case ShortCrossfade: - act = ActionManager::get_action (X_("Editor"), X_("CrossfadesShort")); - break; - } - - if (act) { - RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act); - if (ract && !ract->get_active()) { - ract->set_active (true); - } - } -} - diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 4feee52d0a..a8c12b4d81 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -315,7 +315,6 @@ class Editor : public PublicEditor void update_crossfade_model (); void set_crossfade_model (ARDOUR::CrossfadeModel); - /* layers */ void set_layer_model (ARDOUR::LayerModel); void update_layering_model (); diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index 229177d5c3..b61c2c049b 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -5,6 +5,7 @@ #include "editing.h" #include "actions.h" #include "ardour_ui.h" +#include "gui_thread.h" #include "i18n.h" using namespace Gtk; @@ -41,9 +42,6 @@ Editor::register_actions () ActionManager::register_action (editor_actions, X_("Layering"), _("Layering")); ActionManager::register_action (editor_actions, X_("SMPTE"), _("SMPTE fps")); ActionManager::register_action (editor_actions, X_("Pullup"), _("Pullup / Pulldown")); - ActionManager::register_action (editor_actions, X_("Metering"), _("Metering")); - ActionManager::register_action (editor_actions, X_("MeteringFallOffRate"), _("Fall off rate")); - ActionManager::register_action (editor_actions, X_("MeteringHoldTime"), _("Hold Time")); ActionManager::register_action (editor_actions, X_("addExistingAudioFiles"), _("Add Existing Audio")); /* add named actions for the editor */ @@ -368,27 +366,6 @@ Editor::register_actions () ActionManager::register_toggle_action (editor_actions, X_("ToggleWaveformsWhileRecording"), _("Show Waveforms While Recording"), mem_fun (*this, &Editor::toggle_waveforms_while_recording)); act = ActionManager::register_toggle_action (editor_actions, X_("ToggleMeasureVisibility"), _("Show Measures"), mem_fun (*this, &Editor::toggle_measure_visibility)); - RadioAction::Group meter_falloff_group; - RadioAction::Group meter_hold_group; - - /* - Slowest = 6.6dB/sec falloff at update rate of 40ms - Slow = 6.8dB/sec falloff at update rate of 40ms - */ - - 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), LaterHigher)); @@ -458,32 +435,156 @@ Editor::toggle_measure_visibility () } void -Editor::toggle_auto_xfade () +Editor::set_crossfade_model (CrossfadeModel model) { - Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("toggle-auto-xfades")); + RefPtr<Action> act; + + /* 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 + active. + */ + + switch (model) { + case FullCrossfade: + act = ActionManager::get_action (X_("Editor"), X_("CrossfadesFull")); + break; + case ShortCrossfade: + act = ActionManager::get_action (X_("Editor"), X_("CrossfadesShort")); + break; + } + if (act) { - Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act); - Config->set_auto_xfade (tact->get_active()); + RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act); + if (ract && ract->get_active()) { + Config->set_xfade_model (model); + } } } void -Editor::toggle_xfades_active () +Editor::update_crossfade_model () { - 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); - Config->set_crossfades_active (tact->get_active()); + RefPtr<Action> act; + + switch (Config->get_xfade_model()) { + case FullCrossfade: + act = ActionManager::get_action (X_("Editor"), X_("CrossfadesFull")); + break; + case ShortCrossfade: + act = ActionManager::get_action (X_("Editor"), X_("CrossfadesShort")); + break; + } + + if (act) { + RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act); + if (ract && !ract->get_active()) { + ract->set_active (true); + } } } void -Editor::toggle_xfade_visibility () +Editor::update_smpte_mode () { - Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("toggle-xfades-visible")); - if (session && act) { - Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act); - // set_xfade_visibility (tact->get_active()); + ENSURE_GUI_THREAD(mem_fun(*this, &Editor::update_smpte_mode)); + + RefPtr<Action> act; + + 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")); + else if ((frames < 24 * 1.0005) && !drop) + act = ActionManager::get_action (X_("Editor"), X_("Smpte24")); + else if ((frames < 24.976 * 1.0005) && !drop) + act = ActionManager::get_action (X_("Editor"), X_("Smpte24976")); + else if ((frames < 25 * 1.0005) && !drop) + act = ActionManager::get_action (X_("Editor"), X_("Smpte25")); + else if ((frames < 29.97 * 1.0005) && !drop) + act = ActionManager::get_action (X_("Editor"), X_("Smpte2997")); + else if ((frames < 29.97 * 1.0005) && drop) + act = ActionManager::get_action (X_("Editor"), X_("Smpte2997drop")); + else if ((frames < 30 * 1.0005) && !drop) + act = ActionManager::get_action (X_("Editor"), X_("Smpte30")); + else if ((frames < 30 * 1.0005) && drop) + act = ActionManager::get_action (X_("Editor"), X_("Smpte30drop")); + else if ((frames < 59.94 * 1.0005) && !drop) + act = ActionManager::get_action (X_("Editor"), X_("Smpte5994")); + else if ((frames < 60 * 1.0005) && !drop) + act = ActionManager::get_action (X_("Editor"), X_("Smpte60")); + else + cerr << "Unexpected SMPTE value (" << frames << (drop ? "drop" : "") << ") in update_smpte_mode. Menu is probably wrong\n" << endl; + + + if (act) { + RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act); + if (ract && !ract->get_active()) { + ract->set_active (true); + } + } +} + +void +Editor::update_video_pullup () +{ + ENSURE_GUI_THREAD (mem_fun(*this, &Editor::update_video_pullup)); + + RefPtr<Action> act; + + float pullup = Config->get_video_pullup(); + + if ( pullup < (-4.1667 - 0.1) * 0.99) { + act = ActionManager::get_action (X_("Editor"), X_("PullupMinus4Minus1")); + } else if ( pullup < (-4.1667) * 0.99 ) { + act = ActionManager::get_action (X_("Editor"), X_("PullupMinus4")); + } else if ( pullup < (-4.1667 + 0.1) * 0.99 ) { + act = ActionManager::get_action (X_("Editor"), X_("PullupMinus4Plus1")); + } else if ( pullup < (-0.1) * 0.99 ) { + act = ActionManager::get_action (X_("Editor"), X_("PullupMinus1")); + } else if (pullup > (4.1667 + 0.1) * 0.99 ) { + act = ActionManager::get_action (X_("Editor"), X_("PullupPlus4Plus1")); + } else if ( pullup > (4.1667) * 0.99 ) { + act = ActionManager::get_action (X_("Editor"), X_("PullupPlus4")); + } else if ( pullup > (4.1667 - 0.1) * 0.99) { + act = ActionManager::get_action (X_("Editor"), X_("PullupPlus4Minus1")); + } else if ( pullup > (0.1) * 0.99 ) { + act = ActionManager::get_action (X_("Editor"), X_("PullupPlus1")); + } else + act = ActionManager::get_action (X_("Editor"), X_("PullupNone")); + + + if (act) { + RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act); + if (ract && !ract->get_active()) { + ract->set_active (true); + } + } + +} + +void +Editor::update_layering_model () +{ + RefPtr<Action> act; + + switch (Config->get_layer_model()) { + case LaterHigher: + act = ActionManager::get_action (X_("Editor"), X_("LayerLaterHigher")); + break; + case MoveAddHigher: + act = ActionManager::get_action (X_("Editor"), X_("LayerMoveAddHigher")); + break; + case AddHigher: + act = ActionManager::get_action (X_("Editor"), X_("LayerAddHigher")); + break; + } + + if (act) { + RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act); + if (ract && !ract->get_active()) { + ract->set_active (true); + } } } @@ -497,24 +598,22 @@ Editor::set_layer_model (LayerModel model) RefPtr<Action> act; - if (session) { - switch (model) { - case LaterHigher: - act = ActionManager::get_action (X_("Editor"), X_("LayerLaterHigher")); - break; - case MoveAddHigher: - act = ActionManager::get_action (X_("Editor"), X_("LayerMoveAddHigher")); - break; - case AddHigher: - act = ActionManager::get_action (X_("Editor"), X_("LayerAddHigher")); - break; - } - - if (act) { - RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act); - if (ract && ract->get_active()) { - Config->set_layer_model (model); - } + switch (model) { + case LaterHigher: + act = ActionManager::get_action (X_("Editor"), X_("LayerLaterHigher")); + break; + case MoveAddHigher: + act = ActionManager::get_action (X_("Editor"), X_("LayerMoveAddHigher")); + break; + case AddHigher: + act = ActionManager::get_action (X_("Editor"), X_("LayerAddHigher")); + break; + } + + if (act) { + RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act); + if (ract && ract->get_active() && Config->get_layer_model() != model) { + Config->set_layer_model (model); } } } @@ -662,32 +761,56 @@ Editor::video_pullup_chosen (Session::PullupFormat pullup) } } +void +Editor::toggle_auto_xfade () +{ + ActionManager::toggle_config_state ("Editor", "toggle-auto-xfades", &Configuration::set_auto_xfade, &Configuration::get_auto_xfade); +} void -Editor::set_crossfade_model (CrossfadeModel model) +Editor::toggle_xfades_active () { - RefPtr<Action> act; + ActionManager::toggle_config_state ("Editor", "toggle-xfades-active", &Configuration::set_crossfades_active, &Configuration::get_crossfades_active); +} - /* 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 - active. - */ +void +Editor::toggle_xfade_visibility () +{ + ActionManager::toggle_config_state ("Editor", "toggle-xfades-visibility", &Configuration::set_crossfades_visible, &Configuration::get_crossfades_visible); +} - if (session) { - switch (model) { - case FullCrossfade: - act = ActionManager::get_action (X_("Editor"), X_("CrossfadesFull")); - break; - case ShortCrossfade: - act = ActionManager::get_action (X_("Editor"), X_("CrossfadesShort")); - break; - } - - if (act) { - RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act); - if (ract && ract->get_active()) { - Config->set_xfade_model (model); - } - } +void +Editor::parameter_changed (const char* parameter_name) +{ +#define PARAM_IS(x) (!strcmp (parameter_name, (x))) + + ENSURE_GUI_THREAD (bind (mem_fun (*this, &Editor::parameter_changed), parameter_name)); + + if (PARAM_IS ("auto-loop")) { + update_loop_range_view (true); + } else if (PARAM_IS ("punch-in")) { + update_punch_range_view (true); + } else if (PARAM_IS ("punch-out")) { + update_punch_range_view (true); + } else if (PARAM_IS ("layer-model")) { + update_layering_model (); + } else if (PARAM_IS ("smpte-frames-per-second") || PARAM_IS ("smpte-drop-frames")) { + update_smpte_mode (); + update_just_smpte (); + } else if (PARAM_IS ("video-pullup")) { + update_video_pullup (); + } else if (PARAM_IS ("crossfades-active")) { + ActionManager::map_some_state ("Editor", "toggle-xfades-active", &Configuration::get_crossfades_active); + } else if (PARAM_IS ("crossfades-visible")) { + ActionManager::map_some_state ("Editor", "toggle-xfades-visible", &Configuration::get_crossfades_visible); + } else if (PARAM_IS ("auto-xfade")) { + ActionManager::map_some_state ("Editor", "toggle-auto-xfade", &Configuration::get_auto_xfade); + } else if (PARAM_IS ("edit-mode")) { + edit_mode_selector.set_active_text (edit_mode_to_string (Config->get_edit_mode())); + } else if (PARAM_IS ("native-file-data-format")) { } + + + +#undef PARAM_IS } diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc index ef90c34755..7e58d0e2f7 100644 --- a/gtk2_ardour/utils.cc +++ b/gtk2_ardour/utils.cc @@ -469,3 +469,30 @@ get_xpm (std::string name) return (xpm_map[name]); } +string +longest (vector<string>& strings) +{ + if (strings.empty()) { + return string (""); + } + + vector<string>::iterator longest = strings.begin(); + string::size_type longest_length = (*longest).length(); + + vector<string>::iterator i = longest; + ++i; + + while (i != strings.end()) { + + string::size_type len = (*i).length(); + + if (len > longest_length) { + longest = i; + longest_length = len; + } + + ++i; + } + + return *longest; +} diff --git a/gtk2_ardour/utils.h b/gtk2_ardour/utils.h index c0b7aac524..a48a32c10e 100644 --- a/gtk2_ardour/utils.h +++ b/gtk2_ardour/utils.h @@ -23,6 +23,7 @@ #include <string> #include <cmath> +#include <vector> #include <ardour/types.h> #include <libgnomecanvasmm/line.h> #include <gdkmm/types.h> @@ -78,5 +79,6 @@ bool key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey* ev); Glib::RefPtr<Gdk::Pixbuf> get_xpm(std::string); static std::map<std::string, Glib::RefPtr<Gdk::Pixbuf> > xpm_map; const char* const *get_xpm_data (std::string path); +std::string longest (std::vector<std::string>&); #endif /* __ardour_gtk_utils_h__ */ diff --git a/libs/ardour/ardour/configuration_vars.h b/libs/ardour/ardour/configuration_vars.h index 9cdba051fd..7301b31d8a 100644 --- a/libs/ardour/ardour/configuration_vars.h +++ b/libs/ardour/ardour/configuration_vars.h @@ -1,3 +1,8 @@ +/* IO connection */ + +CONFIG_VARIABLE (AutoConnectOption, output_auto_connect, "output-auto-connect", AutoConnectOption (0)) +CONFIG_VARIABLE (AutoConnectOption, input_auto_connect, "input-auto-connect", AutoConnectOption (0)) + #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") @@ -5,89 +10,117 @@ CONFIG_VARIABLE (std::string, auditioner_output_right, "auditioner-output-right" 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 - + +/* MIDI and MIDI related */ + 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, 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 (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) + +/* control surfaces */ + CONFIG_VARIABLE (uint32_t, feedback_interval_ms, "feedback-interval-ms", 100) +CONFIG_VARIABLE (bool, use_tranzport, "use-tranzport", false) + +/* disk operations */ + +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 (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) + +/* OSC */ + 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, automatic_crossfades, "automatic-crossfades", false) + +/* crossfades */ + +CONFIG_VARIABLE (CrossfadeModel, xfade_model, "xfade-model", ShortCrossfade) +CONFIG_VARIABLE (bool, auto_xfade, "auto-xfade", true) +CONFIG_VARIABLE (float, short_xfade_seconds, "short-xfade-seconds", 0.015) CONFIG_VARIABLE (bool, crossfades_active, "crossfades-active", false) CONFIG_VARIABLE (bool, crossfades_visible, "crossfades-visible", 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 (uint32_t, destructive_xfade_msecs, "destructive-xfade-msecs", 2) + +/* editing related */ + CONFIG_VARIABLE (EditMode, edit_mode, "edit-mode", Slide) CONFIG_VARIABLE (LayerModel, layer_model, "layer-model", MoveAddHigher) + +/* monitoring, mute, solo etc */ + +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 (MonitorModel, monitoring_model, "monitoring-model", SoftwareMonitoring) 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, latched_record_enable, "latched-record-enable", false) +CONFIG_VARIABLE (bool, all_safe, "all-safe", false) + +/* click */ + 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) + +/* transport control and related */ + +CONFIG_VARIABLE (bool, auto_play, "auto-play", false) +CONFIG_VARIABLE (bool, auto_return, "auto-return", false) +CONFIG_VARIABLE (bool, auto_input, "auto-input", true) +CONFIG_VARIABLE (bool, auto_loop, "auto-loop", false) +CONFIG_VARIABLE (bool, punch_in, "punch-in", false) +CONFIG_VARIABLE (bool, punch_out, "punch-out", false) +CONFIG_VARIABLE (bool, plugins_stop_with_transport, "plugins-stop-with-transport", false) +CONFIG_VARIABLE (bool, do_not_record_plugins, "do-not-record-plugins", false) +CONFIG_VARIABLE (bool, stop_recording_on_xrun, "stop-recording-on-xrun", false) +CONFIG_VARIABLE (bool, stop_at_session_end, "stop-at-session-end", true) +CONFIG_VARIABLE (bool, seamless_loop, "seamless-loop", false) +CONFIG_VARIABLE (nframes_t, preroll, "preroll", 0) +CONFIG_VARIABLE (nframes_t, postroll, "postroll", 0) 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 (SlaveSource, slave_source, "slave-source", None) +CONFIG_VARIABLE (ShuttleBehaviour, shuttle_behaviour, "shuttle-behaviour", Sprung) +CONFIG_VARIABLE (ShuttleUnits, shuttle_units, "shuttle-units", Percentage) +CONFIG_VARIABLE (bool, quieten_at_speed, "quieten-at-speed", true) + +/* timecode and sync */ + +CONFIG_VARIABLE (bool, jack_time_master, "jack-time-master", true) +CONFIG_VARIABLE (bool, use_video_sync, "use-video-sync", false) +CONFIG_VARIABLE (bool, timecode_source_is_synced, "timecode-source-is-synced", true) CONFIG_VARIABLE (float, 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 (nframes_t, preroll, "preroll", 0) -CONFIG_VARIABLE (nframes_t, postroll, "postroll", 0) + +/* metering */ + +CONFIG_VARIABLE (float, meter_hold, "meter-hold", 100.0f) +CONFIG_VARIABLE (float, meter_falloff, "meter-falloff", 0.375f) CONFIG_VARIABLE (nframes_t, over_length_short, "over-length-short", 2) CONFIG_VARIABLE (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 */ +/* miscellany */ + +CONFIG_VARIABLE (bool, hiding_groups_deactivates_groups, "hiding-groups-deactivates-groups", true) +CONFIG_VARIABLE (bool, verify_remove_last_capture, "verify-remove-last-capture", true) +CONFIG_VARIABLE (bool, no_new_session_dialog, "no-new-session-dialog", false) +CONFIG_VARIABLE (bool, use_vst, "use-vst", true) + +/* these variables have custom set() methods (e.g. path globbing) */ CONFIG_VARIABLE_SPECIAL(std::string, raid_path, "raid-path", "", path_expand) diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index a55bc84e7e..f6d5e9cc8d 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -833,10 +833,6 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible boost::shared_ptr<AudioRegion> tempoize_region (TimeStretchRequest&); - /* need to call this whenever we change native file formats */ - - void reset_native_file_format(); - /* disk, buffer loads */ uint32_t playback_load (); @@ -1642,9 +1638,6 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible boost::shared_ptr<IO> _master_out; boost::shared_ptr<IO> _control_out; - AutoConnectOption input_auto_connect; - AutoConnectOption output_auto_connect; - gain_t* _gain_automation_buffer; pan_t** _pan_automation_buffer; void allocate_pan_automation_buffers (nframes_t nframes, uint32_t howmany, bool force); @@ -1681,6 +1674,11 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible void add_controllable (PBD::Controllable*); void remove_controllable (PBD::Controllable*); + + void reset_native_file_format(); + bool first_file_data_format_reset; + bool first_file_header_format_reset; + void config_changed (const char*); }; diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h index d4e49bc624..c80944ebd0 100644 --- a/libs/ardour/ardour/types.h +++ b/libs/ardour/ardour/types.h @@ -200,6 +200,28 @@ namespace ARDOUR { } }; + /* + Slowest = 6.6dB/sec falloff at update rate of 40ms + Slow = 6.8dB/sec falloff at update rate of 40ms + */ + + enum MeterFalloff { + MeterFalloffOff = 0, + MeterFalloffSlowest = 1, + MeterFalloffSlow = 2, + MeterFalloffMedium = 3, + MeterFalloffFast = 4, + MeterFalloffFaster = 5, + MeterFalloffFastest = 6 + }; + + enum MeterHold { + MeterHoldOff = 0, + MeterHoldShort = 40, + MeterHoldMedium = 100, + MeterHoldLong = 200 + }; + enum EditMode { Slide, Splice @@ -221,6 +243,12 @@ namespace ARDOUR { PostFader }; + enum MonitorModel { + HardwareMonitoring, + SoftwareMonitoring, + ExternalMonitoring, + }; + enum CrossfadeModel { FullCrossfade, ShortCrossfade @@ -302,6 +330,7 @@ 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::MonitorModel& 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); diff --git a/libs/ardour/ardour/utils.h b/libs/ardour/ardour/utils.h index 1764885366..d926f52f82 100644 --- a/libs/ardour/ardour/utils.h +++ b/libs/ardour/ardour/utils.h @@ -62,6 +62,12 @@ void compute_equal_power_fades (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); +const char* edit_mode_to_string (ARDOUR::EditMode); +ARDOUR::EditMode string_to_edit_mode (std::string); + +float meter_falloff_to_float (ARDOUR::MeterFalloff); +float meter_hold_to_float (ARDOUR::MeterHold); + #if defined(HAVE_COREAUDIO) || defined(HAVE_AUDIOUNITS) std::string CFStringRefToStdString(CFStringRef stringRef); #endif // HAVE_COREAUDIO diff --git a/libs/ardour/audio_diskstream.cc b/libs/ardour/audio_diskstream.cc index 580ce49231..71d16583e0 100644 --- a/libs/ardour/audio_diskstream.cc +++ b/libs/ardour/audio_diskstream.cc @@ -1708,7 +1708,7 @@ AudioDiskstream::engage_record_enable () g_atomic_int_set (&_record_enabled, 1); capturing_sources.clear (); - if (Config->get_use_hardware_monitoring()) { + if (Config->get_monitoring_model() == HardwareMonitoring) { for (ChannelList::iterator chan = channels.begin(); chan != channels.end(); ++chan) { if ((*chan).source) { (*chan).source->ensure_monitor_input (!(Config->get_auto_input() && rolling)); @@ -1728,7 +1728,7 @@ void AudioDiskstream::disengage_record_enable () { g_atomic_int_set (&_record_enabled, 0); - if (Config->get_use_hardware_monitoring()) { + if (Config->get_monitoring_model() == HardwareMonitoring) { for (ChannelList::iterator chan = channels.begin(); chan != channels.end(); ++chan) { if ((*chan).source) { (*chan).source->ensure_monitor_input (false); @@ -1967,6 +1967,8 @@ AudioDiskstream::reset_write_sources (bool mark_write_complete, bool force) ChannelList::iterator chan; uint32_t n; + cerr << _name << " RWS\n"; + if (!recordable()) { return; } diff --git a/libs/ardour/audio_track.cc b/libs/ardour/audio_track.cc index 7987222aa3..2860470abd 100644 --- a/libs/ardour/audio_track.cc +++ b/libs/ardour/audio_track.cc @@ -445,14 +445,14 @@ AudioTrack::no_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_fra } else { if (Config->get_auto_input()) { - if (Config->get_use_sw_monitoring()) { + if (Config->get_monitoring_model() == SoftwareMonitoring) { send_silence = false; } else { send_silence = true; } } else { if (_diskstream->record_enabled()) { - if (Config->get_use_sw_monitoring()) { + if (Config->get_monitoring_model() == SoftwareMonitoring) { send_silence = false; } else { send_silence = true; diff --git a/libs/ardour/configuration.cc b/libs/ardour/configuration.cc index 37666f7dca..e84e92fa26 100644 --- a/libs/ardour/configuration.cc +++ b/libs/ardour/configuration.cc @@ -149,10 +149,8 @@ Configuration::save_state() bool Configuration::save_config_options_predicate (ConfigVariableBase::Owner owner) { - const ConfigVariableBase::Owner default_or_from_config_file = (ConfigVariableBase::Owner) - (ConfigVariableBase::Default|ConfigVariableBase::System|ConfigVariableBase::Config); - - return owner & default_or_from_config_file; + /* only save things that were in the config file to start with */ + return owner & ConfigVariableBase::Config; } XMLNode& diff --git a/libs/ardour/globals.cc b/libs/ardour/globals.cc index 91aa95ba31..0cd7338aa3 100644 --- a/libs/ardour/globals.cc +++ b/libs/ardour/globals.cc @@ -585,6 +585,7 @@ std::istream& int_to_type (std::istream& o, T& hf) { 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, MonitorModel& var) { return int_to_type<MonitorModel> (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); } diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index 291509a00d..9c752eefeb 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -228,9 +228,18 @@ Route::process_output_buffers (vector<Sample*>& bufs, uint32_t nbufs, IO *co; bool mute_audible; bool solo_audible; - bool no_monitor = (Config->get_use_hardware_monitoring() || !Config->get_use_sw_monitoring ()); + bool no_monitor; gain_t* gab = _session.gain_automation_buffer(); + switch (Config->get_monitoring_model()) { + case HardwareMonitoring: + case ExternalMonitoring: + no_monitor = true; + break; + default: + no_monitor = false; + } + declick = _pending_declick; { @@ -417,11 +426,11 @@ Route::process_output_buffers (vector<Sample*>& bufs, uint32_t nbufs, // h/w monitoring not in use - (!Config->get_use_hardware_monitoring() && + (!Config->get_monitoring_model() == HardwareMonitoring && // AND software monitoring required - Config->get_use_sw_monitoring())) { + Config->get_monitoring_model() == SoftwareMonitoring)) { if (apply_gain_automation) { diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 2cf86434d7..057774b49c 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -358,8 +358,8 @@ Session::Session (AudioEngine &eng, output_ac = AutoConnectOption (output_ac & ~AutoConnectMaster); } - input_auto_connect = input_ac; - output_auto_connect = output_ac; + Config->set_input_auto_connect (input_ac); + Config->set_output_auto_connect (output_ac); if (second_stage_init (new_session)) { throw failed_constructor (); @@ -939,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() && !Config->get_auto_input()); + (*i)->monitor_input (Config->get_monitoring_model() == HardwareMonitoring && !Config->get_auto_input()); } } } else { @@ -948,7 +948,7 @@ Session::reset_input_monitor_state () for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) { if ((*i)->record_enabled ()) { //cerr << "switching to input = " << !Config->get_auto_input() << __FILE__ << __LINE__ << endl << endl; - (*i)->monitor_input (Config->get_use_hardware_monitoring()); + (*i)->monitor_input (Config->get_monitoring_model() == HardwareMonitoring); } } } @@ -1149,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() && Config->get_auto_input()) { + if (Config->get_monitoring_model() == HardwareMonitoring && 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 ()) { @@ -1179,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() && Config->get_auto_input()) { + if (Config->get_monitoring_model() == HardwareMonitoring && Config->get_auto_input()) { boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader(); for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) { @@ -1202,7 +1202,7 @@ Session::step_back_from_record () { g_atomic_int_set (&_record_status, Enabled); - if (Config->get_use_hardware_monitoring()) { + if (Config->get_monitoring_model() == HardwareMonitoring) { boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader(); for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) { @@ -1610,13 +1610,13 @@ Session::new_audio_track (int input_channels, int output_channels, TrackMode mod } while (track_id < (UINT_MAX-1)); - if (input_auto_connect & AutoConnectPhysical) { + if (Config->get_input_auto_connect() & AutoConnectPhysical) { nphysical_in = min (n_physical_inputs, (uint32_t) physinputs.size()); } else { nphysical_in = 0; } - if (output_auto_connect & AutoConnectPhysical) { + if (Config->get_output_auto_connect() & AutoConnectPhysical) { nphysical_out = min (n_physical_outputs, (uint32_t) physinputs.size()); } else { nphysical_out = 0; @@ -1636,7 +1636,7 @@ Session::new_audio_track (int input_channels, int output_channels, TrackMode mod port = ""; - if (input_auto_connect & AutoConnectPhysical) { + if (Config->get_input_auto_connect() & AutoConnectPhysical) { port = physinputs[(channels_used+x)%nphysical_in]; } @@ -1650,9 +1650,9 @@ Session::new_audio_track (int input_channels, int output_channels, TrackMode mod port = ""; - if (nphysical_out && (output_auto_connect & AutoConnectPhysical)) { + if (nphysical_out && (Config->get_output_auto_connect() & AutoConnectPhysical)) { port = physoutputs[(channels_used+x)%nphysical_out]; - } else if (output_auto_connect & AutoConnectMaster) { + } else if (Config->get_output_auto_connect() & AutoConnectMaster) { if (_master_out) { port = _master_out->input (x%_master_out->n_inputs())->name(); } @@ -1756,7 +1756,7 @@ Session::new_audio_route (int input_channels, int output_channels, uint32_t how_ port = ""; - if (input_auto_connect & AutoConnectPhysical) { + if (Config->get_input_auto_connect() & AutoConnectPhysical) { port = physinputs[((n+x)%n_physical_inputs)]; } @@ -1769,9 +1769,9 @@ Session::new_audio_route (int input_channels, int output_channels, uint32_t how_ port = ""; - if (output_auto_connect & AutoConnectPhysical) { + if (Config->get_output_auto_connect() & AutoConnectPhysical) { port = physoutputs[((n+x)%n_physical_outputs)]; - } else if (output_auto_connect & AutoConnectMaster) { + } else if (Config->get_output_auto_connect() & AutoConnectMaster) { if (_master_out) { port = _master_out->input (x%_master_out->n_inputs())->name(); } diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index fdbdb2da8d..cb52b9c4e4 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -176,7 +176,9 @@ Session::first_stage_init (string fullpath, string snapshot_name) pending_abort = false; destructive_index = 0; current_trans = 0; - + first_file_data_format_reset = true; + first_file_header_format_reset = true; + AudioDiskstream::allocate_working_buffers(); /* default short fade = 15ms */ @@ -745,8 +747,6 @@ Session::get_options () const child = option_root.add_child ("end-marker-is-free"); child->add_property ("val", _end_location_is_free ? "yes" : "no"); - child = option_root.add_child ("full-xfades-unmuted"); - return option_root; } @@ -2880,7 +2880,7 @@ Session::config_changed (const char* parameter_name) } else if (PARAM_IS ("auto-input")) { - if (Config->get_use_hardware_monitoring() && transport_rolling()) { + if (Config->get_monitoring_model() == HardwareMonitoring && transport_rolling()) { /* auto-input only makes a difference if we're rolling */ boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader(); @@ -3015,6 +3015,25 @@ Session::config_changed (const char* parameter_name) session_midi_feedback = Config->get_midi_feedback(); } + } else if (PARAM_IS ("jack-time-master")) { + + engine().reset_timebase (); + + } else if (PARAM_IS ("native-file-header-format")) { + + if (!first_file_header_format_reset) { + reset_native_file_format (); + } + + first_file_header_format_reset = false; + + } else if (PARAM_IS ("native-file-data-format")) { + + if (!first_file_data_format_reset) { + reset_native_file_format (); + } + + first_file_data_format_reset = false; } set_dirty (); diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc index 635540bb00..1f2dc3215e 100644 --- a/libs/ardour/session_transport.cc +++ b/libs/ardour/session_transport.cc @@ -638,7 +638,7 @@ Session::locate (nframes_t target_frame, bool with_roll, bool with_flush, bool w if (with_roll) { /* switch from input if we're going to roll */ - if (Config->get_use_hardware_monitoring()) { + if (Config->get_monitoring_model() == HardwareMonitoring) { boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader(); @@ -651,7 +651,7 @@ Session::locate (nframes_t target_frame, bool with_roll, bool with_flush, bool w } } else { /* otherwise we're going to stop, so do the opposite */ - if (Config->get_use_hardware_monitoring()) { + if (Config->get_monitoring_model() == HardwareMonitoring) { boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader(); for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) { @@ -691,7 +691,7 @@ Session::set_transport_speed (float speed, bool abort) if (transport_rolling() && speed == 0.0) { - if (Config->get_use_hardware_monitoring()) + if (Config->get_monitoring_model() == HardwareMonitoring) { boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader(); @@ -715,7 +715,7 @@ Session::set_transport_speed (float speed, bool abort) return; } - if (Config->get_use_hardware_monitoring()) { + if (Config->get_monitoring_model() == HardwareMonitoring) { boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader(); diff --git a/libs/ardour/utils.cc b/libs/ardour/utils.cc index 574e7a6587..d8642486d9 100644 --- a/libs/ardour/utils.cc +++ b/libs/ardour/utils.cc @@ -298,6 +298,32 @@ compute_equal_power_fades (nframes_t nframes, float* in, float* out) } } +EditMode +string_to_edit_mode (string str) +{ + if (str == _("Splice Edit")) { + return Splice; + } else if (str == _("Slide Edit")) { + return Slide; + } + fatal << string_compose (_("programming error: unknown edit mode string \"%1\""), str) << endmsg; + /*NOTREACHED*/ + return Slide; +} + +const char* +edit_mode_to_string (EditMode mode) +{ + switch (mode) { + case Slide: + return _("Slide Edit"); + + default: + case Splice: + return _("Splice Edit"); + } +} + SlaveSource string_to_slave_source (string str) { @@ -334,3 +360,41 @@ slave_source_to_string (SlaveSource src) } } + +float +meter_falloff_to_float (MeterFalloff falloff) +{ + switch (falloff) { + case MeterFalloffOff: + return 0.0f; + case MeterFalloffSlowest: + return 1.0f; + case MeterFalloffSlow: + return 2.0f; + case MeterFalloffMedium: + return 3.0f; + case MeterFalloffFast: + return 4.0f; + case MeterFalloffFaster: + return 5.0f; + case MeterFalloffFastest: + default: + return 6.0f; + } +} + +float +meter_hold_to_float (MeterHold hold) +{ + switch (hold) { + case MeterHoldOff: + return 0.0f; + case MeterHoldShort: + return 40.0f; + case MeterHoldMedium: + return 100.0f; + case MeterHoldLong: + default: + return 200.0f; + } +} |