From ec365820d80cd5afaf74197ad3ac93dd2bc91cc4 Mon Sep 17 00:00:00 2001 From: Ben Loftis Date: Wed, 23 Aug 2023 06:27:21 -0500 Subject: [PATCH] MCU/UF8: reuse and special-case Mackie ctrl surface for SSL-UF8 This adds a unique namespace to the MCU source code, so it can be compiled multiple times resulting in different ctrl surfaces. --- libs/surfaces/mackie/button.cc | 2 +- libs/surfaces/mackie/button.h | 4 +- libs/surfaces/mackie/control_group.h | 6 +- libs/surfaces/mackie/controls.cc | 4 +- libs/surfaces/mackie/controls.h | 6 +- libs/surfaces/mackie/device_info.cc | 15 +- libs/surfaces/mackie/device_info.h | 7 +- libs/surfaces/mackie/device_profile.cc | 2 +- libs/surfaces/mackie/device_profile.h | 4 +- libs/surfaces/mackie/fader.cc | 4 +- libs/surfaces/mackie/fader.h | 4 +- libs/surfaces/mackie/gui.cc | 35 +- libs/surfaces/mackie/gui.h | 27 +- libs/surfaces/mackie/interface.cc | 2 +- libs/surfaces/mackie/jog.cc | 2 +- libs/surfaces/mackie/jog.h | 3 +- libs/surfaces/mackie/jog_wheel.cc | 2 +- libs/surfaces/mackie/jog_wheel.h | 5 +- libs/surfaces/mackie/led.cc | 2 +- libs/surfaces/mackie/led.h | 4 +- .../mackie/mackie_control_exception.h | 5 +- .../mackie/mackie_control_protocol.cc | 23 +- .../surfaces/mackie/mackie_control_protocol.h | 393 +++++++++--------- .../mackie/mackie_control_protocol_poll.cc | 45 -- libs/surfaces/mackie/mcp_buttons.cc | 194 ++++----- libs/surfaces/mackie/meter.cc | 2 +- libs/surfaces/mackie/meter.h | 4 +- libs/surfaces/mackie/pot.cc | 2 +- libs/surfaces/mackie/pot.h | 4 +- libs/surfaces/mackie/strip.cc | 4 +- libs/surfaces/mackie/strip.h | 4 +- libs/surfaces/mackie/subview.cc | 2 +- libs/surfaces/mackie/subview.h | 5 +- libs/surfaces/mackie/surface.cc | 4 +- libs/surfaces/mackie/surface.h | 37 +- libs/surfaces/mackie/surface_port.cc | 4 +- libs/surfaces/mackie/surface_port.h | 13 +- libs/surfaces/mackie/timer.h | 11 +- libs/surfaces/mackie/types.cc | 6 +- libs/surfaces/mackie/types.h | 9 +- libs/surfaces/mackie/uf8_interface.cc | 84 ++++ libs/surfaces/mackie/wscript | 59 ++- 42 files changed, 557 insertions(+), 497 deletions(-) delete mode 100644 libs/surfaces/mackie/mackie_control_protocol_poll.cc create mode 100644 libs/surfaces/mackie/uf8_interface.cc diff --git a/libs/surfaces/mackie/button.cc b/libs/surfaces/mackie/button.cc index d07caac7f8..e8ab68ccf8 100644 --- a/libs/surfaces/mackie/button.cc +++ b/libs/surfaces/mackie/button.cc @@ -26,7 +26,7 @@ #include "control_group.h" using namespace ArdourSurface; -using namespace Mackie; +using namespace ArdourSurface::MACKIE_NAMESPACE; Control* Button::factory (Surface& surface, Button::ID bid, int id, const std::string& name, Group& group) diff --git a/libs/surfaces/mackie/button.h b/libs/surfaces/mackie/button.h index ca6d1b6d85..f4031584f0 100644 --- a/libs/surfaces/mackie/button.h +++ b/libs/surfaces/mackie/button.h @@ -26,9 +26,7 @@ #include "controls.h" #include "led.h" -namespace ArdourSurface { - -namespace Mackie { +namespace ArdourSurface { namespace MACKIE_NAMESPACE { class Surface; diff --git a/libs/surfaces/mackie/control_group.h b/libs/surfaces/mackie/control_group.h index e8eada6522..42c8a7b764 100644 --- a/libs/surfaces/mackie/control_group.h +++ b/libs/surfaces/mackie/control_group.h @@ -20,10 +20,12 @@ #ifndef __ardour_mackie_control_protocol_control_group_h__ #define __ardour_mackie_control_protocol_control_group_h__ +#include #include -namespace ArdourSurface { -namespace Mackie { +#include "types.h" + +namespace ArdourSurface { namespace MACKIE_NAMESPACE { class Control; diff --git a/libs/surfaces/mackie/controls.cc b/libs/surfaces/mackie/controls.cc index f2a1ed07f2..7a1b068812 100644 --- a/libs/surfaces/mackie/controls.cc +++ b/libs/surfaces/mackie/controls.cc @@ -38,7 +38,7 @@ using namespace std; using namespace ArdourSurface; -using namespace Mackie; +using namespace ArdourSurface::MACKIE_NAMESPACE; using ARDOUR::AutomationControl; @@ -112,7 +112,7 @@ Control::stop_touch (Temporal::timepos_t const & when) } } -ostream & operator << (ostream & os, const ArdourSurface::Mackie::Control & control) +ostream & operator << (ostream & os, const ArdourSurface::MACKIE_NAMESPACE::Control & control) { os << typeid (control).name(); os << " { "; diff --git a/libs/surfaces/mackie/controls.h b/libs/surfaces/mackie/controls.h index c7fa7a4a12..a0f4eaf36c 100644 --- a/libs/surfaces/mackie/controls.h +++ b/libs/surfaces/mackie/controls.h @@ -41,9 +41,7 @@ namespace ARDOUR { class AutomationControl; } -namespace ArdourSurface { - -namespace Mackie { +namespace ArdourSurface { namespace MACKIE_NAMESPACE { class Strip; class Group; @@ -93,6 +91,6 @@ public: } } -std::ostream & operator << (std::ostream & os, const ArdourSurface::Mackie::Control & control); +std::ostream & operator << (std::ostream & os, const ArdourSurface::MACKIE_NAMESPACE::Control & control); #endif /* __mackie_controls_h__ */ diff --git a/libs/surfaces/mackie/device_info.cc b/libs/surfaces/mackie/device_info.cc index df00b11f89..8f9228ef13 100644 --- a/libs/surfaces/mackie/device_info.cc +++ b/libs/surfaces/mackie/device_info.cc @@ -39,7 +39,7 @@ using namespace PBD; using namespace ARDOUR; using namespace ArdourSurface; -using namespace Mackie; +using namespace ArdourSurface::MACKIE_NAMESPACE; using std::string; using std::vector; @@ -69,7 +69,11 @@ DeviceInfo::DeviceInfo() , _has_separate_meters (false) , _single_fader_follows_selection (false) , _device_type (MCU) +#ifdef UF8 + , _name (X_("UF8/UF1")) +#else , _name (X_("Mackie Control Universal Pro")) +#endif { mackie_control_buttons (); } @@ -576,8 +580,15 @@ devinfo_search_path () static bool devinfo_filter (const string &str, void* /*arg*/) { +#ifdef UF8 + return (str.length() > strlen(devinfo_suffix) && + str.find ("uf8") != string::npos && + str.find (devinfo_suffix) == (str.length() - strlen (devinfo_suffix)) + ); +#else return (str.length() > strlen(devinfo_suffix) && str.find (devinfo_suffix) == (str.length() - strlen (devinfo_suffix))); +#endif } void @@ -617,7 +628,7 @@ DeviceInfo::reload_device_info () } } -std::ostream& operator<< (std::ostream& os, const Mackie::DeviceInfo& di) +std::ostream& operator<< (std::ostream& os, const MACKIE_NAMESPACE::DeviceInfo& di) { os << di.name() << ' ' << di.strip_cnt() << ' ' diff --git a/libs/surfaces/mackie/device_info.h b/libs/surfaces/mackie/device_info.h index 93abe73f7b..e4af50b445 100644 --- a/libs/surfaces/mackie/device_info.h +++ b/libs/surfaces/mackie/device_info.h @@ -26,12 +26,11 @@ #include #include "button.h" +#include "types.h" class XMLNode; -namespace ArdourSurface { - -namespace Mackie { +namespace ArdourSurface { namespace MACKIE_NAMESPACE { struct GlobalButtonInfo { std::string label; // visible to user @@ -141,6 +140,6 @@ class DeviceInfo } // Mackie namespace } // ArdourSurface namespace -std::ostream& operator<< (std::ostream& os, const ArdourSurface::Mackie::DeviceInfo& di); +std::ostream& operator<< (std::ostream& os, const ArdourSurface::MACKIE_NAMESPACE::DeviceInfo& di); #endif /* __ardour_mackie_control_protocol_device_info_h__ */ diff --git a/libs/surfaces/mackie/device_profile.cc b/libs/surfaces/mackie/device_profile.cc index 718b21a32e..7ef6c8e364 100644 --- a/libs/surfaces/mackie/device_profile.cc +++ b/libs/surfaces/mackie/device_profile.cc @@ -40,7 +40,7 @@ using namespace PBD; using namespace ARDOUR; using namespace ArdourSurface; -using namespace Mackie; +using namespace ArdourSurface::MACKIE_NAMESPACE; using std::string; using std::vector; diff --git a/libs/surfaces/mackie/device_profile.h b/libs/surfaces/mackie/device_profile.h index 8151f4377f..9d9faa0ba9 100644 --- a/libs/surfaces/mackie/device_profile.h +++ b/libs/surfaces/mackie/device_profile.h @@ -29,9 +29,7 @@ class XMLNode; -namespace ArdourSurface { - -namespace Mackie { +namespace ArdourSurface { namespace MACKIE_NAMESPACE { class DeviceProfile { diff --git a/libs/surfaces/mackie/fader.cc b/libs/surfaces/mackie/fader.cc index 1d1253144e..0855d793dc 100644 --- a/libs/surfaces/mackie/fader.cc +++ b/libs/surfaces/mackie/fader.cc @@ -28,9 +28,9 @@ #include "control_group.h" #include "mackie_control_protocol.h" -using namespace ArdourSurface; -using namespace Mackie; using namespace PBD; +using namespace ArdourSurface; +using namespace ArdourSurface::MACKIE_NAMESPACE; Control* Fader::factory (Surface& surface, int id, const char* name, Group& group) diff --git a/libs/surfaces/mackie/fader.h b/libs/surfaces/mackie/fader.h index 5c25dfd95f..b673ae5030 100644 --- a/libs/surfaces/mackie/fader.h +++ b/libs/surfaces/mackie/fader.h @@ -22,9 +22,7 @@ #include "controls.h" -namespace ArdourSurface { - -namespace Mackie { +namespace ArdourSurface { namespace MACKIE_NAMESPACE { class Fader : public Control { diff --git a/libs/surfaces/mackie/gui.cc b/libs/surfaces/mackie/gui.cc index 3fc6f59abd..2c0dadafbc 100644 --- a/libs/surfaces/mackie/gui.cc +++ b/libs/surfaces/mackie/gui.cc @@ -35,6 +35,7 @@ #include "pbd/error.h" #include "pbd/unwind.h" #include "pbd/strsplit.h" +#include "pbd/file_utils.h" #include "gtkmm2ext/actions.h" #include "gtkmm2ext/action_model.h" @@ -43,6 +44,7 @@ #include "gtkmm2ext/utils.h" #include "ardour/audioengine.h" +#include "ardour/filesystem_paths.h" #include "ardour/port.h" #include "ardour/rc_configuration.h" @@ -57,7 +59,7 @@ using namespace std; using namespace Gtk; using namespace ArdourSurface; -using namespace Mackie; +using namespace ArdourSurface::MACKIE_NAMESPACE; void* MackieControlProtocol::get_gui () const @@ -103,7 +105,9 @@ MackieControlProtocolGUI::MackieControlProtocolGUI (MackieControlProtocol& p) , ignore_active_change (false) { Gtk::Label* l; +#ifndef UF8 Gtk::Alignment* align; +#endif int row = 0; set_border_width (12); @@ -112,6 +116,17 @@ MackieControlProtocolGUI::MackieControlProtocolGUI (MackieControlProtocol& p) table.set_col_spacings (6); table.set_border_width (12); table.set_homogeneous (false); +#ifdef UF8 + std::string data_file_path; + string name = "ssl-uf8-small.png"; + PBD::Searchpath spath(ARDOUR::ardour_data_search_path()); + spath.add_subdirectory_to_paths ("icons"); + find_file (spath, name, data_file_path); + if (!data_file_path.empty()) { + image.set (data_file_path); + hpacker.pack_start (image, false, false); + } +#endif l = manage (new Gtk::Label (_("Device Type:"))); l->set_alignment (1.0, 0.5); @@ -149,6 +164,7 @@ MackieControlProtocolGUI::MackieControlProtocolGUI (MackieControlProtocol& p) table.attach (*_device_dependent_widget, 0, 12, row, row+1, AttachOptions(0), AttachOptions(0), 0, 0); row++; +#ifndef UF8 /* back to the boilerplate */ RadioButtonGroup rb_group = absolute_touch_mode_button.get_group(); @@ -222,8 +238,11 @@ MackieControlProtocolGUI::MackieControlProtocolGUI (MackieControlProtocol& p) _profile_combo.set_active_text (p.device_profile().name()); _profile_combo.signal_changed().connect (sigc::mem_fun (*this, &MackieControlProtocolGUI::profile_combo_changed)); - append_page (table, _("Device Setup")); - table.show_all(); +#endif + hpacker.pack_start(table, false, false); + append_page (hpacker, _("Device Setup")); + hpacker.show_all(); + /* function key editor */ @@ -503,13 +522,13 @@ MackieControlProtocolGUI::refresh_function_key_editor () DeviceProfile dp (_cp.device_profile()); DeviceInfo di (_cp.device_info()); - for (int n = 0; n < Mackie::Button::FinalGlobalButton; ++n) { + for (int n = 0; n < MACKIE_NAMESPACE::Button::FinalGlobalButton; ++n) { - Mackie::Button::ID bid = (Mackie::Button::ID) n; + MACKIE_NAMESPACE::Button::ID bid = (MACKIE_NAMESPACE::Button::ID) n; row = *(function_key_model->append()); if (di.global_buttons().find (bid) == di.global_buttons().end()) { - row[function_key_columns.name] = Mackie::Button::id_to_name (bid); + row[function_key_columns.name] = MACKIE_NAMESPACE::Button::id_to_name (bid); } else { row[function_key_columns.name] = di.get_global_button_name (bid) + "*"; } @@ -523,7 +542,7 @@ MackieControlProtocolGUI::refresh_function_key_editor () * reserved for hard-coded actions. */ - if (bid >= Mackie::Button::F1 && bid <= Mackie::Button::F8) { + if (bid >= MACKIE_NAMESPACE::Button::F1 && bid <= MACKIE_NAMESPACE::Button::F8) { action = dp.get_button_action (bid, 0); if (action.empty()) { @@ -548,7 +567,7 @@ MackieControlProtocolGUI::refresh_function_key_editor () * reserved for hard-coded actions. */ - if (bid >= Mackie::Button::F1 && bid <= Mackie::Button::F8) { + if (bid >= MACKIE_NAMESPACE::Button::F1 && bid <= MACKIE_NAMESPACE::Button::F8) { action = dp.get_button_action (bid, MackieControlProtocol::MODIFIER_SHIFT); if (action.empty()) { diff --git a/libs/surfaces/mackie/gui.h b/libs/surfaces/mackie/gui.h index ec41689f52..c337164f85 100644 --- a/libs/surfaces/mackie/gui.h +++ b/libs/surfaces/mackie/gui.h @@ -19,14 +19,18 @@ #include -#include +#include #include #include #include -#include +#include #include #include +#include +#include #include +#include +#include namespace Gtk { class CellRendererCombo; @@ -40,13 +44,10 @@ namespace ActionManager { class ActionModel; } -namespace ArdourSurface { +namespace ArdourSurface { namespace MACKIE_NAMESPACE { class MackieControlProtocol; - -namespace Mackie { - class Surface; -} +class Surface; class MackieControlProtocolGUI : public Gtk::Notebook { @@ -84,7 +85,7 @@ class MackieControlProtocolGUI : public Gtk::Notebook add (shiftcontrol); }; Gtk::TreeModelColumn name; - Gtk::TreeModelColumn id; + Gtk::TreeModelColumn id; Gtk::TreeModelColumn plain; Gtk::TreeModelColumn shift; Gtk::TreeModelColumn control; @@ -123,6 +124,9 @@ class MackieControlProtocolGUI : public Gtk::Notebook Gtk::Adjustment ipmidi_base_port_adjustment; Gtk::Button discover_button; + Gtk::HBox hpacker; + Gtk::Image image; + void discover_clicked (); void recalibrate_faders (); void toggle_backlight (); @@ -138,7 +142,7 @@ class MackieControlProtocolGUI : public Gtk::Notebook void update_port_combos (std::vector const&, std::vector const&, Gtk::ComboBox* input_combo, Gtk::ComboBox* output_combo, - std::shared_ptr surface); + std::shared_ptr surface); PBD::ScopedConnectionList _port_connections; void connection_handler (); @@ -146,7 +150,8 @@ class MackieControlProtocolGUI : public Gtk::Notebook Glib::RefPtr build_midi_port_list (std::vector const & ports, bool for_input); bool _ignore_profile_changed; bool ignore_active_change; - void active_port_changed (Gtk::ComboBox* combo, std::weak_ptr ws, bool for_input); + void active_port_changed (Gtk::ComboBox* combo, std::weak_ptr ws, bool for_input); }; -} +} // namespace Mackie +} // namespace ArdourSurface diff --git a/libs/surfaces/mackie/interface.cc b/libs/surfaces/mackie/interface.cc index c15ce34ba1..86c8c2e0a9 100644 --- a/libs/surfaces/mackie/interface.cc +++ b/libs/surfaces/mackie/interface.cc @@ -32,7 +32,7 @@ using namespace ARDOUR; using namespace PBD; using namespace std; using namespace ArdourSurface; -using namespace Mackie; +using namespace ArdourSurface::MACKIE_NAMESPACE; static ControlProtocol* new_mackie_protocol (Session* s) diff --git a/libs/surfaces/mackie/jog.cc b/libs/surfaces/mackie/jog.cc index 3717fc8c3f..aacd4e1240 100644 --- a/libs/surfaces/mackie/jog.cc +++ b/libs/surfaces/mackie/jog.cc @@ -22,7 +22,7 @@ #include "control_group.h" using namespace ArdourSurface; -using namespace Mackie; +using namespace ArdourSurface::MACKIE_NAMESPACE; const int Jog::ID = 0x3c; diff --git a/libs/surfaces/mackie/jog.h b/libs/surfaces/mackie/jog.h index b6e1b41f93..06facbe0da 100644 --- a/libs/surfaces/mackie/jog.h +++ b/libs/surfaces/mackie/jog.h @@ -23,8 +23,7 @@ #include "controls.h" #include "pot.h" -namespace ArdourSurface { -namespace Mackie { +namespace ArdourSurface { namespace MACKIE_NAMESPACE { class Jog : public Pot { diff --git a/libs/surfaces/mackie/jog_wheel.cc b/libs/surfaces/mackie/jog_wheel.cc index 0614c64888..87ea1a711f 100644 --- a/libs/surfaces/mackie/jog_wheel.cc +++ b/libs/surfaces/mackie/jog_wheel.cc @@ -31,7 +31,7 @@ #include using namespace ArdourSurface; -using namespace Mackie; +using namespace ArdourSurface::MACKIE_NAMESPACE; JogWheel::JogWheel (MackieControlProtocol & mcp) : _mcp (mcp) diff --git a/libs/surfaces/mackie/jog_wheel.h b/libs/surfaces/mackie/jog_wheel.h index 8c0a711f46..6168ac1ed3 100644 --- a/libs/surfaces/mackie/jog_wheel.h +++ b/libs/surfaces/mackie/jog_wheel.h @@ -26,13 +26,10 @@ #include #include -namespace ArdourSurface { +namespace ArdourSurface { namespace MACKIE_NAMESPACE { class MackieControlProtocol; -namespace Mackie -{ - class JogWheel { public: diff --git a/libs/surfaces/mackie/led.cc b/libs/surfaces/mackie/led.cc index be4414f725..ad6afefdb6 100644 --- a/libs/surfaces/mackie/led.cc +++ b/libs/surfaces/mackie/led.cc @@ -22,7 +22,7 @@ #include "control_group.h" using namespace ArdourSurface; -using namespace Mackie; +using namespace ArdourSurface::MACKIE_NAMESPACE; const int Led::FaderTouch = 0x70; const int Led::Timecode = 0x71; diff --git a/libs/surfaces/mackie/led.h b/libs/surfaces/mackie/led.h index 7bfbe4739c..75dd9e9c35 100644 --- a/libs/surfaces/mackie/led.h +++ b/libs/surfaces/mackie/led.h @@ -24,9 +24,7 @@ #include "midi_byte_array.h" #include "types.h" -namespace ArdourSurface { - -namespace Mackie { +namespace ArdourSurface { namespace MACKIE_NAMESPACE { class Led : public Control { diff --git a/libs/surfaces/mackie/mackie_control_exception.h b/libs/surfaces/mackie/mackie_control_exception.h index 2ddf6b0156..eb7c18c60e 100644 --- a/libs/surfaces/mackie/mackie_control_exception.h +++ b/libs/surfaces/mackie/mackie_control_exception.h @@ -21,8 +21,9 @@ #include -namespace ArdourSurface { -namespace Mackie { +#include "types.h" + +namespace ArdourSurface { namespace MACKIE_NAMESPACE { class MackieControlException : public std::exception { diff --git a/libs/surfaces/mackie/mackie_control_protocol.cc b/libs/surfaces/mackie/mackie_control_protocol.cc index f5ea742598..00d49d4a99 100644 --- a/libs/surfaces/mackie/mackie_control_protocol.cc +++ b/libs/surfaces/mackie/mackie_control_protocol.cc @@ -94,7 +94,7 @@ using namespace std; using namespace PBD; using namespace Glib; using namespace ArdourSurface; -using namespace Mackie; +using namespace ArdourSurface::MACKIE_NAMESPACE; #include "pbd/i18n.h" @@ -139,7 +139,7 @@ MackieControlProtocol::MackieControlProtocol (Session& session) { DEBUG_TRACE (DEBUG::MackieControl, "MackieControlProtocol::MackieControlProtocol\n"); - _subview = Mackie::SubviewFactory::instance()->create_subview(Subview::None, *this, std::shared_ptr()); + _subview = MACKIE_NAMESPACE::SubviewFactory::instance()->create_subview(Subview::None, *this, std::shared_ptr()); DeviceInfo::reload_device_info (); DeviceProfile::reload_device_profiles (); @@ -688,7 +688,7 @@ MackieControlProtocol::device_ready () } } update_surfaces (); - set_subview_mode (Mackie::Subview::None, std::shared_ptr()); + set_subview_mode (MACKIE_NAMESPACE::Subview::None, std::shared_ptr()); set_flip_mode (Normal); } @@ -849,9 +849,9 @@ MackieControlProtocol::set_device (const string& device_name, bool force) } gboolean -ArdourSurface::ipmidi_input_handler (GIOChannel*, GIOCondition condition, void *data) +ArdourSurface::MACKIE_NAMESPACE::ipmidi_input_handler (GIOChannel*, GIOCondition condition, void *data) { - ArdourSurface::MackieControlProtocol::ipMIDIHandler* ipm = static_cast(data); + MackieControlProtocol::ipMIDIHandler* ipm = static_cast(data); return ipm->mcp->midi_input_handler (Glib::IOCondition (condition), ipm->port); } @@ -1331,6 +1331,7 @@ MackieControlProtocol::notify_solo_active_changed (bool active) if (x != surface->controls_by_device_independent_id.end()) { Led* rude_solo = dynamic_cast (x->second); if (rude_solo) { + update_global_button (Button::ClearSolo, active); surface->write (rude_solo->set_state (active ? flashing : off)); } } @@ -1493,7 +1494,7 @@ MackieControlProtocol::stop () } void -MackieControlProtocol::update_led (Surface& surface, Button& button, Mackie::LedState ls) +MackieControlProtocol::update_led (Surface& surface, Button& button, MACKIE_NAMESPACE::LedState ls) { if (ls != none) { surface.port().write (button.set_state (ls)); @@ -1807,7 +1808,7 @@ MackieControlProtocol::set_subview_mode (Subview::Mode sm, std::shared_ptrdisplay_message_for (reason_why_subview_not_possible, 1000); - if (_subview->subview_mode() != Mackie::Subview::None) { + if (_subview->subview_mode() != MACKIE_NAMESPACE::Subview::None) { /* redisplay current subview mode after that message goes away. */ @@ -1822,7 +1823,7 @@ MackieControlProtocol::set_subview_mode (Subview::Mode sm, std::shared_ptrcreate_subview(sm, *this, r); + _subview = MACKIE_NAMESPACE::SubviewFactory::instance()->create_subview(sm, *this, r); /* Catch the current subview stripable going away */ if (_subview->subview_stripable()) { _subview->subview_stripable()->DropReferences.connect (_subview->subview_stripable_connections(), MISSING_INVALIDATOR, @@ -1854,7 +1855,7 @@ MackieControlProtocol::set_view_mode (ViewMode m) /* leave subview mode, whatever it was */ DEBUG_TRACE (DEBUG::MackieControl, "\t\t\tsubview mode reset in MackieControlProtocol::set_view_mode \n"); - set_subview_mode (Mackie::Subview::None, std::shared_ptr()); + set_subview_mode (MACKIE_NAMESPACE::Subview::None, std::shared_ptr()); display_view_mode (); } @@ -2446,12 +2447,12 @@ MackieControlProtocol::stripable_selection_changed () */ if (!set_subview_mode (_subview->subview_mode(), s)) { - set_subview_mode (Mackie::Subview::None, std::shared_ptr()); + set_subview_mode (MACKIE_NAMESPACE::Subview::None, std::shared_ptr()); } } else { // none selected or not on surface - set_subview_mode(Mackie::Subview::None, std::shared_ptr()); + set_subview_mode(MACKIE_NAMESPACE::Subview::None, std::shared_ptr()); } } diff --git a/libs/surfaces/mackie/mackie_control_protocol.h b/libs/surfaces/mackie/mackie_control_protocol.h index 33cb121ddc..76655ecd39 100644 --- a/libs/surfaces/mackie/mackie_control_protocol.h +++ b/libs/surfaces/mackie/mackie_control_protocol.h @@ -57,15 +57,13 @@ namespace MIDI { class Port; } -namespace ArdourSurface { +namespace ArdourSurface { namespace MACKIE_NAMESPACE { -namespace Mackie { - class Surface; - class Control; - class SurfacePort; - class Button; - class Strip; -} +class Surface; +class Control; +class SurfacePort; +class Button; +class Strip; gboolean ipmidi_input_handler (GIOChannel*, GIOCondition condition, void *data); @@ -114,11 +112,11 @@ class MackieControlProtocol static MackieControlProtocol* instance() { return _instance; } - const Mackie::DeviceInfo& device_info() const { return _device_info; } - Mackie::DeviceProfile& device_profile() { return _device_profile; } + const MACKIE_NAMESPACE::DeviceInfo& device_info() const { return _device_info; } + MACKIE_NAMESPACE::DeviceProfile& device_profile() { return _device_profile; } PBD::Signal0 DeviceChanged; - PBD::Signal1 > ConnectionChange; + PBD::Signal1 > ConnectionChange; void device_ready (); @@ -128,7 +126,7 @@ class MackieControlProtocol FlipMode flip_mode () const { return _flip_mode; } ViewMode view_mode () const { return _view_mode; } - std::shared_ptr subview() { return _subview; } + std::shared_ptr subview() { return _subview; } bool zoom_mode () const { return modifier_state() & MODIFIER_ZOOM; } bool metering_active () const { return _metering_active; } @@ -147,7 +145,7 @@ class MackieControlProtocol void set_automation_state (ARDOUR::AutoState); void set_view_mode (ViewMode); - bool set_subview_mode (Mackie::Subview::Mode, std::shared_ptr); + bool set_subview_mode (MACKIE_NAMESPACE::Subview::Mode, std::shared_ptr); bool redisplay_subview_mode (); void set_flip_mode (FlipMode); void display_view_mode (); @@ -161,14 +159,14 @@ class MackieControlProtocol */ mutable Glib::Threads::Mutex surfaces_lock; - typedef std::list > Surfaces; + typedef std::list > Surfaces; Surfaces surfaces; - std::shared_ptr get_surface_by_raw_pointer (void*) const; - std::shared_ptr nth_surface (uint32_t) const; + std::shared_ptr get_surface_by_raw_pointer (void*) const; + std::shared_ptr nth_surface (uint32_t) const; - uint32_t global_index (Mackie::Strip&); - uint32_t global_index_locked (Mackie::Strip&); + uint32_t global_index (MACKIE_NAMESPACE::Strip&); + uint32_t global_index_locked (MACKIE_NAMESPACE::Strip&); std::list > bundles (); @@ -181,7 +179,7 @@ class MackieControlProtocol void* get_gui () const; void tear_down_gui (); - void handle_button_event (Mackie::Surface&, Mackie::Button& button, Mackie::ButtonState); + void handle_button_event (MACKIE_NAMESPACE::Surface&, MACKIE_NAMESPACE::Button& button, MACKIE_NAMESPACE::ButtonState); void notify_subview_stripable_deleted (); void notify_routes_added (ARDOUR::RouteList &); @@ -212,10 +210,10 @@ class MackieControlProtocol void update_timecode_beats_led(); /// this is called to generate the midi to send in response to a button press. - void update_led(Mackie::Surface&, Mackie::Button & button, Mackie::LedState); + void update_led(MACKIE_NAMESPACE::Surface&, MACKIE_NAMESPACE::Button & button, MACKIE_NAMESPACE::LedState); - void update_global_button (int id, Mackie::LedState); - void update_global_led (int id, Mackie::LedState); + void update_global_button (int id, MACKIE_NAMESPACE::LedState); + void update_global_led (int id, MACKIE_NAMESPACE::LedState); ARDOUR::Session & get_session() { return *session; } samplepos_t transport_sample() const; @@ -283,23 +281,23 @@ class MackieControlProtocol private: struct ButtonHandlers { - Mackie::LedState (MackieControlProtocol::*press) (Mackie::Button&); - Mackie::LedState (MackieControlProtocol::*release) (Mackie::Button&); + MACKIE_NAMESPACE::LedState (MackieControlProtocol::*press) (MACKIE_NAMESPACE::Button&); + MACKIE_NAMESPACE::LedState (MackieControlProtocol::*release) (MACKIE_NAMESPACE::Button&); - ButtonHandlers (Mackie::LedState (MackieControlProtocol::*p) (Mackie::Button&), - Mackie::LedState (MackieControlProtocol::*r) (Mackie::Button&)) + ButtonHandlers (MACKIE_NAMESPACE::LedState (MackieControlProtocol::*p) (MACKIE_NAMESPACE::Button&), + MACKIE_NAMESPACE::LedState (MackieControlProtocol::*r) (MACKIE_NAMESPACE::Button&)) : press (p) , release (r) {} }; - typedef std::map ButtonMap; + typedef std::map ButtonMap; static MackieControlProtocol* _instance; bool profile_exists (std::string const&) const; - Mackie::DeviceInfo _device_info; - Mackie::DeviceProfile _device_profile; + MACKIE_NAMESPACE::DeviceInfo _device_info; + MACKIE_NAMESPACE::DeviceProfile _device_profile; sigc::connection periodic_connection; sigc::connection redisplay_connection; sigc::connection hui_connection; @@ -310,7 +308,7 @@ class MackieControlProtocol PBD::ScopedConnectionList gui_connections; PBD::ScopedConnectionList fader_automation_connections; // timer for two quick marker left presses - Mackie::Timer _frm_left_last; + MACKIE_NAMESPACE::Timer _frm_left_last; // last written timecode string std::string _timecode_last; samplepos_t _sample_last; @@ -324,7 +322,7 @@ class MackieControlProtocol bool _scrub_mode; FlipMode _flip_mode; ViewMode _view_mode; - std::shared_ptr _subview; + std::shared_ptr _subview; int _current_selected_track; int _modifier_state; ButtonMap button_map; @@ -338,14 +336,14 @@ class MackieControlProtocol bool marker_modifier_consumed_by_button; bool nudge_modifier_consumed_by_button; - std::shared_ptr _master_surface; + std::shared_ptr _master_surface; - struct ipMIDIHandler { - MackieControlProtocol* mcp; - MIDI::Port* port; - }; - friend struct ipMIDIHandler; /* is this necessary */ - friend gboolean ArdourSurface::ipmidi_input_handler (GIOChannel*, GIOCondition condition, void *data); + struct ipMIDIHandler { + MackieControlProtocol* mcp; + MIDI::Port* port; + }; + friend struct ipMIDIHandler; /* is this necessary */ + friend gboolean ArdourSurface::MACKIE_NAMESPACE::ipmidi_input_handler (GIOChannel*, GIOCondition condition, void *data); int create_surfaces (); bool periodic(); @@ -379,170 +377,171 @@ class MackieControlProtocol void pull_stripable_range (DownButtonList&, ARDOUR::StripableList&, uint32_t pressed); /* implemented button handlers */ - Mackie::LedState stop_press(Mackie::Button &); - Mackie::LedState stop_release(Mackie::Button &); - Mackie::LedState play_press(Mackie::Button &); - Mackie::LedState play_release(Mackie::Button &); - Mackie::LedState record_press(Mackie::Button &); - Mackie::LedState record_release(Mackie::Button &); - Mackie::LedState loop_press(Mackie::Button &); - Mackie::LedState loop_release(Mackie::Button &); - Mackie::LedState rewind_press(Mackie::Button & button); - Mackie::LedState rewind_release(Mackie::Button & button); - Mackie::LedState ffwd_press(Mackie::Button & button); - Mackie::LedState ffwd_release(Mackie::Button & button); - Mackie::LedState cursor_up_press (Mackie::Button &); - Mackie::LedState cursor_up_release (Mackie::Button &); - Mackie::LedState cursor_down_press (Mackie::Button &); - Mackie::LedState cursor_down_release (Mackie::Button &); - Mackie::LedState cursor_left_press (Mackie::Button &); - Mackie::LedState cursor_left_release (Mackie::Button &); - Mackie::LedState cursor_right_press (Mackie::Button &); - Mackie::LedState cursor_right_release (Mackie::Button &); - Mackie::LedState left_press(Mackie::Button &); - Mackie::LedState left_release(Mackie::Button &); - Mackie::LedState right_press(Mackie::Button &); - Mackie::LedState right_release(Mackie::Button &); - Mackie::LedState channel_left_press(Mackie::Button &); - Mackie::LedState channel_left_release(Mackie::Button &); - Mackie::LedState channel_right_press(Mackie::Button &); - Mackie::LedState channel_right_release(Mackie::Button &); - Mackie::LedState marker_press(Mackie::Button &); - Mackie::LedState marker_release(Mackie::Button &); - Mackie::LedState save_press(Mackie::Button &); - Mackie::LedState save_release(Mackie::Button &); - Mackie::LedState timecode_beats_press(Mackie::Button &); - Mackie::LedState timecode_beats_release(Mackie::Button &); - Mackie::LedState zoom_press(Mackie::Button &); - Mackie::LedState zoom_release(Mackie::Button &); - Mackie::LedState scrub_press(Mackie::Button &); - Mackie::LedState scrub_release(Mackie::Button &); - Mackie::LedState undo_press (Mackie::Button &); - Mackie::LedState undo_release (Mackie::Button &); - Mackie::LedState shift_press (Mackie::Button &); - Mackie::LedState shift_release (Mackie::Button &); - Mackie::LedState option_press (Mackie::Button &); - Mackie::LedState option_release (Mackie::Button &); - Mackie::LedState control_press (Mackie::Button &); - Mackie::LedState control_release (Mackie::Button &); - Mackie::LedState cmd_alt_press (Mackie::Button &); - Mackie::LedState cmd_alt_release (Mackie::Button &); + MACKIE_NAMESPACE::LedState stop_press(MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState stop_release(MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState play_press(MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState play_release(MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState record_press(MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState record_release(MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState loop_press(MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState loop_release(MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState rewind_press(MACKIE_NAMESPACE::Button & button); + MACKIE_NAMESPACE::LedState rewind_release(MACKIE_NAMESPACE::Button & button); + MACKIE_NAMESPACE::LedState ffwd_press(MACKIE_NAMESPACE::Button & button); + MACKIE_NAMESPACE::LedState ffwd_release(MACKIE_NAMESPACE::Button & button); + MACKIE_NAMESPACE::LedState cursor_up_press (MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState cursor_up_release (MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState cursor_down_press (MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState cursor_down_release (MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState cursor_left_press (MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState cursor_left_release (MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState cursor_right_press (MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState cursor_right_release (MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState left_press(MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState left_release(MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState right_press(MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState right_release(MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState channel_left_press(MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState channel_left_release(MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState channel_right_press(MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState channel_right_release(MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState marker_press(MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState marker_release(MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState save_press(MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState save_release(MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState timecode_beats_press(MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState timecode_beats_release(MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState zoom_press(MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState zoom_release(MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState scrub_press(MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState scrub_release(MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState undo_press (MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState undo_release (MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState shift_press (MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState shift_release (MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState option_press (MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState option_release (MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState control_press (MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState control_release (MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState cmd_alt_press (MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState cmd_alt_release (MACKIE_NAMESPACE::Button &); - Mackie::LedState pan_press (Mackie::Button &); - Mackie::LedState pan_release (Mackie::Button &); - Mackie::LedState plugin_press (Mackie::Button &); - Mackie::LedState plugin_release (Mackie::Button &); - Mackie::LedState eq_press (Mackie::Button &); - Mackie::LedState eq_release (Mackie::Button &); - Mackie::LedState dyn_press (Mackie::Button &); - Mackie::LedState dyn_release (Mackie::Button &); - Mackie::LedState flip_press (Mackie::Button &); - Mackie::LedState flip_release (Mackie::Button &); - Mackie::LedState name_value_press (Mackie::Button &); - Mackie::LedState name_value_release (Mackie::Button &); -// Mackie::LedState F1_press (Mackie::Button &); -// Mackie::LedState F1_release (Mackie::Button &); -// Mackie::LedState F2_press (Mackie::Button &); -// Mackie::LedState F2_release (Mackie::Button &); -// Mackie::LedState F3_press (Mackie::Button &); -// Mackie::LedState F3_release (Mackie::Button &); -// Mackie::LedState F4_press (Mackie::Button &); -// Mackie::LedState F4_release (Mackie::Button &); -// Mackie::LedState F5_press (Mackie::Button &); -// Mackie::LedState F5_release (Mackie::Button &); -// Mackie::LedState F6_press (Mackie::Button &); -// Mackie::LedState F6_release (Mackie::Button &); -// Mackie::LedState F7_press (Mackie::Button &); -// Mackie::LedState F7_release (Mackie::Button &); -// Mackie::LedState F8_press (Mackie::Button &); -// Mackie::LedState F8_release (Mackie::Button &); - Mackie::LedState touch_press (Mackie::Button &); - Mackie::LedState touch_release (Mackie::Button &); - Mackie::LedState enter_press (Mackie::Button &); - Mackie::LedState enter_release (Mackie::Button &); - Mackie::LedState cancel_press (Mackie::Button &); - Mackie::LedState cancel_release (Mackie::Button &); - Mackie::LedState user_a_press (Mackie::Button &); - Mackie::LedState user_a_release (Mackie::Button &); - Mackie::LedState user_b_press (Mackie::Button &); - Mackie::LedState user_b_release (Mackie::Button &); - Mackie::LedState fader_touch_press (Mackie::Button &); - Mackie::LedState fader_touch_release (Mackie::Button &); - Mackie::LedState master_fader_touch_press (Mackie::Button &); - Mackie::LedState master_fader_touch_release (Mackie::Button &); + MACKIE_NAMESPACE::LedState pan_press (MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState pan_release (MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState plugin_press (MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState plugin_release (MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState eq_press (MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState eq_release (MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState dyn_press (MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState dyn_release (MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState flip_press (MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState flip_release (MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState name_value_press (MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState name_value_release (MACKIE_NAMESPACE::Button &); +// MACKIE_NAMESPACE::LedState F1_press (MACKIE_NAMESPACE::Button &); +// MACKIE_NAMESPACE::LedState F1_release (MACKIE_NAMESPACE::Button &); +// MACKIE_NAMESPACE::LedState F2_press (MACKIE_NAMESPACE::Button &); +// MACKIE_NAMESPACE::LedState F2_release (MACKIE_NAMESPACE::Button &); +// MACKIE_NAMESPACE::LedState F3_press (MACKIE_NAMESPACE::Button &); +// MACKIE_NAMESPACE::LedState F3_release (MACKIE_NAMESPACE::Button &); +// MACKIE_NAMESPACE::LedState F4_press (MACKIE_NAMESPACE::Button &); +// MACKIE_NAMESPACE::LedState F4_release (MACKIE_NAMESPACE::Button &); +// MACKIE_NAMESPACE::LedState F5_press (MACKIE_NAMESPACE::Button &); +// MACKIE_NAMESPACE::LedState F5_release (MACKIE_NAMESPACE::Button &); +// MACKIE_NAMESPACE::LedState F6_press (MACKIE_NAMESPACE::Button &); +// MACKIE_NAMESPACE::LedState F6_release (MACKIE_NAMESPACE::Button &); +// MACKIE_NAMESPACE::LedState F7_press (MACKIE_NAMESPACE::Button &); +// MACKIE_NAMESPACE::LedState F7_release (MACKIE_NAMESPACE::Button &); +// MACKIE_NAMESPACE::LedState F8_press (MACKIE_NAMESPACE::Button &); +// MACKIE_NAMESPACE::LedState F8_release (MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState touch_press (MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState touch_release (MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState enter_press (MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState enter_release (MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState cancel_press (MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState cancel_release (MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState user_a_press (MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState user_a_release (MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState user_b_press (MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState user_b_release (MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState fader_touch_press (MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState fader_touch_release (MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState master_fader_touch_press (MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState master_fader_touch_release (MACKIE_NAMESPACE::Button &); - Mackie::LedState read_press (Mackie::Button&); - Mackie::LedState read_release (Mackie::Button&); - Mackie::LedState write_press (Mackie::Button&); - Mackie::LedState write_release (Mackie::Button&); - Mackie::LedState clearsolo_press (Mackie::Button&); - Mackie::LedState clearsolo_release (Mackie::Button&); - Mackie::LedState track_press (Mackie::Button&); - Mackie::LedState track_release (Mackie::Button&); - Mackie::LedState send_press (Mackie::Button&); - Mackie::LedState send_release (Mackie::Button&); - Mackie::LedState miditracks_press (Mackie::Button&); - Mackie::LedState miditracks_release (Mackie::Button&); - Mackie::LedState inputs_press (Mackie::Button&); - Mackie::LedState inputs_release (Mackie::Button&); - Mackie::LedState audiotracks_press (Mackie::Button&); - Mackie::LedState audiotracks_release (Mackie::Button&); - Mackie::LedState audioinstruments_press (Mackie::Button&); - Mackie::LedState audioinstruments_release (Mackie::Button&); - Mackie::LedState aux_press (Mackie::Button&); - Mackie::LedState aux_release (Mackie::Button&); - Mackie::LedState busses_press (Mackie::Button&); - Mackie::LedState busses_release (Mackie::Button&); - Mackie::LedState outputs_press (Mackie::Button&); - Mackie::LedState outputs_release (Mackie::Button&); - Mackie::LedState user_press (Mackie::Button&); - Mackie::LedState user_release (Mackie::Button&); - Mackie::LedState trim_press (Mackie::Button&); - Mackie::LedState trim_release (Mackie::Button&); - Mackie::LedState latch_press (Mackie::Button&); - Mackie::LedState latch_release (Mackie::Button&); - Mackie::LedState grp_press (Mackie::Button&); - Mackie::LedState grp_release (Mackie::Button&); - Mackie::LedState nudge_press (Mackie::Button&); - Mackie::LedState nudge_release (Mackie::Button&); - Mackie::LedState drop_press (Mackie::Button&); - Mackie::LedState drop_release (Mackie::Button&); - Mackie::LedState replace_press (Mackie::Button&); - Mackie::LedState replace_release (Mackie::Button&); - Mackie::LedState click_press (Mackie::Button&); - Mackie::LedState click_release (Mackie::Button&); - Mackie::LedState view_press (Mackie::Button&); - Mackie::LedState view_release (Mackie::Button&); + MACKIE_NAMESPACE::LedState read_press (MACKIE_NAMESPACE::Button&); + MACKIE_NAMESPACE::LedState read_release (MACKIE_NAMESPACE::Button&); + MACKIE_NAMESPACE::LedState write_press (MACKIE_NAMESPACE::Button&); + MACKIE_NAMESPACE::LedState write_release (MACKIE_NAMESPACE::Button&); + MACKIE_NAMESPACE::LedState clearsolo_press (MACKIE_NAMESPACE::Button&); + MACKIE_NAMESPACE::LedState clearsolo_release (MACKIE_NAMESPACE::Button&); + MACKIE_NAMESPACE::LedState track_press (MACKIE_NAMESPACE::Button&); + MACKIE_NAMESPACE::LedState track_release (MACKIE_NAMESPACE::Button&); + MACKIE_NAMESPACE::LedState send_press (MACKIE_NAMESPACE::Button&); + MACKIE_NAMESPACE::LedState send_release (MACKIE_NAMESPACE::Button&); + MACKIE_NAMESPACE::LedState miditracks_press (MACKIE_NAMESPACE::Button&); + MACKIE_NAMESPACE::LedState miditracks_release (MACKIE_NAMESPACE::Button&); + MACKIE_NAMESPACE::LedState inputs_press (MACKIE_NAMESPACE::Button&); + MACKIE_NAMESPACE::LedState inputs_release (MACKIE_NAMESPACE::Button&); + MACKIE_NAMESPACE::LedState audiotracks_press (MACKIE_NAMESPACE::Button&); + MACKIE_NAMESPACE::LedState audiotracks_release (MACKIE_NAMESPACE::Button&); + MACKIE_NAMESPACE::LedState audioinstruments_press (MACKIE_NAMESPACE::Button&); + MACKIE_NAMESPACE::LedState audioinstruments_release (MACKIE_NAMESPACE::Button&); + MACKIE_NAMESPACE::LedState aux_press (MACKIE_NAMESPACE::Button&); + MACKIE_NAMESPACE::LedState aux_release (MACKIE_NAMESPACE::Button&); + MACKIE_NAMESPACE::LedState busses_press (MACKIE_NAMESPACE::Button&); + MACKIE_NAMESPACE::LedState busses_release (MACKIE_NAMESPACE::Button&); + MACKIE_NAMESPACE::LedState outputs_press (MACKIE_NAMESPACE::Button&); + MACKIE_NAMESPACE::LedState outputs_release (MACKIE_NAMESPACE::Button&); + MACKIE_NAMESPACE::LedState user_press (MACKIE_NAMESPACE::Button&); + MACKIE_NAMESPACE::LedState user_release (MACKIE_NAMESPACE::Button&); + MACKIE_NAMESPACE::LedState trim_press (MACKIE_NAMESPACE::Button&); + MACKIE_NAMESPACE::LedState trim_release (MACKIE_NAMESPACE::Button&); + MACKIE_NAMESPACE::LedState latch_press (MACKIE_NAMESPACE::Button&); + MACKIE_NAMESPACE::LedState latch_release (MACKIE_NAMESPACE::Button&); + MACKIE_NAMESPACE::LedState grp_press (MACKIE_NAMESPACE::Button&); + MACKIE_NAMESPACE::LedState grp_release (MACKIE_NAMESPACE::Button&); + MACKIE_NAMESPACE::LedState nudge_press (MACKIE_NAMESPACE::Button&); + MACKIE_NAMESPACE::LedState nudge_release (MACKIE_NAMESPACE::Button&); + MACKIE_NAMESPACE::LedState drop_press (MACKIE_NAMESPACE::Button&); + MACKIE_NAMESPACE::LedState drop_release (MACKIE_NAMESPACE::Button&); + MACKIE_NAMESPACE::LedState replace_press (MACKIE_NAMESPACE::Button&); + MACKIE_NAMESPACE::LedState replace_release (MACKIE_NAMESPACE::Button&); + MACKIE_NAMESPACE::LedState click_press (MACKIE_NAMESPACE::Button&); + MACKIE_NAMESPACE::LedState click_release (MACKIE_NAMESPACE::Button&); + MACKIE_NAMESPACE::LedState view_press (MACKIE_NAMESPACE::Button&); + MACKIE_NAMESPACE::LedState view_release (MACKIE_NAMESPACE::Button&); - Mackie::LedState bank_release (Mackie::Button&, uint32_t bank_num); - Mackie::LedState master_press(Mackie::Button &); - Mackie::LedState master_release(Mackie::Button &); - Mackie::LedState redo_press(Mackie::Button &); - Mackie::LedState redo_release(Mackie::Button &); - Mackie::LedState prev_marker_press(Mackie::Button &); - Mackie::LedState prev_marker_release(Mackie::Button &); - Mackie::LedState next_marker_press(Mackie::Button &); - Mackie::LedState next_marker_release(Mackie::Button &); - Mackie::LedState flip_window_press (Mackie::Button&); - Mackie::LedState flip_window_release (Mackie::Button&); - Mackie::LedState open_press(Mackie::Button &); - Mackie::LedState open_release(Mackie::Button &); - Mackie::LedState prog2_clear_solo_press(Mackie::Button &); - Mackie::LedState prog2_clear_solo_release(Mackie::Button &); - Mackie::LedState prog2_save_press(Mackie::Button &); - Mackie::LedState prog2_save_release(Mackie::Button &); - Mackie::LedState prog2_vst_press(Mackie::Button &); - Mackie::LedState prog2_vst_release(Mackie::Button &); - Mackie::LedState prog2_left_press(Mackie::Button &); - Mackie::LedState prog2_left_release(Mackie::Button &); - Mackie::LedState prog2_right_press(Mackie::Button &); - Mackie::LedState prog2_right_release(Mackie::Button &); - Mackie::LedState prog2_marker_press(Mackie::Button &); - Mackie::LedState prog2_marker_release(Mackie::Button &); - Mackie::LedState prog2_undo_press(Mackie::Button &); - Mackie::LedState prog2_undo_release(Mackie::Button &); + MACKIE_NAMESPACE::LedState bank_release (MACKIE_NAMESPACE::Button&, uint32_t bank_num); + MACKIE_NAMESPACE::LedState master_press(MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState master_release(MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState redo_press(MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState redo_release(MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState prev_marker_press(MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState prev_marker_release(MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState next_marker_press(MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState next_marker_release(MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState flip_window_press (MACKIE_NAMESPACE::Button&); + MACKIE_NAMESPACE::LedState flip_window_release (MACKIE_NAMESPACE::Button&); + MACKIE_NAMESPACE::LedState open_press(MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState open_release(MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState prog2_clear_solo_press(MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState prog2_clear_solo_release(MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState prog2_save_press(MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState prog2_save_release(MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState prog2_vst_press(MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState prog2_vst_release(MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState prog2_left_press(MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState prog2_left_release(MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState prog2_right_press(MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState prog2_right_release(MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState prog2_marker_press(MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState prog2_marker_release(MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState prog2_undo_press(MACKIE_NAMESPACE::Button &); + MACKIE_NAMESPACE::LedState prog2_undo_release(MACKIE_NAMESPACE::Button &); }; +} // namespace } // namespace #endif // ardour_mackie_control_protocol_h diff --git a/libs/surfaces/mackie/mackie_control_protocol_poll.cc b/libs/surfaces/mackie/mackie_control_protocol_poll.cc deleted file mode 100644 index cdb9429354..0000000000 --- a/libs/surfaces/mackie/mackie_control_protocol_poll.cc +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2006-2007 John Anderson - * Copyright (C) 2012-2015 Paul Davis - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include "mackie_control_protocol.h" - -#include "midi_byte_array.h" -#include "surface_port.h" - -#include "pbd/pthread_utils.h" -#include "pbd/error.h" - -#include "midi++/types.h" -#include "midi++/port.h" -#include "midi++/manager.h" -#include "pbd/i18n.h" - -#include -#include -#include -#include - -#include -#include -#include - -using namespace std; -using namespace Mackie; -using namespace PBD; - diff --git a/libs/surfaces/mackie/mcp_buttons.cc b/libs/surfaces/mackie/mcp_buttons.cc index 777e1320be..69ea5cfc31 100644 --- a/libs/surfaces/mackie/mcp_buttons.cc +++ b/libs/surfaces/mackie/mcp_buttons.cc @@ -46,7 +46,7 @@ using std::string; using namespace ARDOUR; using namespace PBD; using namespace ArdourSurface; -using namespace Mackie; +using namespace ArdourSurface::MACKIE_NAMESPACE; LedState MackieControlProtocol::shift_press (Button &) @@ -102,7 +102,7 @@ MackieControlProtocol::cmd_alt_release (Button &) LedState MackieControlProtocol::left_press (Button &) { - if (_subview->subview_mode() != Mackie::Subview::None) { + if (_subview->subview_mode() != MACKIE_NAMESPACE::Subview::None) { return none; } @@ -136,7 +136,7 @@ MackieControlProtocol::left_release (Button &) LedState MackieControlProtocol::right_press (Button &) { - if (_subview->subview_mode() != Mackie::Subview::None) { + if (_subview->subview_mode() != MACKIE_NAMESPACE::Subview::None) { return none; } @@ -294,7 +294,7 @@ MackieControlProtocol::channel_left_press (Button &) return on; } - if (_subview->subview_mode() != Mackie::Subview::None) { + if (_subview->subview_mode() != MACKIE_NAMESPACE::Subview::None) { return none; } Sorted sorted = get_sorted_stripables(); @@ -320,7 +320,7 @@ MackieControlProtocol::channel_right_press (Button &) return on; } - if (_subview->subview_mode() != Mackie::Subview::None) { + if (_subview->subview_mode() != MACKIE_NAMESPACE::Subview::None) { return none; } Sorted sorted = get_sorted_stripables(); @@ -338,14 +338,14 @@ MackieControlProtocol::channel_right_release (Button &) return off; } -Mackie::LedState -MackieControlProtocol::zoom_press (Mackie::Button &) +MACKIE_NAMESPACE::LedState +MackieControlProtocol::zoom_press (MACKIE_NAMESPACE::Button &) { return none; } -Mackie::LedState -MackieControlProtocol::zoom_release (Mackie::Button &) +MACKIE_NAMESPACE::LedState +MackieControlProtocol::zoom_release (MACKIE_NAMESPACE::Button &) { if (_modifier_state & MODIFIER_ZOOM) { _modifier_state &= ~MODIFIER_ZOOM; @@ -356,8 +356,8 @@ MackieControlProtocol::zoom_release (Mackie::Button &) return (zoom_mode() ? on : off); } -Mackie::LedState -MackieControlProtocol::scrub_press (Mackie::Button &) +MACKIE_NAMESPACE::LedState +MackieControlProtocol::scrub_press (MACKIE_NAMESPACE::Button &) { if (_master_surface) { _master_surface->next_jog_mode (); @@ -366,8 +366,8 @@ MackieControlProtocol::scrub_press (Mackie::Button &) return none; } -Mackie::LedState -MackieControlProtocol::scrub_release (Mackie::Button &) +MACKIE_NAMESPACE::LedState +MackieControlProtocol::scrub_release (MACKIE_NAMESPACE::Button &) { return none; } @@ -712,7 +712,7 @@ MackieControlProtocol::enter_release (Button &) LedState MackieControlProtocol::bank_release (Button& b, uint32_t basic_bank_num) { - if (_subview->subview_mode() != Mackie::Subview::None) { + if (_subview->subview_mode() != MACKIE_NAMESPACE::Subview::None) { return none; } @@ -817,7 +817,7 @@ LedState MackieControlProtocol::pan_press (Button &) { /* XXX eventually pan may have its own subview mode */ - set_subview_mode (Mackie::Subview::None, std::shared_ptr()); + set_subview_mode (MACKIE_NAMESPACE::Subview::None, std::shared_ptr()); return none; } LedState @@ -942,7 +942,7 @@ MackieControlProtocol::user_b_release (Button &) } LedState -MackieControlProtocol::master_fader_touch_press (Mackie::Button &) +MackieControlProtocol::master_fader_touch_press (MACKIE_NAMESPACE::Button &) { if (_master_surface && _master_surface->master_fader() != 0) { DEBUG_TRACE (DEBUG::MackieControl, "MackieControlProtocol::master_fader_touch_press\n"); @@ -955,7 +955,7 @@ MackieControlProtocol::master_fader_touch_press (Mackie::Button &) return none; } LedState -MackieControlProtocol::master_fader_touch_release (Mackie::Button &) +MackieControlProtocol::master_fader_touch_release (MACKIE_NAMESPACE::Button &) { if (_master_surface && _master_surface->master_fader() != 0) { DEBUG_TRACE (DEBUG::MackieControl, "MackieControlProtocol::master_fader_touch_release\n"); @@ -969,32 +969,32 @@ MackieControlProtocol::master_fader_touch_release (Mackie::Button &) return none; } -Mackie::LedState -MackieControlProtocol::read_press (Mackie::Button&) +MACKIE_NAMESPACE::LedState +MackieControlProtocol::read_press (MACKIE_NAMESPACE::Button&) { return none; } -Mackie::LedState -MackieControlProtocol::read_release (Mackie::Button&) +MACKIE_NAMESPACE::LedState +MackieControlProtocol::read_release (MACKIE_NAMESPACE::Button&) { set_automation_state (ARDOUR::Play); return none; } -Mackie::LedState -MackieControlProtocol::write_press (Mackie::Button&) +MACKIE_NAMESPACE::LedState +MackieControlProtocol::write_press (MACKIE_NAMESPACE::Button&) { return none; } -Mackie::LedState -MackieControlProtocol::write_release (Mackie::Button&) +MACKIE_NAMESPACE::LedState +MackieControlProtocol::write_release (MACKIE_NAMESPACE::Button&) { set_automation_state (ARDOUR::Write); return none; } -Mackie::LedState -MackieControlProtocol::clearsolo_press (Mackie::Button&) +MACKIE_NAMESPACE::LedState +MackieControlProtocol::clearsolo_press (MACKIE_NAMESPACE::Button&) { // clears all solos and listens (pfl/afl) @@ -1007,152 +1007,152 @@ MackieControlProtocol::clearsolo_press (Mackie::Button&) return none; } -Mackie::LedState -MackieControlProtocol::clearsolo_release (Mackie::Button&) +MACKIE_NAMESPACE::LedState +MackieControlProtocol::clearsolo_release (MACKIE_NAMESPACE::Button&) { //return session->soloing(); return none; } -Mackie::LedState -MackieControlProtocol::track_press (Mackie::Button&) +MACKIE_NAMESPACE::LedState +MackieControlProtocol::track_press (MACKIE_NAMESPACE::Button&) { set_subview_mode (Subview::TrackView, first_selected_stripable()); return none; } -Mackie::LedState -MackieControlProtocol::track_release (Mackie::Button&) +MACKIE_NAMESPACE::LedState +MackieControlProtocol::track_release (MACKIE_NAMESPACE::Button&) { return none; } -Mackie::LedState -MackieControlProtocol::send_press (Mackie::Button&) +MACKIE_NAMESPACE::LedState +MackieControlProtocol::send_press (MACKIE_NAMESPACE::Button&) { set_subview_mode (Subview::Sends, first_selected_stripable()); return none; /* led state handled by set_subview_mode() */ } -Mackie::LedState -MackieControlProtocol::send_release (Mackie::Button&) +MACKIE_NAMESPACE::LedState +MackieControlProtocol::send_release (MACKIE_NAMESPACE::Button&) { return none; } -Mackie::LedState -MackieControlProtocol::miditracks_press (Mackie::Button&) +MACKIE_NAMESPACE::LedState +MackieControlProtocol::miditracks_press (MACKIE_NAMESPACE::Button&) { return none; } -Mackie::LedState -MackieControlProtocol::miditracks_release (Mackie::Button&) +MACKIE_NAMESPACE::LedState +MackieControlProtocol::miditracks_release (MACKIE_NAMESPACE::Button&) { set_view_mode (MidiTracks); return none; } -Mackie::LedState -MackieControlProtocol::inputs_press (Mackie::Button&) +MACKIE_NAMESPACE::LedState +MackieControlProtocol::inputs_press (MACKIE_NAMESPACE::Button&) { return none; } -Mackie::LedState -MackieControlProtocol::inputs_release (Mackie::Button&) +MACKIE_NAMESPACE::LedState +MackieControlProtocol::inputs_release (MACKIE_NAMESPACE::Button&) { set_view_mode (Inputs); return none; } -Mackie::LedState -MackieControlProtocol::audiotracks_press (Mackie::Button&) +MACKIE_NAMESPACE::LedState +MackieControlProtocol::audiotracks_press (MACKIE_NAMESPACE::Button&) { return none; } -Mackie::LedState -MackieControlProtocol::audiotracks_release (Mackie::Button&) +MACKIE_NAMESPACE::LedState +MackieControlProtocol::audiotracks_release (MACKIE_NAMESPACE::Button&) { set_view_mode (AudioTracks); return none; } -Mackie::LedState -MackieControlProtocol::audioinstruments_press (Mackie::Button& b) +MACKIE_NAMESPACE::LedState +MackieControlProtocol::audioinstruments_press (MACKIE_NAMESPACE::Button& b) { return none; } -Mackie::LedState -MackieControlProtocol::audioinstruments_release (Mackie::Button& b) +MACKIE_NAMESPACE::LedState +MackieControlProtocol::audioinstruments_release (MACKIE_NAMESPACE::Button& b) { set_view_mode (AudioInstr); return none; } -Mackie::LedState -MackieControlProtocol::aux_press (Mackie::Button&) +MACKIE_NAMESPACE::LedState +MackieControlProtocol::aux_press (MACKIE_NAMESPACE::Button&) { return none; } -Mackie::LedState -MackieControlProtocol::aux_release (Mackie::Button&) +MACKIE_NAMESPACE::LedState +MackieControlProtocol::aux_release (MACKIE_NAMESPACE::Button&) { set_view_mode (Auxes); return none; } -Mackie::LedState -MackieControlProtocol::busses_press (Mackie::Button&) +MACKIE_NAMESPACE::LedState +MackieControlProtocol::busses_press (MACKIE_NAMESPACE::Button&) { return none; } -Mackie::LedState -MackieControlProtocol::busses_release (Mackie::Button&) +MACKIE_NAMESPACE::LedState +MackieControlProtocol::busses_release (MACKIE_NAMESPACE::Button&) { set_view_mode (Busses); return none; } -Mackie::LedState -MackieControlProtocol::outputs_press (Mackie::Button&) +MACKIE_NAMESPACE::LedState +MackieControlProtocol::outputs_press (MACKIE_NAMESPACE::Button&) { return none; } -Mackie::LedState -MackieControlProtocol::outputs_release (Mackie::Button&) +MACKIE_NAMESPACE::LedState +MackieControlProtocol::outputs_release (MACKIE_NAMESPACE::Button&) { set_view_mode (Outputs); return none; } -Mackie::LedState -MackieControlProtocol::user_press (Mackie::Button&) +MACKIE_NAMESPACE::LedState +MackieControlProtocol::user_press (MACKIE_NAMESPACE::Button&) { return none; } -Mackie::LedState -MackieControlProtocol::user_release (Mackie::Button&) +MACKIE_NAMESPACE::LedState +MackieControlProtocol::user_release (MACKIE_NAMESPACE::Button&) { set_view_mode (Selected); return none; } -Mackie::LedState -MackieControlProtocol::trim_press (Mackie::Button&) +MACKIE_NAMESPACE::LedState +MackieControlProtocol::trim_press (MACKIE_NAMESPACE::Button&) { return none; } -Mackie::LedState -MackieControlProtocol::trim_release (Mackie::Button&) +MACKIE_NAMESPACE::LedState +MackieControlProtocol::trim_release (MACKIE_NAMESPACE::Button&) { return none; } -Mackie::LedState -MackieControlProtocol::latch_press (Mackie::Button&) +MACKIE_NAMESPACE::LedState +MackieControlProtocol::latch_press (MACKIE_NAMESPACE::Button&) { return none; } -Mackie::LedState -MackieControlProtocol::latch_release (Mackie::Button&) +MACKIE_NAMESPACE::LedState +MackieControlProtocol::latch_release (MACKIE_NAMESPACE::Button&) { return none; } -Mackie::LedState -MackieControlProtocol::grp_press (Mackie::Button&) +MACKIE_NAMESPACE::LedState +MackieControlProtocol::grp_press (MACKIE_NAMESPACE::Button&) { return none; } -Mackie::LedState -MackieControlProtocol::grp_release (Mackie::Button&) +MACKIE_NAMESPACE::LedState +MackieControlProtocol::grp_release (MACKIE_NAMESPACE::Button&) { /* There is no "Off" button for automation, so we use Group for this purpose. @@ -1160,15 +1160,15 @@ MackieControlProtocol::grp_release (Mackie::Button&) set_automation_state (Off); return none; } -Mackie::LedState -MackieControlProtocol::nudge_press (Mackie::Button&) +MACKIE_NAMESPACE::LedState +MackieControlProtocol::nudge_press (MACKIE_NAMESPACE::Button&) { _modifier_state |= MODIFIER_NUDGE; nudge_modifier_consumed_by_button = false; return on; } -Mackie::LedState -MackieControlProtocol::nudge_release (Mackie::Button&) +MACKIE_NAMESPACE::LedState +MackieControlProtocol::nudge_release (MACKIE_NAMESPACE::Button&) { _modifier_state &= ~MODIFIER_NUDGE; @@ -1184,8 +1184,8 @@ MackieControlProtocol::nudge_release (Mackie::Button&) return off; } -Mackie::LedState -MackieControlProtocol::replace_press (Mackie::Button&) +MACKIE_NAMESPACE::LedState +MackieControlProtocol::replace_press (MACKIE_NAMESPACE::Button&) { if (main_modifier_state() == MODIFIER_SHIFT) { toggle_punch_out(); @@ -1195,13 +1195,13 @@ MackieControlProtocol::replace_press (Mackie::Button&) } return none; } -Mackie::LedState -MackieControlProtocol::replace_release (Mackie::Button&) +MACKIE_NAMESPACE::LedState +MackieControlProtocol::replace_release (MACKIE_NAMESPACE::Button&) { return none; } -Mackie::LedState -MackieControlProtocol::click_press (Mackie::Button&) +MACKIE_NAMESPACE::LedState +MackieControlProtocol::click_press (MACKIE_NAMESPACE::Button&) { if (main_modifier_state() & MODIFIER_SHIFT) { access_action ("Editor/set-punch-from-edit-range"); @@ -1212,19 +1212,19 @@ MackieControlProtocol::click_press (Mackie::Button&) return none; } } -Mackie::LedState -MackieControlProtocol::click_release (Mackie::Button&) +MACKIE_NAMESPACE::LedState +MackieControlProtocol::click_release (MACKIE_NAMESPACE::Button&) { return none; } -Mackie::LedState -MackieControlProtocol::view_press (Mackie::Button&) +MACKIE_NAMESPACE::LedState +MackieControlProtocol::view_press (MACKIE_NAMESPACE::Button&) { set_view_mode (Mixer); return none; } -Mackie::LedState -MackieControlProtocol::view_release (Mackie::Button&) +MACKIE_NAMESPACE::LedState +MackieControlProtocol::view_release (MACKIE_NAMESPACE::Button&) { return none; } diff --git a/libs/surfaces/mackie/meter.cc b/libs/surfaces/mackie/meter.cc index 2c2caefcf4..5e33ced0d7 100644 --- a/libs/surfaces/mackie/meter.cc +++ b/libs/surfaces/mackie/meter.cc @@ -30,7 +30,7 @@ using namespace PBD; using namespace ArdourSurface; -using namespace Mackie; +using namespace ArdourSurface::MACKIE_NAMESPACE; Control* Meter::factory (Surface& surface, int id, const char* name, Group& group) diff --git a/libs/surfaces/mackie/meter.h b/libs/surfaces/mackie/meter.h index 254b321164..311ce07c2e 100644 --- a/libs/surfaces/mackie/meter.h +++ b/libs/surfaces/mackie/meter.h @@ -23,9 +23,7 @@ #include "controls.h" #include "midi_byte_array.h" -namespace ArdourSurface { - -namespace Mackie { +namespace ArdourSurface { namespace MACKIE_NAMESPACE { class SurfacePort; diff --git a/libs/surfaces/mackie/pot.cc b/libs/surfaces/mackie/pot.cc index 24d33e2378..31cd34f32f 100644 --- a/libs/surfaces/mackie/pot.cc +++ b/libs/surfaces/mackie/pot.cc @@ -23,7 +23,7 @@ #include "control_group.h" using namespace ArdourSurface; -using namespace Mackie; +using namespace ArdourSurface::MACKIE_NAMESPACE; int const Pot::External = 0x2e; /* specific ID for "vpot" representing external control */ int const Pot::ID = 0x10; /* base value for v-pot IDs */ diff --git a/libs/surfaces/mackie/pot.h b/libs/surfaces/mackie/pot.h index 8a07bb09e4..e1d00ba87d 100644 --- a/libs/surfaces/mackie/pot.h +++ b/libs/surfaces/mackie/pot.h @@ -22,9 +22,7 @@ #include "controls.h" -namespace ArdourSurface { - -namespace Mackie { +namespace ArdourSurface { namespace MACKIE_NAMESPACE { class Pot : public Control { diff --git a/libs/surfaces/mackie/strip.cc b/libs/surfaces/mackie/strip.cc index b47b3271ce..199d1d5dfe 100644 --- a/libs/surfaces/mackie/strip.cc +++ b/libs/surfaces/mackie/strip.cc @@ -74,7 +74,7 @@ using namespace std; using namespace ARDOUR; using namespace PBD; using namespace ArdourSurface; -using namespace Mackie; +using namespace ArdourSurface::MACKIE_NAMESPACE; #ifndef timeradd /// only avail with __USE_BSD #define timeradd(a,b,result) \ @@ -91,7 +91,7 @@ using namespace Mackie; #define ui_context() MackieControlProtocol::instance() /* a UICallback-derived object that specifies the event loop for signal handling */ -Strip::Strip (Surface& s, const std::string& name, int index, const map& strip_buttons) +Strip::Strip (Surface& s, const std::string& name, int index, const map& strip_buttons) : Group (name) , _solo (0) , _recenable (0) diff --git a/libs/surfaces/mackie/strip.h b/libs/surfaces/mackie/strip.h index c859e43511..b3a5c7995b 100644 --- a/libs/surfaces/mackie/strip.h +++ b/libs/surfaces/mackie/strip.h @@ -44,9 +44,7 @@ namespace ARDOUR { class ChannelCount; } -namespace ArdourSurface { - -namespace Mackie { +namespace ArdourSurface { namespace MACKIE_NAMESPACE { class Control; class Surface; diff --git a/libs/surfaces/mackie/subview.cc b/libs/surfaces/mackie/subview.cc index 4f36cf79d4..f389a78d70 100644 --- a/libs/surfaces/mackie/subview.cc +++ b/libs/surfaces/mackie/subview.cc @@ -44,7 +44,7 @@ using namespace ARDOUR; using namespace ArdourSurface; -using namespace Mackie; +using namespace ArdourSurface::MACKIE_NAMESPACE; using namespace PBD; #define ui_context() MackieControlProtocol::instance() /* a UICallback-derived object that specifies the event loop for signal handling */ diff --git a/libs/surfaces/mackie/subview.h b/libs/surfaces/mackie/subview.h index a0b0c4638a..cc31042717 100644 --- a/libs/surfaces/mackie/subview.h +++ b/libs/surfaces/mackie/subview.h @@ -22,6 +22,7 @@ #include +#include "pbd/signals.h" #include "ardour/types.h" namespace ARDOUR { @@ -30,12 +31,10 @@ namespace ARDOUR { class PluginInsert; } -namespace ArdourSurface { +namespace ArdourSurface { namespace MACKIE_NAMESPACE { class MackieControlProtocol; -namespace Mackie { - class Pot; class Strip; class Subview; diff --git a/libs/surfaces/mackie/surface.cc b/libs/surfaces/mackie/surface.cc index 19bc00fce2..520ddfdf23 100644 --- a/libs/surfaces/mackie/surface.cc +++ b/libs/surfaces/mackie/surface.cc @@ -79,7 +79,7 @@ using ARDOUR::Profile; using ARDOUR::AutomationControl; using ARDOUR::ChanCount; using namespace ArdourSurface; -using namespace Mackie; +using namespace ArdourSurface::MACKIE_NAMESPACE; #define ui_context() MackieControlProtocol::instance() /* a UICallback-derived object that specifies the event loop for signal handling */ @@ -366,7 +366,7 @@ Surface::init_controls() DEBUG_TRACE (DEBUG::MackieControl, "Surface::init_controls: creating jog wheel\n"); if (_mcp.device_info().has_jog_wheel()) { - _jog_wheel = new Mackie::JogWheel (_mcp); + _jog_wheel = new MACKIE_NAMESPACE::JogWheel (_mcp); } DEBUG_TRACE (DEBUG::MackieControl, "Surface::init_controls: creating global controls\n"); diff --git a/libs/surfaces/mackie/surface.h b/libs/surfaces/mackie/surface.h index ab1de2a8a8..2d0a98f447 100644 --- a/libs/surfaces/mackie/surface.h +++ b/libs/surfaces/mackie/surface.h @@ -48,13 +48,9 @@ namespace ARDOUR { class MidiByteArray; -namespace ArdourSurface { +namespace ArdourSurface { namespace MACKIE_NAMESPACE { class MackieControlProtocol; - -namespace Mackie -{ - class MackieButtonHandler; class SurfacePort; class MackieMidiBuilder; @@ -100,7 +96,7 @@ public: std::map meters; std::map controls_by_device_independent_id; - Mackie::JogWheel* jog_wheel() const { return _jog_wheel; } + MACKIE_NAMESPACE::JogWheel* jog_wheel() const { return _jog_wheel; } Fader* master_fader() const { return _master_fader; } /// The collection of all numbered strips. @@ -193,7 +189,7 @@ public: MackieControlProtocol& mcp() const { return _mcp; } void next_jog_mode (); - void set_jog_mode (Mackie::JogWheel::Mode); + void set_jog_mode (MACKIE_NAMESPACE::JogWheel::Mode); void notify_metering_state_changed(); void turn_it_on (); @@ -213,20 +209,21 @@ public: bool master_stripable_is_master_monitor (); private: - MackieControlProtocol& _mcp; - SurfacePort* _port; - surface_type_t _stype; - uint32_t _number; - std::string _name; - bool _active; - bool _connected; - Mackie::JogWheel* _jog_wheel; - Fader* _master_fader; - float _last_master_gain_written; - PBD::ScopedConnection master_connection; - bool _has_master_display; - bool _has_master_meter; + MackieControlProtocol& _mcp; + SurfacePort* _port; + surface_type_t _stype; + uint32_t _number; + std::string _name; + bool _active; + bool _connected; + MACKIE_NAMESPACE::JogWheel* _jog_wheel; + Fader* _master_fader; + float _last_master_gain_written; + PBD::ScopedConnection master_connection; + bool _has_master_display; + bool _has_master_meter; std::shared_ptr _master_stripable; + std::string pending_display[2]; std::string current_display[2]; diff --git a/libs/surfaces/mackie/surface_port.cc b/libs/surfaces/mackie/surface_port.cc index 55591c5939..c24c3637cd 100644 --- a/libs/surfaces/mackie/surface_port.cc +++ b/libs/surfaces/mackie/surface_port.cc @@ -49,7 +49,7 @@ using namespace std; using namespace PBD; using namespace ARDOUR; using namespace ArdourSurface; -using namespace Mackie; +using namespace ArdourSurface::MACKIE_NAMESPACE; SurfacePort::SurfacePort (Surface& s) : _surface (&s) @@ -235,7 +235,7 @@ SurfacePort::write (const MidiByteArray & mba) } ostream & -Mackie::operator << (ostream & os, const SurfacePort & port) +MACKIE_NAMESPACE::operator << (ostream & os, const SurfacePort & port) { os << "{ "; os << "name: " << port.input_port().name() << " " << port.output_port().name(); diff --git a/libs/surfaces/mackie/surface_port.h b/libs/surfaces/mackie/surface_port.h index 2e6d23570f..77df4c598a 100644 --- a/libs/surfaces/mackie/surface_port.h +++ b/libs/surfaces/mackie/surface_port.h @@ -23,7 +23,7 @@ #include #include "pbd/signals.h" - +#include "pbd/xml++.h" #include "midi_byte_array.h" #include "types.h" @@ -33,19 +33,14 @@ namespace MIDI { class Port; } - namespace ARDOUR { class AsyncMIDIPort; class Port; } -namespace ArdourSurface { +namespace ArdourSurface { namespace MACKIE_NAMESPACE { class MackieControlProtocol; - -namespace Mackie -{ - class Surface; /** @@ -55,7 +50,7 @@ class Surface; class SurfacePort { public: - SurfacePort (Mackie::Surface&); + SurfacePort (Surface&); virtual ~SurfacePort(); /// an easier way to output bytes via midi @@ -78,7 +73,7 @@ class SurfacePort protected: private: - Mackie::Surface* _surface; + Surface* _surface; MIDI::Port* _input_port; MIDI::Port* _output_port; std::shared_ptr _async_in; diff --git a/libs/surfaces/mackie/timer.h b/libs/surfaces/mackie/timer.h index fcee690acb..4d25ec6ce7 100644 --- a/libs/surfaces/mackie/timer.h +++ b/libs/surfaces/mackie/timer.h @@ -21,16 +21,11 @@ #ifndef timer_h #define timer_h -#ifdef _WIN32 -#include "windows.h" -#else -#include -#endif +#include -namespace ArdourSurface { +#include "types.h" -namespace Mackie -{ +namespace ArdourSurface { namespace MACKIE_NAMESPACE { /** millisecond timer class. diff --git a/libs/surfaces/mackie/types.cc b/libs/surfaces/mackie/types.cc index 6a67e2387b..7b1a4f5c97 100644 --- a/libs/surfaces/mackie/types.cc +++ b/libs/surfaces/mackie/types.cc @@ -19,9 +19,7 @@ #include "types.h" -namespace ArdourSurface { - -namespace Mackie { +namespace ArdourSurface { namespace MACKIE_NAMESPACE { LedState on( LedState::on ); LedState off( LedState::off ); @@ -31,7 +29,7 @@ LedState none( LedState::none ); } } -std::ostream & operator << ( std::ostream & os, const ArdourSurface::Mackie::ControlState & cs ) +std::ostream & operator << ( std::ostream & os, const ArdourSurface::MACKIE_NAMESPACE::ControlState & cs ) { os << "ControlState { "; os << "pos: " << cs.pos; diff --git a/libs/surfaces/mackie/types.h b/libs/surfaces/mackie/types.h index b35d4ae7af..04d9f1d5ca 100644 --- a/libs/surfaces/mackie/types.h +++ b/libs/surfaces/mackie/types.h @@ -21,8 +21,13 @@ #include -namespace ArdourSurface { -namespace Mackie { +#ifdef UF8 +# define MACKIE_NAMESPACE NS_UF8 +#else +# define MACKIE_NAMESPACE NS_MCU +#endif + +namespace ArdourSurface { namespace MACKIE_NAMESPACE { enum surface_type_t { mcu, diff --git a/libs/surfaces/mackie/uf8_interface.cc b/libs/surfaces/mackie/uf8_interface.cc new file mode 100644 index 0000000000..8a39941119 --- /dev/null +++ b/libs/surfaces/mackie/uf8_interface.cc @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2006-2007 John Anderson + * Copyright (C) 2008-2015 Paul Davis + * Copyright (C) 2009-2010 Carl Hetherington + * Copyright (C) 2009 David Robillard + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include + +#include "pbd/error.h" + +#include "ardour/rc_configuration.h" +#include "ardour/debug.h" + +#include "control_protocol/control_protocol.h" + +#include "mackie_control_protocol.h" + +using namespace ARDOUR; +using namespace PBD; +using namespace std; +using namespace ArdourSurface; +using namespace ArdourSurface::MACKIE_NAMESPACE; + +static ControlProtocol* +new_uf8_protocol (Session* s) +{ + MackieControlProtocol* mcp = 0; + + DEBUG_TRACE (DEBUG::MackieControl, "making uf8-protocol"); + + try { + mcp = new MackieControlProtocol (*s); + /* do not set active here - wait for set_state() */ + } + catch (exception & e) { + error << "Error instantiating MackieControlProtocol for UF8: " << e.what() << endmsg; + delete mcp; + mcp = 0; + } + + return mcp; +} + +static void +delete_uf8_protocol (ControlProtocol* cp) +{ + try + { + delete cp; + } + catch ( exception & e ) + { + cout << "Exception caught trying to destroy MackieControlProtocol or UF8: " << e.what() << endl; + } +} + +// Field names commented out by JE - 06-01-2010 +static ControlProtocolDescriptor uf8_descriptor = { + /* name */ "SSL UF-8", + /* id */ "uri://ardour.org/surfaces/ssl_uf8:0", + /* module */ 0, + /* available */ 0, + /* probe_port */ 0, + /* match usb */ 0, + /* initialize */ new_uf8_protocol, + /* destroy */ delete_uf8_protocol, +}; + +extern "C" ARDOURSURFACE_API ControlProtocolDescriptor* protocol_descriptor () { return &uf8_descriptor; } diff --git a/libs/surfaces/mackie/wscript b/libs/surfaces/mackie/wscript index 1a6fa91cb5..63c5c2be8b 100644 --- a/libs/surfaces/mackie/wscript +++ b/libs/surfaces/mackie/wscript @@ -6,6 +6,28 @@ import os top = '.' out = 'build' +mackie_sources = [ + 'button.cc', + 'controls.cc', + 'device_info.cc', + 'device_profile.cc', + 'fader.cc', + 'gui.cc', + 'jog.cc', + 'jog_wheel.cc', + 'led.cc', + 'mackie_control_protocol.cc', + 'mcp_buttons.cc', + 'meter.cc', + 'midi_byte_array.cc', + 'pot.cc', + 'strip.cc', + 'subview.cc', + 'surface.cc', + 'surface_port.cc', + 'types.cc' +] + def options(opt): autowaf.set_options(opt) @@ -14,28 +36,8 @@ def configure(conf): def build(bld): obj = bld(features = 'cxx cxxshlib') - obj.source = ''' - button.cc - controls.cc - device_info.cc - device_profile.cc - fader.cc - gui.cc - interface.cc - jog.cc - jog_wheel.cc - led.cc - mackie_control_protocol.cc - mcp_buttons.cc - meter.cc - midi_byte_array.cc - pot.cc - strip.cc - subview.cc - surface.cc - surface_port.cc - types.cc - ''' + obj.source = list(mackie_sources) + obj.source += [ 'interface.cc' ] obj.defines = [ 'PACKAGE="ardour_mackie"' ] obj.defines += [ 'ARDOURSURFACE_DLL_EXPORTS' ] obj.includes = [ '.' ] @@ -45,5 +47,18 @@ def build(bld): obj.use = 'libardour libardour_cp libgtkmm2ext' obj.install_path = os.path.join(bld.env['LIBDIR'], 'surfaces') + obj = bld(features = 'cxx cxxshlib') + obj.source = list(mackie_sources) + obj.source += [ 'uf8_interface.cc' ] + obj.defines = [ 'PACKAGE="ardour_ssl_uf8"' ] + obj.defines += [ 'ARDOURSURFACE_DLL_EXPORTS' ] + obj.defines += [ 'UF8' ] + obj.includes = [ '.' ] + obj.name = 'libardour_ssl_uf8' + obj.target = 'ardour_ssl_uf8' + obj.uselib = 'GTKMM XML OSX' + obj.use = 'libardour libardour_cp libgtkmm2ext' + obj.install_path = os.path.join(bld.env['LIBDIR'], 'surfaces') + def shutdown(): autowaf.shutdown()