Add dedicated InsertReturnLevel type

This is preparation for PortInsert Send and Return
level control.
This commit is contained in:
Robin Gareus 2022-10-11 02:38:47 +02:00
parent f3423b8a77
commit 2939ed3164
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
12 changed files with 28 additions and 2 deletions

View File

@ -170,6 +170,7 @@ enum AutomationType {
MonitoringAutomation,
BusSendLevel,
BusSendEnable,
InsertReturnLevel,
MainOutVolume,
/* used only by Controllable Descriptor to access send parameters */

View File

@ -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) {
} else if (desc.type == GainAutomation || desc.type == BusSendLevel || desc.type == TrimAutomation || desc.type == EnvelopeAutomation || desc.type == MainOutVolume || desc.type == InsertReturnLevel) {
#ifdef PLATFORM_WINDOWS
if (v < GAIN_COEFF_SMALL) {
snprintf(buf, sizeof(buf), "-inf dB");

View File

@ -193,6 +193,8 @@ Automatable::describe_parameter (Evoral::Parameter param)
return _("Fader");
} else if (param.type() == BusSendLevel) {
return _("Send");
} else if (param.type() == InsertReturnLevel) {
return _("Return");
} else if (param.type() == TrimAutomation) {
return _("Trim");
} else if (param.type() == MainOutVolume) {
@ -561,6 +563,8 @@ Automatable::control_factory(const Evoral::Parameter& param)
control = new GainControl(_a_session, param);
} else if (param.type() == TrimAutomation) {
control = new GainControl(_a_session, param);
} else if (param.type() == InsertReturnLevel) {
control = new GainControl(_a_session, param);
} else if (param.type() == MainOutVolume) {
control = new GainControl(_a_session, param);
} else if (param.type() == BusSendLevel) {

View File

@ -158,6 +158,7 @@ AutomationList::create_curve_if_necessary()
switch (_parameter.type()) {
case GainAutomation:
case BusSendLevel:
case InsertReturnLevel:
case TrimAutomation:
case PanAzimuthAutomation:
case PanElevationAutomation:
@ -232,6 +233,7 @@ AutomationList::default_interpolation () const
switch (_parameter.type()) {
case GainAutomation:
case BusSendLevel:
case InsertReturnLevel:
case EnvelopeAutomation:
return ControlList::Exponential;
break;

View File

@ -204,6 +204,7 @@ setup_enum_writer ()
REGISTER_ENUM (MonitoringAutomation);
REGISTER_ENUM (BusSendLevel);
REGISTER_ENUM (BusSendEnable);
REGISTER_ENUM (InsertReturnLevel);
REGISTER_ENUM (MainOutVolume);
REGISTER (_AutomationType);

View File

@ -131,6 +131,8 @@ EventTypeMap::from_symbol(const string& str) const
p_type = GainAutomation;
} else if (str == "send") {
p_type = BusSendLevel;
} else if (str == "return") {
p_type = InsertReturnLevel;
} else if (str == "trim") {
p_type = TrimAutomation;
} else if (str == "main-out-volume") {
@ -233,6 +235,8 @@ EventTypeMap::to_symbol(const Evoral::Parameter& param) const
return "gain";
} else if (t == BusSendLevel) {
return "send";
} else if (t == InsertReturnLevel) {
return "return";
} else if (t == TrimAutomation) {
return "trim";
} else if (t == MainOutVolume) {

View File

@ -41,6 +41,8 @@ static std::string gain_control_name (Evoral::Parameter const& param)
case GainAutomation:
/* fallthrough */
case BusSendLevel:
/* fallthrough */
case InsertReturnLevel:
return X_("gaincontrol");
case TrimAutomation:
return X_("trimcontrol");
@ -62,6 +64,8 @@ static boost::shared_ptr<AutomationList> automation_list_new (Evoral::Parameter
/* fallthrough */
case BusSendLevel:
/* fallthrough */
case InsertReturnLevel:
/* fallthrough */
case TrimAutomation:
return boost::shared_ptr<AutomationList> (new AutomationList (param, Temporal::AudioTime));
case MainOutVolume:

View File

@ -2270,6 +2270,7 @@ LuaBindings::common (lua_State* L)
.beginNamespace ("AutomationType")
.addConst ("GainAutomation", ARDOUR::AutomationType(GainAutomation))
.addConst ("BusSendLevel", ARDOUR::AutomationType(BusSendLevel))
.addConst ("InsertReturnLevel", ARDOUR::AutomationType(InsertReturnLevel))
.addConst ("PluginAutomation", ARDOUR::AutomationType(PluginAutomation))
.addConst ("SoloAutomation", ARDOUR::AutomationType(SoloAutomation))
.addConst ("SoloIsolateAutomation", ARDOUR::AutomationType(SoloIsolateAutomation))

View File

@ -56,6 +56,8 @@ ParameterDescriptor::ParameterDescriptor(const Evoral::Parameter& parameter)
switch((AutomationType)parameter.type()) {
case BusSendLevel:
/* fallthrough */
case InsertReturnLevel:
inline_ctrl = true;
/* fallthrough */
case GainAutomation:
@ -207,7 +209,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) {
} else if (type == GainAutomation || type == TrimAutomation || type == BusSendLevel || type == MainOutVolume || 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. */
@ -326,6 +328,8 @@ ParameterDescriptor::to_interface (float val, bool rotary) const
/* fallthrough */
case BusSendLevel:
/* fallthrough */
case InsertReturnLevel:
/* fallthrough */
case EnvelopeAutomation:
val = gain_to_slider_position_with_max (val, upper);
break;
@ -384,6 +388,7 @@ ParameterDescriptor::from_interface (float val, bool rotary) const
case GainAutomation:
case EnvelopeAutomation:
case BusSendLevel:
case InsertReturnLevel:
val = slider_position_to_gain_with_max (val, upper);
break;
case TrimAutomation:
@ -443,6 +448,7 @@ ParameterDescriptor::is_linear () const
case GainAutomation:
case EnvelopeAutomation:
case BusSendLevel:
case InsertReturnLevel:
return false;
default:
break;

View File

@ -715,6 +715,7 @@ Strip::format_parameter_for_display(
case GainAutomation:
case BusSendLevel:
case TrimAutomation:
case InsertReturnLevel:
// we can't use value_as_string() that'll suffix "dB" and also use "-inf" w/o space :(
if (val == 0.0) {
formatted_parameter_display = " -inf ";

View File

@ -223,6 +223,7 @@ Maschine2Knob::controllable_changed ()
case ARDOUR::GainAutomation:
case ARDOUR::BusSendLevel:
case ARDOUR::InsertReturnLevel:
case ARDOUR::TrimAutomation:
snprintf (buf, sizeof (buf), "%+4.1f dB", accurate_coefficient_to_dB (_controllable->get_value()));
text->set (buf);

View File

@ -326,6 +326,7 @@ Push2Knob::controllable_changed ()
case ARDOUR::GainAutomation:
case ARDOUR::BusSendLevel:
case ARDOUR::InsertReturnLevel:
case ARDOUR::TrimAutomation:
set_gain_text (_val);
break;