From 73fea853819ab3b48d2db41cd17a1d77d1ddbb52 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 21 Mar 2024 14:23:43 +0100 Subject: [PATCH] Vapor: set surround-send level range to +/-20 dB --- libs/ardour/ardour/types.h | 1 + libs/ardour/ardour/value_as_string.h | 2 +- libs/ardour/automatable.cc | 4 ++++ libs/ardour/automation_list.cc | 2 ++ libs/ardour/enums.cc | 1 + libs/ardour/event_type_map.cc | 4 ++++ libs/ardour/gain_control.cc | 4 ++++ libs/ardour/luabindings.cc | 1 + libs/ardour/parameter_descriptor.cc | 8 +++++++- libs/ardour/surround_send.cc | 4 ++-- libs/surfaces/mackie/strip.cc | 1 + libs/surfaces/maschine2/ui_knob.cc | 1 + libs/surfaces/push2/knob.cc | 1 + 13 files changed, 30 insertions(+), 4 deletions(-) diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h index efcc77f0cb..fd30127115 100644 --- a/libs/ardour/ardour/types.h +++ b/libs/ardour/ardour/types.h @@ -173,6 +173,7 @@ enum AutomationType { MonitoringAutomation, BusSendLevel, BusSendEnable, + SurroundSendLevel, InsertReturnLevel, MainOutVolume, MidiVelocityAutomation, diff --git a/libs/ardour/ardour/value_as_string.h b/libs/ardour/ardour/value_as_string.h index f8430f6231..daa430c4e6 100644 --- a/libs/ardour/ardour/value_as_string.h +++ b/libs/ardour/ardour/value_as_string.h @@ -53,7 +53,7 @@ value_as_string(const ARDOUR::ParameterDescriptor& desc, // Value is not a scale point, print it normally if (desc.unit == ARDOUR::ParameterDescriptor::MIDI_NOTE) { snprintf(buf, sizeof(buf), "%s", ParameterDescriptor::midi_note_name (rint(v)).c_str()); - } else if (desc.type == GainAutomation || desc.type == BusSendLevel || desc.type == TrimAutomation || desc.type == EnvelopeAutomation || desc.type == MainOutVolume || desc.type == InsertReturnLevel) { + } else if (desc.type == GainAutomation || desc.type == BusSendLevel || desc.type == TrimAutomation || desc.type == EnvelopeAutomation || desc.type == MainOutVolume || desc.type == SurroundSendLevel || desc.type == InsertReturnLevel) { #ifdef PLATFORM_WINDOWS if (v < GAIN_COEFF_SMALL) { snprintf(buf, sizeof(buf), "-inf dB"); diff --git a/libs/ardour/automatable.cc b/libs/ardour/automatable.cc index 83871d7baa..1788423fea 100644 --- a/libs/ardour/automatable.cc +++ b/libs/ardour/automatable.cc @@ -196,6 +196,8 @@ Automatable::describe_parameter (Evoral::Parameter param) return _("Fader"); } else if (param.type() == BusSendLevel) { return _("Send"); + } else if (param.type() == SurroundSendLevel) { + return _("Send"); } else if (param.type() == InsertReturnLevel) { return _("Return"); } else if (param.type() == TrimAutomation) { @@ -596,6 +598,8 @@ Automatable::control_factory(const Evoral::Parameter& param) control = new GainControl(_a_session, param); } else if (param.type() == BusSendLevel) { control = new GainControl(_a_session, param); + } else if (param.type() == SurroundSendLevel) { + control = new GainControl(_a_session, param); } else if (param.type() == PanSurroundX || param.type() == PanSurroundY || param.type() == PanSurroundZ || param.type() == PanSurroundSize || param.type() == PanSurroundSnap || param.type() == BinauralRenderMode) { assert (0); control = new SurroundControllable (_a_session, param.type(), *this); diff --git a/libs/ardour/automation_list.cc b/libs/ardour/automation_list.cc index 542d6fe02d..9c50835590 100644 --- a/libs/ardour/automation_list.cc +++ b/libs/ardour/automation_list.cc @@ -158,6 +158,7 @@ AutomationList::create_curve_if_necessary() switch (_parameter.type()) { case GainAutomation: case BusSendLevel: + case SurroundSendLevel: case InsertReturnLevel: case TrimAutomation: case PanAzimuthAutomation: @@ -234,6 +235,7 @@ AutomationList::default_interpolation () const switch (_parameter.type()) { case GainAutomation: case BusSendLevel: + case SurroundSendLevel: case InsertReturnLevel: case EnvelopeAutomation: return ControlList::Exponential; diff --git a/libs/ardour/enums.cc b/libs/ardour/enums.cc index 1ddc562f6a..9794687f0c 100644 --- a/libs/ardour/enums.cc +++ b/libs/ardour/enums.cc @@ -207,6 +207,7 @@ setup_enum_writer () REGISTER_ENUM (MonitoringAutomation); REGISTER_ENUM (BusSendLevel); REGISTER_ENUM (BusSendEnable); + REGISTER_ENUM (SurroundSendLevel); REGISTER_ENUM (InsertReturnLevel); REGISTER_ENUM (MainOutVolume); REGISTER_ENUM (MidiVelocityAutomation); diff --git a/libs/ardour/event_type_map.cc b/libs/ardour/event_type_map.cc index 5cc7916380..2b051acec6 100644 --- a/libs/ardour/event_type_map.cc +++ b/libs/ardour/event_type_map.cc @@ -132,6 +132,8 @@ EventTypeMap::from_symbol(const string& str) const p_type = GainAutomation; } else if (str == "send") { p_type = BusSendLevel; + } else if (str == "surround-send") { + p_type = SurroundSendLevel; } else if (str == "send-enable") { p_type = BusSendEnable; } else if (str == "return") { @@ -260,6 +262,8 @@ EventTypeMap::to_symbol(const Evoral::Parameter& param) const return "send"; } else if (t == BusSendEnable) { return "send-enable"; + } else if (t == SurroundSendLevel) { + return "surround-send"; } else if (t == InsertReturnLevel) { return "return"; } else if (t == TrimAutomation) { diff --git a/libs/ardour/gain_control.cc b/libs/ardour/gain_control.cc index e25353ddba..5c28eb4aa6 100644 --- a/libs/ardour/gain_control.cc +++ b/libs/ardour/gain_control.cc @@ -42,6 +42,8 @@ static std::string gain_control_name (Evoral::Parameter const& param) /* fallthrough */ case BusSendLevel: /* fallthrough */ + case SurroundSendLevel: + /* fallthrough */ case InsertReturnLevel: return X_("gaincontrol"); case TrimAutomation: @@ -64,6 +66,8 @@ static std::shared_ptr automation_list_new (Evoral::Parameter co /* fallthrough */ case BusSendLevel: /* fallthrough */ + case SurroundSendLevel: + /* fallthrough */ case InsertReturnLevel: /* fallthrough */ case TrimAutomation: diff --git a/libs/ardour/luabindings.cc b/libs/ardour/luabindings.cc index f3b8c4de22..4e9087ba17 100644 --- a/libs/ardour/luabindings.cc +++ b/libs/ardour/luabindings.cc @@ -2394,6 +2394,7 @@ LuaBindings::common (lua_State* L) .beginNamespace ("AutomationType") .addConst ("GainAutomation", ARDOUR::AutomationType(GainAutomation)) .addConst ("BusSendLevel", ARDOUR::AutomationType(BusSendLevel)) + .addConst ("SurroundSendLevel", ARDOUR::AutomationType(SurroundSendLevel)) .addConst ("InsertReturnLevel", ARDOUR::AutomationType(InsertReturnLevel)) .addConst ("PluginAutomation", ARDOUR::AutomationType(PluginAutomation)) .addConst ("SoloAutomation", ARDOUR::AutomationType(SoloAutomation)) diff --git a/libs/ardour/parameter_descriptor.cc b/libs/ardour/parameter_descriptor.cc index 4bdefbc725..d2622ee042 100644 --- a/libs/ardour/parameter_descriptor.cc +++ b/libs/ardour/parameter_descriptor.cc @@ -69,6 +69,8 @@ ParameterDescriptor::ParameterDescriptor(const Evoral::Parameter& parameter) normal = 1.f; toggled = true; break; + case SurroundSendLevel: + /* fallthrough */ case TrimAutomation: upper = 10; // +20dB lower = .1; // -20dB @@ -284,7 +286,7 @@ ParameterDescriptor::update_steps() if (unit == ParameterDescriptor::MIDI_NOTE) { step = smallstep = 1; // semitone largestep = 12; // octave - } else if (type == GainAutomation || type == TrimAutomation || type == BusSendLevel || type == MainOutVolume || type == InsertReturnLevel) { + } else if (type == GainAutomation || type == TrimAutomation || type == BusSendLevel || type == MainOutVolume || type == SurroundSendLevel || type == InsertReturnLevel) { /* dB_coeff_step gives a step normalized for [0, max_gain]. This is like "slider position", so we convert from "slider position" to gain to have the correct unit here. */ @@ -408,6 +410,8 @@ ParameterDescriptor::to_interface (float val, bool rotary) const case EnvelopeAutomation: val = gain_to_slider_position_with_max (val, upper); break; + case SurroundSendLevel: + /* fallthrough */ case TrimAutomation: /* fallthrough */ case MainOutVolume: @@ -469,6 +473,7 @@ ParameterDescriptor::from_interface (float val, bool rotary) const case InsertReturnLevel: val = slider_position_to_gain_with_max (val, upper); break; + case SurroundSendLevel: case TrimAutomation: { const float lower_db = accurate_coefficient_to_dB (lower); @@ -529,6 +534,7 @@ ParameterDescriptor::is_linear () const case GainAutomation: case EnvelopeAutomation: case BusSendLevel: + case SurroundSendLevel: case InsertReturnLevel: return false; default: diff --git a/libs/ardour/surround_send.cc b/libs/ardour/surround_send.cc index 0fa2a2ab88..675df6229f 100644 --- a/libs/ardour/surround_send.cc +++ b/libs/ardour/surround_send.cc @@ -46,8 +46,8 @@ SurroundSend::SurroundSend (Session& s, std::shared_ptr mm) _send_delay.reset (new DelayLine (_session, "Send-" + name ())); _thru_delay.reset (new DelayLine (_session, "Thru-" + name ())); - std::shared_ptr gl (new AutomationList (Evoral::Parameter (BusSendLevel), *this)); - _gain_control = std::shared_ptr (new GainControl (_session, Evoral::Parameter (BusSendLevel), gl)); + std::shared_ptr gl (new AutomationList (Evoral::Parameter (SurroundSendLevel), *this)); + _gain_control = std::shared_ptr (new GainControl (_session, Evoral::Parameter (SurroundSendLevel), gl)); _amp.reset (new Amp (_session, _("Surround"), _gain_control, false)); _amp->activate (); diff --git a/libs/surfaces/mackie/strip.cc b/libs/surfaces/mackie/strip.cc index 199d1d5dfe..4e294778d2 100644 --- a/libs/surfaces/mackie/strip.cc +++ b/libs/surfaces/mackie/strip.cc @@ -715,6 +715,7 @@ Strip::format_parameter_for_display( case GainAutomation: case BusSendLevel: case TrimAutomation: + case SurroundSendLevel: case InsertReturnLevel: // we can't use value_as_string() that'll suffix "dB" and also use "-inf" w/o space :( if (val == 0.0) { diff --git a/libs/surfaces/maschine2/ui_knob.cc b/libs/surfaces/maschine2/ui_knob.cc index 8853275aad..50dec14762 100644 --- a/libs/surfaces/maschine2/ui_knob.cc +++ b/libs/surfaces/maschine2/ui_knob.cc @@ -223,6 +223,7 @@ Maschine2Knob::controllable_changed () case ARDOUR::GainAutomation: case ARDOUR::BusSendLevel: + case ARDOUR::SurroundSendLevel: case ARDOUR::InsertReturnLevel: case ARDOUR::TrimAutomation: snprintf (buf, sizeof (buf), "%+4.1f dB", accurate_coefficient_to_dB (_controllable->get_value())); diff --git a/libs/surfaces/push2/knob.cc b/libs/surfaces/push2/knob.cc index 18ac5c7ab4..ecab3119e3 100644 --- a/libs/surfaces/push2/knob.cc +++ b/libs/surfaces/push2/knob.cc @@ -326,6 +326,7 @@ Push2Knob::controllable_changed () case ARDOUR::GainAutomation: case ARDOUR::BusSendLevel: + case ARDOUR::SurroundSendLevel: case ARDOUR::InsertReturnLevel: case ARDOUR::TrimAutomation: set_gain_text (_val);