BindMethod (BtnBypass, button_bypass);
- BindAction (BtnBypassAll, "Mixer", "ab-plugins"); // XXX
+ BindAction (BtnBypassAll, "Mixer", "ab-plugins");
- BindAction (BtnMacro, "Mixer", "show-editor");
- BindAction (BtnLink, "Window", "show-mixer");
+ BindAction (BtnMacro, "Common", "toggle-editor-and-mixer");
+ BindMethod (BtnOpen, button_open);
- BindAction (BtnOpen, "Common", "addExistingAudioFiles");
- BindAction (BtnLock, "Editor", "lock");
+ BindMethod (BtnLink, button_link);
+ BindMethod (BtnLock, button_lock);
// user-specific
for (FP8Controls::UserButtonMap::const_iterator i = _ctrls.user_buttons ().begin ();
}
}
+void
+FaderPort8::button_open ()
+{
+ boost::shared_ptr<PluginInsert> pi = _plugin_insert.lock();
+ if (pi) {
+ pi->ToggleUI (); /* EMIT SIGNAL */
+ } else {
+ AccessAction ("Common", "addExistingAudioFiles");
+ }
+}
+void
+FaderPort8::button_lock ()
+{
+ if (!_link_enabled) {
+ AccessAction ("Editor", "lock");
+ return;
+ }
+ if (_link_locked) {
+ unlock_link ();
+ } else if (!_link_control.expired ()) {
+ lock_link ();
+ }
+}
+
+void
+FaderPort8::button_link ()
+{
+ switch (_ctrls.fader_mode()) {
+ case ModeTrack:
+ case ModePan:
+ if (_link_enabled) {
+ stop_link ();
+ } else {
+ start_link ();
+ }
+ break;
+ default:
+ //AccessAction ("Window", "show-mixer");
+ break;
+ }
+}
+
void
FaderPort8::button_automation (ARDOUR::AutoState as)
{
break;
}
+ // TODO link/lock control automation?
+
// apply to all selected tracks
StripableList all;
session->get_stripables (all);
FaderPort8::button_solo_clear ()
{
bool soloing = session->soloing() || session->listening();
+#ifdef MIXBUS
+ soloing |= session->mixbus_soloed();
+#endif
if (soloing) {
StripableList all;
session->get_stripables (all);
if ((*i)->is_master() || (*i)->is_auditioner() || (*i)->is_monitor()) {
continue;
}
- boost::shared_ptr<AutomationControl> ac = (*i)->solo_control();
- if (ac && ac->get_value () > 0) {
- _solo_state.push_back (boost::weak_ptr<AutomationControl>(ac));
+ boost::shared_ptr<SoloControl> sc = (*i)->solo_control();
+ if (sc && sc->self_soloed ()) {
+ _solo_state.push_back (boost::weak_ptr<AutomationControl>(sc));
}
}
AccessAction ("Main", "cancel-solo");
if (!ac) {
continue;
}
- if (ac->automation_state() == Touch && !ac->touching ()) {
- ac->start_touch (ac->session().transport_frame());
- }
+ ac->start_touch (ac->session().transport_frame());
cl->push_back (ac);
}
if (!cl->empty()) {
continue;
}
cl->push_back (ac);
- if (ac->automation_state() == Touch && !ac->touching ()) {
- ac->start_touch (ac->session().transport_frame());
- }
+ ac->start_touch (ac->session().transport_frame());
}
if (!cl->empty()) {
session->set_controls (cl, 1.0, PBD::Controllable::NoGroup);
AccessAction (group, item);
}
+/* ****************************************************************************
+ * Control Interaction (encoder)
+ */
+
+void
+FaderPort8::handle_encoder_pan (int steps)
+{
+ boost::shared_ptr<Stripable> s = first_selected_stripable();
+ if (s) {
+ boost::shared_ptr<AutomationControl> ac;
+ if (shift_mod () || _ctrls.fader_mode() == ModePan) {
+ ac = s->pan_width_control ();
+ } else {
+ ac = s->pan_azimuth_control ();
+ }
+ if (ac) {
+ ac->start_touch (ac->session().transport_frame());
+ if (steps == 0) {
+ ac->set_value (ac->normal(), PBD::Controllable::UseGroup);
+ } else {
+ double v = ac->internal_to_interface (ac->get_value());
+ v = std::max (0.0, std::min (1.0, v + steps * .01));
+ ac->set_value (ac->interface_to_internal(v), PBD::Controllable::UseGroup);
+ }
+ }
+ }
+}
+
+void
+FaderPort8::handle_encoder_link (int steps)
+{
+ if (_link_control.expired ()) {
+ return;
+ }
+ boost::shared_ptr<AutomationControl> ac = boost::dynamic_pointer_cast<AutomationControl> (_link_control.lock ());
+ if (!ac) {
+ return;
+ }
+
+ double v = ac->internal_to_interface (ac->get_value());
+ ac->start_touch (ac->session().transport_frame());
+
+ if (steps == 0) {
+ ac->set_value (ac->normal(), PBD::Controllable::UseGroup);
+ return;
+ }
+
+ if (ac->desc().toggled) {
+ v = v > 0 ? 0. : 1.;
+ } else if (ac->desc().integer_step) {
+ v += steps / (1.f + ac->desc().upper - ac->desc().lower);
+ } else if (ac->desc().enumeration) {
+ ac->set_value (ac->desc().step_enum (ac->get_value(), steps < 0), PBD::Controllable::UseGroup);
+ return;
+ } else {
+ v = std::max (0.0, std::min (1.0, v + steps * .01));
+ }
+ ac->set_value (ac->interface_to_internal(v), PBD::Controllable::UseGroup);
+}
+
+
/* ****************************************************************************
* Mode specific and internal callbacks
*/
ac = session->master_out()->gain_control ();
}
if (ac) {
- if (ac->automation_state() == Touch && !ac->touching ()) {
- ac->start_touch (ac->session().transport_frame());
- }
+ ac->start_touch (ac->session().transport_frame());
ac->set_value (ac->normal(), PBD::Controllable::NoGroup);
}
}
if (ac) {
double v = ac->internal_to_interface (ac->get_value());
v = std::max (0.0, std::min (1.0, v + steps * (neg ? -.01 : .01)));
- if (ac->automation_state() == Touch && !ac->touching ()) {
- ac->start_touch (ac->session().transport_frame());
- }
+ ac->start_touch (ac->session().transport_frame());
ac->set_value (ac->interface_to_internal(v), PBD::Controllable::NoGroup);
}
}
switch (_ctrls.fader_mode()) {
case ModeTrack:
case ModePan:
- {
- boost::shared_ptr<Stripable> s = first_selected_stripable();
- if (s) {
- boost::shared_ptr<AutomationControl> ac;
- if (shift_mod () || _ctrls.fader_mode() == ModePan) {
- ac = s->pan_width_control ();
- } else {
- ac = s->pan_azimuth_control ();
- }
- if (ac) {
- if (ac->automation_state() == Touch && !ac->touching ()) {
- ac->start_touch (ac->session().transport_frame());
- }
- ac->set_value (ac->normal(), PBD::Controllable::UseGroup);
- }
- }
+ if (_link_enabled || _link_locked) {
+ handle_encoder_link (0);
+ } else {
+ handle_encoder_pan (0);
}
break;
case ModePlugins:
+ toggle_preset_param_mode ();
break;
case ModeSend:
break;
switch (_ctrls.fader_mode()) {
case ModeTrack:
case ModePan:
- {
- boost::shared_ptr<Stripable> s = first_selected_stripable();
- if (s) {
- boost::shared_ptr<AutomationControl> ac;
- if (shift_mod () || _ctrls.fader_mode() == ModePan) {
- ac = s->pan_width_control ();
- } else {
- ac = s->pan_azimuth_control ();
- }
- if (ac) {
- double v = ac->internal_to_interface (ac->get_value());
- v = std::max (0.0, std::min (1.0, v + steps * (neg ? -.01 : .01)));
- if (ac->automation_state() == Touch && !ac->touching ()) {
- ac->start_touch (ac->session().transport_frame());
- }
- ac->set_value (ac->interface_to_internal(v), PBD::Controllable::UseGroup);
- }
+ if (steps != 0) {
+ if (_link_enabled || _link_locked) {
+ handle_encoder_link (neg ? -steps : steps);
+ } else {
+ handle_encoder_pan (neg ? -steps : steps);
}
}
break;
case ModePlugins:
case ModeSend:
while (steps > 0) {
- bank_param (neg, false);
+ bank_param (neg, shift_mod());
--steps;
}
break;