13
0

Fix fader in mackie control to work with groups.

This commit is contained in:
Len Ovens 2015-11-14 10:39:53 -08:00
parent 456b6adf2b
commit fb96170178
3 changed files with 53 additions and 14 deletions

View File

@ -423,6 +423,15 @@ class LIBARDOUR_API Route : public SessionObject, public Automatable, public Rou
uint32_t _current_phase;
};
class LIBARDOUR_API GroupGainControllable : public AutomationControl {
public:
GroupGainControllable (std::string name, boost::shared_ptr<Route>);
void set_value (double);
// We get the value from the amp where we get the changed signal from
//double get_value () const;
private:
boost::weak_ptr<Route> _route;
};
boost::shared_ptr<SoloControllable> solo_control() const {
return _solo_control;
@ -440,6 +449,10 @@ class LIBARDOUR_API Route : public SessionObject, public Automatable, public Rou
return _phase_control;
}
boost::shared_ptr<GroupGainControllable> group_gain_control() const {
return _group_gain_control;
}
/* Route doesn't own these items, but sub-objects that it does own have them
and to make UI code a bit simpler, we provide direct access to them
here.
@ -579,6 +592,7 @@ class LIBARDOUR_API Route : public SessionObject, public Automatable, public Rou
boost::shared_ptr<MuteControllable> _mute_control;
boost::shared_ptr<MuteMaster> _mute_master;
boost::shared_ptr<PhaseControllable> _phase_control;
boost::shared_ptr<GroupGainControllable> _group_gain_control;
virtual void act_on_mute () {}

View File

@ -136,14 +136,17 @@ Route::init ()
_solo_control.reset (new SoloControllable (X_("solo"), shared_from_this ()));
_mute_control.reset (new MuteControllable (X_("mute"), shared_from_this ()));
_phase_control.reset (new PhaseControllable (X_("phase"), shared_from_this ()));
_group_gain_control.reset (new GroupGainControllable (X_("groupgain"), shared_from_this ()));
_solo_control->set_flags (Controllable::Flag (_solo_control->flags() | Controllable::Toggle));
_mute_control->set_flags (Controllable::Flag (_mute_control->flags() | Controllable::Toggle));
_phase_control->set_flags (Controllable::Flag (_phase_control->flags() | Controllable::Toggle));
_group_gain_control->set_flags (Controllable::Flag (_group_gain_control->flags() | Controllable::GainLike));
add_control (_solo_control);
add_control (_mute_control);
add_control (_phase_control);
add_control (_group_gain_control);
/* panning */
@ -3973,12 +3976,34 @@ Route::MuteControllable::get_value () const
return (r && r->muted()) ? GAIN_COEFF_UNITY : GAIN_COEFF_ZERO;
}
Route::GroupGainControllable::GroupGainControllable (std::string name, boost::shared_ptr<Route> r)
: AutomationControl (r->session(),
Evoral::Parameter (GainAutomation),
ParameterDescriptor (Evoral::Parameter (GainAutomation)),
boost::shared_ptr<AutomationList>(),
name)
, _route (r)
{
boost::shared_ptr<AutomationList> gl(new AutomationList(Evoral::Parameter(GainAutomation)));
gl->set_interpolation(Evoral::ControlList::Discrete);
set_list (gl);
}
void
Route::GroupGainControllable::set_value (double val)
{
boost::shared_ptr<Route> r = _route.lock ();
// I am not sure why I need the * .5 to make this work
float normalized_position = r->gain_control()->interface_to_internal (val * 0.5);
r->set_gain ((gain_t)normalized_position, this);
}
Route::PhaseControllable::PhaseControllable (std::string name, boost::shared_ptr<Route> r)
: AutomationControl (r->session(),
Evoral::Parameter (PhaseAutomation),
ParameterDescriptor (Evoral::Parameter (PhaseAutomation)),
boost::shared_ptr<AutomationList>(),
name)
Evoral::Parameter (PhaseAutomation),
ParameterDescriptor (Evoral::Parameter (PhaseAutomation)),
boost::shared_ptr<AutomationList>(),
name)
, _route (r)
{
boost::shared_ptr<AutomationList> gl(new AutomationList(Evoral::Parameter(PhaseAutomation)));

View File

@ -1305,7 +1305,7 @@ Strip::set_vpot_parameter (Evoral::Parameter p)
pannable = _route->pannable ();
if (_surface->mcp().flip_mode() != MackieControlProtocol::Normal) {
/* gain to vpot, pan azi to fader */
_vpot->set_control (_route->gain_control());
_vpot->set_control (_route->group_gain_control());
control_by_parameter[GainAutomation] = _vpot;
if (pannable) {
_fader->set_control (pannable->pan_azimuth_control);
@ -1316,7 +1316,7 @@ Strip::set_vpot_parameter (Evoral::Parameter p)
}
} else {
/* gain to fader, pan azi to vpot */
_fader->set_control (_route->gain_control());
_fader->set_control (_route->group_gain_control());
control_by_parameter[GainAutomation] = _fader;
if (pannable) {
_vpot->set_control (pannable->pan_azimuth_control);
@ -1332,7 +1332,7 @@ Strip::set_vpot_parameter (Evoral::Parameter p)
pannable = _route->pannable ();
if (_surface->mcp().flip_mode() != MackieControlProtocol::Normal) {
/* gain to vpot, pan width to fader */
_vpot->set_control (_route->gain_control());
_vpot->set_control (_route->group_gain_control());
control_by_parameter[GainAutomation] = _vpot;
if (pannable) {
_fader->set_control (pannable->pan_width_control);
@ -1343,7 +1343,7 @@ Strip::set_vpot_parameter (Evoral::Parameter p)
}
} else {
/* gain to fader, pan width to vpot */
_fader->set_control (_route->gain_control());
_fader->set_control (_route->group_gain_control());
control_by_parameter[GainAutomation] = _fader;
if (pannable) {
_vpot->set_control (pannable->pan_width_control);
@ -1364,7 +1364,7 @@ Strip::set_vpot_parameter (Evoral::Parameter p)
_trim_mode = TrimAutomation;
if (_surface->mcp().flip_mode() != MackieControlProtocol::Normal) {
/* gain to vpot, trim to fader */
_vpot->set_control (_route->gain_control());
_vpot->set_control (_route->group_gain_control());
control_by_parameter[GainAutomation] = _vpot;
if (_route->trim() && route()->trim()->active()) {
_fader->set_control (_route->trim_control());
@ -1375,7 +1375,7 @@ Strip::set_vpot_parameter (Evoral::Parameter p)
}
} else {
/* gain to fader, trim to vpot */
_fader->set_control (_route->gain_control());
_fader->set_control (_route->group_gain_control());
control_by_parameter[GainAutomation] = _fader;
if (_route->trim() && route()->trim()->active()) {
_vpot->set_control (_route->trim_control());
@ -1390,7 +1390,7 @@ Strip::set_vpot_parameter (Evoral::Parameter p)
_trim_mode = PhaseAutomation;
if (_surface->mcp().flip_mode() != MackieControlProtocol::Normal) {
/* gain to vpot, phase to fader */
_vpot->set_control (_route->gain_control());
_vpot->set_control (_route->group_gain_control());
control_by_parameter[GainAutomation] = _vpot;
if (_route->phase_invert().size()) {
_fader->set_control (_route->phase_control());
@ -1401,7 +1401,7 @@ Strip::set_vpot_parameter (Evoral::Parameter p)
}
} else {
/* gain to fader, phase to vpot */
_fader->set_control (_route->gain_control());
_fader->set_control (_route->group_gain_control());
control_by_parameter[GainAutomation] = _fader;
if (_route->phase_invert().size()) {
_vpot->set_control (_route->phase_control());
@ -1415,7 +1415,7 @@ Strip::set_vpot_parameter (Evoral::Parameter p)
case SendAutomation:
if (_surface->mcp().flip_mode() != MackieControlProtocol::Normal) {
// gain to vpot, send to fader
_vpot->set_control (_route->gain_control());
_vpot->set_control (_route->group_gain_control());
control_by_parameter[GainAutomation] = _vpot;
// test for send to control
boost::shared_ptr<Processor> p = _route->nth_send (_current_send);
@ -1433,7 +1433,7 @@ Strip::set_vpot_parameter (Evoral::Parameter p)
}
} else {
// gain to fader, send to vpot
_fader->set_control (_route->gain_control());
_fader->set_control (_route->group_gain_control());
control_by_parameter[GainAutomation] = _fader;
boost::shared_ptr<Processor> p = _route->nth_send (_current_send);
if (p && p->name() != "Monitor 1") {