ARDOUR::AudioEngine::instance()->Stopped.connect (port_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort8::engine_reset, this), this);
ARDOUR::Port::PortDrop.connect (port_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort8::engine_reset, this), this);
- StripableSelectionChanged.connect (selection_connection, MISSING_INVALIDATOR, boost::bind (&FaderPort8::gui_track_selection_changed, this), this);
+ StripableSelectionChanged.connect (selection_connection, MISSING_INVALIDATOR, boost::bind (&FaderPort8::notify_gui_track_selection_changed, this), this);
+ /* bind button events to call libardour actions */
setup_actions ();
+
_ctrls.FaderModeChanged.connect_same_thread (modechange_connections, boost::bind (&FaderPort8::notify_fader_mode_changed, this));
_ctrls.MixModeChanged.connect_same_thread (modechange_connections, boost::bind (&FaderPort8::assign_strips, this, true));
}
}
}
+/* ****************************************************************************
+ * Plugin selection and parameters
+ */
+
void
FaderPort8::assign_processor_ctrls ()
{
assert (id == 8);
}
+/* ****************************************************************************
+ * Aux Sends and Mixbus assigns
+ */
+
void
FaderPort8::assign_sends ()
{
assign_stripables (true);
}
-void
-FaderPort8::set_periodic_display_mode (FP8Strip::DisplayMode m)
-{
- for (uint8_t id = 0; id < 8; ++id) {
- _ctrls.strip(id).set_periodic_display_mode (m);
- }
-}
+/* ****************************************************************************
+ * Main stripable assignment (dispatch depending on mode)
+ */
void
FaderPort8::assign_strips (bool reset_bank)
case ModeTrack:
case ModePan:
assign_stripables ();
- gui_track_selection_changed (); // update selection, automation-state
+ notify_gui_track_selection_changed (); // update selection, automation-state
break;
case ModePlugins:
if (_proc_params.size() > 0) {
}
}
+/* ****************************************************************************
+ * some helper functions
+ */
+
+void
+FaderPort8::set_periodic_display_mode (FP8Strip::DisplayMode m)
+{
+ for (uint8_t id = 0; id < 8; ++id) {
+ _ctrls.strip(id).set_periodic_display_mode (m);
+ }
+}
void
FaderPort8::drop_ctrl_connections ()
_showing_well_known = 0;
}
+/* functor for FP8Strip's select button */
+void
+FaderPort8::select_strip (boost::weak_ptr<Stripable> ws)
+{
+ boost::shared_ptr<Stripable> s = ws.lock();
+ if (!s) {
+ return;
+ }
+#if 1 /* single exclusive selection by default, toggle via shift */
+ if (shift_mod ()) {
+ ToggleStripableSelection (s);
+ } else {
+ SetStripableSelection (s);
+ }
+#else
+ /* tri-state selection: This allows to set the "first selected"
+ * with a single click without clearing the selection.
+ * Single de/select via shift.
+ */
+ if (shift_mod ()) {
+ if (s->is_selected ()) {
+ RemoveStripableFromSelection (s);
+ } else {
+ SetStripableSelection (s);
+ }
+ return;
+ }
+ if (s->is_selected () && s != first_selected_stripable ()) {
+ set_first_selected_stripable (s);
+ notify_gui_track_selection_changed ();
+ } else {
+ ToggleStripableSelection (s);
+ }
+#endif
+}
+
+/* ****************************************************************************
+ * Assigned Stripable Callbacks
+ */
+
void
FaderPort8::notify_fader_mode_changed ()
{
notify_automation_mode_changed ();
}
-/* ****************************************************************************
- * Assigned Stripable Callbacks
- */
-
void
FaderPort8::notify_stripable_added_or_removed ()
{
assign_strips (false);
}
-/* functor for FP8Strip's select button */
-void
-FaderPort8::select_strip (boost::weak_ptr<Stripable> ws)
-{
- boost::shared_ptr<Stripable> s = ws.lock();
- if (!s) {
- return;
- }
-#if 1 /* single exclusive selection by default, toggle via shift */
- if (shift_mod ()) {
- ToggleStripableSelection (s);
- } else {
- SetStripableSelection (s);
- }
-#else
- /* tri-state selection: This allows to set the "first selected"
- * with a single click without clearing the selection.
- * Single de/select via shift.
- */
- if (shift_mod ()) {
- if (s->is_selected ()) {
- RemoveStripableFromSelection (s);
- } else {
- SetStripableSelection (s);
- }
- return;
- }
- if (s->is_selected () && s != first_selected_stripable ()) {
- set_first_selected_stripable (s);
- gui_track_selection_changed ();
- } else {
- ToggleStripableSelection (s);
- }
-#endif
-}
-
/* called from static PresentationInfo::Change */
void
FaderPort8::notify_pi_property_changed (const PropertyChange& what_changed)
}
void
-FaderPort8::gui_track_selection_changed (/*ARDOUR::StripableNotificationListPtr*/)
+FaderPort8::notify_gui_track_selection_changed (/*ARDOUR::StripableNotificationListPtr*/)
{
+ if (!_device_active) {
+ /* this can be called anytime from the static
+ * ControlProtocol::StripableSelectionChanged
+ */
+ return;
+ }
automation_state_connections.drop_connections();
switch (_ctrls.fader_mode ()) {
-/*
+/* FaderPort8 Button Interface
+ *
* Copyright (C) 2017 Robin Gareus <robin@gareus.org>
*
* This program is free software; you can redistribute it and/or
namespace ArdourSurface {
+/* virtual base-class and interface */
class FP8ButtonInterface
{
public:
static bool force_change; // used during init
};
+/* ****************************************************************************
+ * Implementations
+ */
+
class FP8DummyButton : public FP8ButtonInterface
{
public:
};
+/* common implementation */
class FP8ButtonBase : public FP8ButtonInterface
{
public:
bool _blinking;
};
+/* A basic LED or RGB button, not shift sensitive */
class FP8Button : public FP8ButtonBase
{
public:
bool _has_color;
};
+/* footswitch and encoder-press buttons */
class FP8ReadOnlyButton : public FP8Button
{
public:
sigc::connection _hold_connection;
};
+/* an auto-repeat button.
+ * press + hold emits continuous "press" events.
+ */
class FP8RepeatButton : public FP8Button
{
public:
sigc::connection _press_timeout_connection;
};
-
} /* namespace */
#endif /* _ardour_surfaces_fp8button_h_ */