Make BusSendLevel 1st class citizen (1/2)

Equivalent to Gain and Trim (gain-coefficient, not dB) and use
it for Sends.
This commit is contained in:
Robin Gareus 2019-12-14 15:04:08 +01:00
parent d2facbf9c1
commit d4e023e1cb
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
9 changed files with 15 additions and 22 deletions

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 == TrimAutomation || desc.type == EnvelopeAutomation) {
} else if (desc.type == GainAutomation || desc.type == BusSendLevel || desc.type == TrimAutomation || desc.type == EnvelopeAutomation) {
snprintf(buf, sizeof(buf), "%.1f dB", accurate_coefficient_to_dB (v));
} else if (desc.type == PanWidthAutomation) {
snprintf (buf, sizeof (buf), "%d%%", (int) floor (100.0 * v));

View File

@ -190,6 +190,8 @@ Automatable::describe_parameter (Evoral::Parameter param)
if (param == Evoral::Parameter(GainAutomation)) {
return _("Fader");
} else if (param.type() == BusSendLevel) {
return _("Send");
} else if (param.type() == TrimAutomation) {
return _("Trim");
} else if (param.type() == MuteAutomation) {
@ -542,6 +544,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() == BusSendLevel) {
control = new GainControl(_a_session, param);
} else if (param.type() == PanAzimuthAutomation || param.type() == PanWidthAutomation || param.type() == PanElevationAutomation) {
Pannable* pannable = dynamic_cast<Pannable*>(this);
if (pannable) {

View File

@ -153,6 +153,7 @@ AutomationList::create_curve_if_necessary()
{
switch (_parameter.type()) {
case GainAutomation:
case BusSendLevel:
case TrimAutomation:
case PanAzimuthAutomation:
case PanElevationAutomation:

View File

@ -135,6 +135,8 @@ EventTypeMap::from_symbol(const string& str) const
if (str == "gain") {
p_type = GainAutomation;
} else if (str == "send") {
p_type = BusSendLevel;
} else if (str == "trim") {
p_type = TrimAutomation;
} else if (str == "solo") {
@ -235,6 +237,8 @@ EventTypeMap::to_symbol(const Evoral::Parameter& param) const
if (t == GainAutomation) {
return "gain";
} else if (t == BusSendLevel) {
return "send";
} else if (t == TrimAutomation) {
return "trim";
} else if (t == PanAzimuthAutomation) {

View File

@ -38,7 +38,7 @@ using namespace std;
GainControl::GainControl (Session& session, const Evoral::Parameter &param, boost::shared_ptr<AutomationList> al)
: SlavableAutomationControl (session, param, ParameterDescriptor(param),
al ? al : boost::shared_ptr<AutomationList> (new AutomationList (param)),
param.type() == GainAutomation ? X_("gaincontrol") : X_("trimcontrol"),
(param.type() == GainAutomation || param.type() == BusSendLevel) ? X_("gaincontrol") : X_("trimcontrol"),
Controllable::GainLike)
{
}

View File

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

View File

@ -195,7 +195,7 @@ ParameterDescriptor::update_steps()
if (unit == ParameterDescriptor::MIDI_NOTE) {
step = smallstep = 1; // semitone
largestep = 12; // octave
} else if (type == GainAutomation || type == TrimAutomation) {
} else if (type == GainAutomation || type == TrimAutomation || type == BusSendLevel) {
/* 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. */

View File

@ -101,7 +101,7 @@ Send::Send (Session& s, boost::shared_ptr<Pannable> p, boost::shared_ptr<MuteMas
//boost_debug_shared_ptr_mark_interesting (this, "send");
boost::shared_ptr<AutomationList> gl (new AutomationList (Evoral::Parameter (GainAutomation)));
_gain_control = boost::shared_ptr<GainControl> (new GainControl (_session, Evoral::Parameter(GainAutomation), gl));
_gain_control = boost::shared_ptr<GainControl> (new GainControl (_session, Evoral::Parameter(BusSendLevel), gl));
add_control (_gain_control);
_amp.reset (new Amp (_session, _("Fader"), _gain_control, true));

View File

@ -885,6 +885,7 @@ Strip::do_parameter_display (ARDOUR::ParameterDescriptor const& desc, float val,
switch (desc.type) {
case GainAutomation:
case BusSendLevel:
case TrimAutomation:
// we can't use value_as_string() that'll suffix "dB" and also use "-inf" w/o space :(
if (val == 0.0) {
@ -897,24 +898,6 @@ Strip::do_parameter_display (ARDOUR::ParameterDescriptor const& desc, float val,
}
break;
case BusSendLevel:
if (Profile->get_mixbus()) { //Mixbus sends are already stored in dB
// TODO remove after merge - PluginAutomation w/print_fmt
snprintf (buf, sizeof (buf), "%2.1f", val);
pending_display[1] = buf;
screen_hold = true;
} else {
if (val == 0.0) {
pending_display[1] = " -inf ";
} else {
float dB = accurate_coefficient_to_dB (val);
snprintf (buf, sizeof (buf), "%6.1f", dB);
pending_display[1] = buf;
screen_hold = true;
}
}
break;
case PanAzimuthAutomation:
if (Profile->get_mixbus()) {
// XXX no _stripable check?