From ff9a55df97a140346a2565c5a5178538e78b24d5 Mon Sep 17 00:00:00 2001 From: Ben Loftis Date: Thu, 1 Aug 2024 11:03:06 -0500 Subject: [PATCH] add a preference for MMC FastWind which allows skipping to markers --- gtk2_ardour/rc_option_editor.cc | 11 ++++++++ libs/ardour/ardour/rc_configuration_vars.h | 1 + libs/ardour/ardour/types.h | 6 +++++ libs/ardour/ardour/types_convert.h | 1 + libs/ardour/enums.cc | 6 +++++ libs/ardour/session_midi.cc | 31 ++++++++++++++++++++-- 6 files changed, 54 insertions(+), 2 deletions(-) diff --git a/gtk2_ardour/rc_option_editor.cc b/gtk2_ardour/rc_option_editor.cc index 6fddc3a649..e360b4a137 100644 --- a/gtk2_ardour/rc_option_editor.cc +++ b/gtk2_ardour/rc_option_editor.cc @@ -3829,6 +3829,17 @@ These settings will only take effect after %1 is restarted.\n\ 0, 127, 1, 10 )); + ComboOption *mtc_op = new ComboOption ( + "mmc-fast-wind-op", + _("MMC Fast-wind behavior"), + sigc::mem_fun (*_rc_config, &RCConfiguration::get_mmc_fast_wind_op), + sigc::mem_fun (*_rc_config, &RCConfiguration::set_mmc_fast_wind_op) + ); + mtc_op->add (FastWindOff, _("Off (MMC fast-forward+rewind are ignored)")); + mtc_op->add (FastWindVarispeed, _("Varispeed")); + mtc_op->add (FastWindLocate, _("Marker Locate (MMC ffwd/rewd jumps to next/prior marker)")); + add_option (_("Transport/Chase"), mtc_op); + add_option (_("Transport/Chase"), new OptionEditorHeading (_("Transport Masters"))); add_option (_("Transport/Chase"), diff --git a/libs/ardour/ardour/rc_configuration_vars.h b/libs/ardour/ardour/rc_configuration_vars.h index 04722ff6af..06f35680fd 100644 --- a/libs/ardour/ardour/rc_configuration_vars.h +++ b/libs/ardour/ardour/rc_configuration_vars.h @@ -177,6 +177,7 @@ CONFIG_VARIABLE (float, shuttle_speed_factor, "shuttle-speed-factor", 1.0f) // u CONFIG_VARIABLE (float, shuttle_speed_threshold, "shuttle-speed-threshold", 5.0f) // used for MMC shuttle CONFIG_VARIABLE (ShuttleUnits, shuttle_units, "shuttle-units", Percentage) CONFIG_VARIABLE (float, shuttle_max_speed, "shuttle-max-speed", 8.0f) +CONFIG_VARIABLE (FastWindOp, mmc_fast_wind_op, "mmc-fast-wind-op", FastWindVarispeed) CONFIG_VARIABLE (bool, locate_while_waiting_for_sync, "locate-while-waiting-for-sync", false) CONFIG_VARIABLE (bool, disable_disarm_during_roll, "disable-disarm-during-roll", false) CONFIG_VARIABLE (AutoReturnTarget, auto_return_target_list, "auto-return-target-list", AutoReturnTarget(LastLocate|RangeSelectionStart|Loop|RegionSelectionStart)) diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h index fd30127115..1a617cffa8 100644 --- a/libs/ardour/ardour/types.h +++ b/libs/ardour/ardour/types.h @@ -505,6 +505,12 @@ enum MonitorChoice { MonitorCue = 0x3, }; +enum FastWindOp { + FastWindOff = 0, + FastWindVarispeed = 0x1, //rewind/ffwd commands will varispeed the transport (incl reverse playback) + FastWindLocate = 0x2, //rewind/ffwd commands will jump to next/prior marker +}; + enum MonitorState { MonitoringSilence = 0x0, MonitoringInput = 0x2, diff --git a/libs/ardour/ardour/types_convert.h b/libs/ardour/ardour/types_convert.h index 0aa39372b2..19b8484589 100644 --- a/libs/ardour/ardour/types_convert.h +++ b/libs/ardour/ardour/types_convert.h @@ -74,6 +74,7 @@ DEFINE_ENUM_CONVERT(ARDOUR::DiskIOPoint) DEFINE_ENUM_CONVERT(ARDOUR::NoteMode) DEFINE_ENUM_CONVERT(ARDOUR::ChannelMode) DEFINE_ENUM_CONVERT(ARDOUR::MonitorChoice) +DEFINE_ENUM_CONVERT(ARDOUR::FastWindOp) DEFINE_ENUM_CONVERT(ARDOUR::PluginType) DEFINE_ENUM_CONVERT(ARDOUR::AlignStyle) DEFINE_ENUM_CONVERT(ARDOUR::AlignChoice) diff --git a/libs/ardour/enums.cc b/libs/ardour/enums.cc index 2357c8d9b2..1eeb7e0970 100644 --- a/libs/ardour/enums.cc +++ b/libs/ardour/enums.cc @@ -86,6 +86,7 @@ setup_enum_writer () Placement _Placement; MonitorModel _MonitorModel; MonitorChoice _MonitorChoice; + FastWindOp _FastWindOp; MonitorState _MonitorState; PFLPosition _PFLPosition; AFLPosition _AFLPosition; @@ -380,6 +381,11 @@ setup_enum_writer () REGISTER_ENUM (DeltaOriginMarker); REGISTER (_ClockDeltaMode); + REGISTER_ENUM (FastWindOff); + REGISTER_ENUM (FastWindVarispeed); + REGISTER_ENUM (FastWindLocate); + REGISTER (_FastWindOp); + REGISTER_ENUM (DenormalNone); REGISTER_ENUM (DenormalFTZ); REGISTER_ENUM (DenormalDAZ); diff --git a/libs/ardour/session_midi.cc b/libs/ardour/session_midi.cc index 13a8635134..45eec32b67 100644 --- a/libs/ardour/session_midi.cc +++ b/libs/ardour/session_midi.cc @@ -259,7 +259,20 @@ void Session::mmc_rewind (MIDI::MachineControl &/*mmc*/) { if (Config->get_mmc_control ()) { - request_transport_speed(-Config->get_max_transport_speed()); + switch (Config->get_mmc_fast_wind_op ()) { + case (FastWindOff): + //nothing + break; + case (FastWindVarispeed): + request_transport_speed (-Config->get_max_transport_speed()); + break; + case (FastWindLocate): + timepos_t pos = locations()->first_mark_before (timepos_t (transport_sample()-1), false); + if (pos != timepos_t::max (Temporal::AudioTime)) { + request_locate (pos.samples()); + } + break; + } } } @@ -267,7 +280,21 @@ void Session::mmc_fast_forward (MIDI::MachineControl &/*mmc*/) { if (Config->get_mmc_control ()) { - request_transport_speed (Config->get_max_transport_speed()); + switch (Config->get_mmc_fast_wind_op ()) { + case (FastWindOff): + //nothing + break; + case (FastWindVarispeed): + request_transport_speed (Config->get_max_transport_speed()); + break; + case (FastWindLocate): + timepos_t pos = locations()->first_mark_after (timepos_t (transport_sample()+1), false); + if (pos != timepos_t::max (Temporal::AudioTime)) { + request_locate (pos.samples()); + } + + break; + } } }