diff options
author | Robin Gareus <robin@gareus.org> | 2015-10-05 16:17:49 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2015-10-05 16:17:49 +0200 |
commit | 22b07e0233a29d9633ffa825a79503befaf2e16e (patch) | |
tree | 1d8b06056f8e12197158f5d906319767d3dedda5 /libs/surfaces/mackie | |
parent | e11ba7b79d68bc1070b170236c22123966d7bcc3 (diff) |
NOOP, remove trailing tabs/whitespace.
Diffstat (limited to 'libs/surfaces/mackie')
33 files changed, 248 insertions, 248 deletions
diff --git a/libs/surfaces/mackie/button.cc b/libs/surfaces/mackie/button.cc index c9ae1f5d71..53a43de5ba 100644 --- a/libs/surfaces/mackie/button.cc +++ b/libs/surfaces/mackie/button.cc @@ -104,9 +104,9 @@ Button::name_to_id (const std::string& name) if (!g_ascii_strcasecmp (name.c_str(), "Scrub")) { return Scrub; } if (!g_ascii_strcasecmp (name.c_str(), "User A")) { return UserA; } if (!g_ascii_strcasecmp (name.c_str(), "User B")) { return UserB; } - + /* Strip buttons */ - + if (!g_ascii_strcasecmp (name.c_str(), "Record Enable")) { return RecEnable; } if (!g_ascii_strcasecmp (name.c_str(), "Solo")) { return Solo; } if (!g_ascii_strcasecmp (name.c_str(), "Mute")) { return Mute; } diff --git a/libs/surfaces/mackie/button.h b/libs/surfaces/mackie/button.h index 61f09d7a03..42d2ec45b1 100644 --- a/libs/surfaces/mackie/button.h +++ b/libs/surfaces/mackie/button.h @@ -39,7 +39,7 @@ public: enum ID { /* Global Buttons */ - + Track, Send, Pan, @@ -111,7 +111,7 @@ public: CmdAlt, /* Strip buttons */ - + RecEnable, Solo, Mute, @@ -129,12 +129,12 @@ public: : Control (did, name, group) , _bid (bid) , _led (did, name + "_led", group) {} - + MidiByteArray zero() { return _led.zero (); } MidiByteArray set_state (LedState ls) { return _led.set_state (ls); } - + ID bid() const { return _bid; } - + static Control* factory (Surface& surface, Button::ID bid, int id, const std::string&, Group& group); static int name_to_id (const std::string& name); static std::string id_to_name (Button::ID); diff --git a/libs/surfaces/mackie/control_group.h b/libs/surfaces/mackie/control_group.h index 4955098225..e79a60f42f 100644 --- a/libs/surfaces/mackie/control_group.h +++ b/libs/surfaces/mackie/control_group.h @@ -19,21 +19,21 @@ public: : _name (name) {} virtual ~Group() {} - + virtual bool is_strip() const { return false; } virtual bool is_master() const { return false; } - + virtual void add (Control & control); - + const std::string & name() const { return _name; } void set_name (const std::string & rhs) { _name = rhs; } - + typedef std::vector<Control*> Controls; const Controls & controls() const { return _controls; } - + protected: Controls _controls; - + private: std::string _name; }; diff --git a/libs/surfaces/mackie/controls.cc b/libs/surfaces/mackie/controls.cc index 1c88c2b74c..bbe1029f30 100644 --- a/libs/surfaces/mackie/controls.cc +++ b/libs/surfaces/mackie/controls.cc @@ -101,7 +101,7 @@ Control::start_touch (double when) return normal_ac->start_touch (when); } } - + void Control::stop_touch (bool mark, double when) { @@ -109,7 +109,7 @@ Control::stop_touch (bool mark, double when) return normal_ac->stop_touch (mark, when); } } - + ostream & operator << (ostream & os, const ArdourSurface::Mackie::Control & control) { os << typeid (control).name(); @@ -120,7 +120,7 @@ ostream & operator << (ostream & os, const ArdourSurface::Mackie::Control & con os << ", "; os << "group: " << control.group().name(); os << " }"; - + return os; } diff --git a/libs/surfaces/mackie/controls.h b/libs/surfaces/mackie/controls.h index e8098ccf7e..38eb30fb65 100644 --- a/libs/surfaces/mackie/controls.h +++ b/libs/surfaces/mackie/controls.h @@ -48,14 +48,14 @@ class Control { public: Control (int id, std::string name, Group& group); virtual ~Control() {} - + int id() const { return _id; } const std::string & name() const { return _name; } Group & group() const { return _group; } bool in_use () const; void set_in_use (bool); - + // Keep track of the timeout so it can be updated with more incoming events sigc::connection in_use_connection; @@ -71,7 +71,7 @@ public: float get_value (); void set_value (float val); - + virtual void start_touch (double when); virtual void stop_touch (bool mark, double when); diff --git a/libs/surfaces/mackie/device_info.cc b/libs/surfaces/mackie/device_info.cc index 365ff1db9f..b0ce131e00 100644 --- a/libs/surfaces/mackie/device_info.cc +++ b/libs/surfaces/mackie/device_info.cc @@ -377,7 +377,7 @@ DeviceInfo::set_state (const XMLNode& node, int /* version */) } } } - + } } else if ((*i)->name() == "StripButton") { @@ -393,9 +393,9 @@ DeviceInfo::set_state (const XMLNode& node, int /* version */) } } } - + } - + } } } diff --git a/libs/surfaces/mackie/device_info.h b/libs/surfaces/mackie/device_info.h index c4cbd071c5..2f4f769127 100644 --- a/libs/surfaces/mackie/device_info.h +++ b/libs/surfaces/mackie/device_info.h @@ -62,7 +62,7 @@ class DeviceInfo LCXT = 0x11, HUI = 0x5 }; - + DeviceInfo(); ~DeviceInfo(); @@ -85,7 +85,7 @@ class DeviceInfo static std::map<std::string,DeviceInfo> device_info; static void reload_device_info(); - + std::string& get_global_button_name(Button::ID); GlobalButtonInfo& get_global_button(Button::ID); @@ -94,7 +94,7 @@ class DeviceInfo const GlobalButtonsInfo& global_buttons() const { return _global_buttons; } const StripButtonsInfo& strip_buttons() const { return _strip_buttons; } - + private: uint32_t _strip_cnt; uint32_t _extenders; diff --git a/libs/surfaces/mackie/device_profile.cc b/libs/surfaces/mackie/device_profile.cc index c4cd9bf1a8..2b9cbd5edb 100644 --- a/libs/surfaces/mackie/device_profile.cc +++ b/libs/surfaces/mackie/device_profile.cc @@ -339,7 +339,7 @@ DeviceProfile::save () } fullpath = Glib::build_filename (fullpath, legalize_for_path (_name) + ".profile"); - + XMLTree tree; tree.set_root (&get_state()); diff --git a/libs/surfaces/mackie/device_profile.h b/libs/surfaces/mackie/device_profile.h index 15702a6886..ab1e645e56 100644 --- a/libs/surfaces/mackie/device_profile.h +++ b/libs/surfaces/mackie/device_profile.h @@ -37,16 +37,16 @@ class DeviceProfile public: DeviceProfile (const std::string& name = ""); ~DeviceProfile(); - + std::string get_button_action (Button::ID, int modifier_state) const; void set_button_action (Button::ID, int modifier_state, const std::string&); - + const std::string& name() const; void set_path (const std::string&); static void reload_device_profiles (); static std::map<std::string,DeviceProfile> device_profiles; - + private: struct ButtonActions { std::string plain; @@ -56,13 +56,13 @@ class DeviceProfile std::string cmdalt; std::string shiftcontrol; }; - + typedef std::map<Button::ID,ButtonActions> ButtonActionMap; - + std::string _name; std::string _path; ButtonActionMap _button_map; - + int set_state (const XMLNode&, int version); XMLNode& get_state () const; diff --git a/libs/surfaces/mackie/fader.cc b/libs/surfaces/mackie/fader.cc index 5e40538096..33e1e4c29f 100644 --- a/libs/surfaces/mackie/fader.cc +++ b/libs/surfaces/mackie/fader.cc @@ -66,7 +66,7 @@ Fader::update_message () } last_update_position = posi; - + DEBUG_TRACE (DEBUG::MackieControl, string_compose ("generate fader message for position %1 (%2)\n", position, posi)); return MidiByteArray (3, 0xe0 + id(), posi & 0x7f, posi >> 7); } diff --git a/libs/surfaces/mackie/fader.h b/libs/surfaces/mackie/fader.h index e83e657e68..dae022c690 100644 --- a/libs/surfaces/mackie/fader.h +++ b/libs/surfaces/mackie/fader.h @@ -10,7 +10,7 @@ namespace Mackie { class Fader : public Control { public: - + Fader (int id, std::string name, Group & group) : Control (id, name, group) , position (0.0) @@ -20,11 +20,11 @@ class Fader : public Control MidiByteArray set_position (float); MidiByteArray zero() { return set_position (0.0); } - + MidiByteArray update_message (); static Control* factory (Surface&, int id, const char*, Group&); - + private: float position; int last_update_position; diff --git a/libs/surfaces/mackie/gui.cc b/libs/surfaces/mackie/gui.cc index 48bfa6cd8a..156070dbc8 100644 --- a/libs/surfaces/mackie/gui.cc +++ b/libs/surfaces/mackie/gui.cc @@ -89,7 +89,7 @@ MackieControlProtocolGUI::MackieControlProtocolGUI (MackieControlProtocol& p) Gtk::Label* l; Gtk::Alignment* align; int row = 0; - + set_border_width (12); Gtk::Table* table = Gtk::manage (new Gtk::Table (2, 12)); @@ -102,9 +102,9 @@ MackieControlProtocolGUI::MackieControlProtocolGUI (MackieControlProtocol& p) table->attach (*l, 0, 1, row, row+1, AttachOptions(FILL|EXPAND), AttachOptions(0)); table->attach (_surface_combo, 1, 2, row, row+1, AttachOptions(FILL|EXPAND), AttachOptions(0), 0, 0); row++; - + vector<string> surfaces; - + for (std::map<std::string,DeviceInfo>::iterator i = DeviceInfo::device_info.begin(); i != DeviceInfo::device_info.end(); ++i) { surfaces.push_back (i->first); } @@ -127,7 +127,7 @@ MackieControlProtocolGUI::MackieControlProtocolGUI (MackieControlProtocol& p) send_string = _("Surface sends via:"); receive_string = _("Surface receives via:"); } - + l = manage (new Gtk::Label (send_string)); l->set_alignment (1.0, 0.5); table->attach (*l, 0, 1, row, row+1, AttachOptions(FILL|EXPAND), AttachOptions(0)); @@ -149,10 +149,10 @@ MackieControlProtocolGUI::MackieControlProtocolGUI (MackieControlProtocol& p) table->attach (*l, 0, 1, row, row+1, AttachOptions(FILL|EXPAND), AttachOptions (0)); table->attach (ipmidi_base_port_spinner, 1, 2, row, row+1, AttachOptions(FILL|EXPAND), AttachOptions (0)); row++; - + ipmidi_base_port_spinner.set_sensitive (_cp.device_info().uses_ipmidi()); ipmidi_base_port_adjustment.signal_value_changed().connect (sigc::mem_fun (*this, &MackieControlProtocolGUI::ipmidi_spinner_changed)); - + /* leave an extra blank row */ row++; @@ -164,7 +164,7 @@ MackieControlProtocolGUI::MackieControlProtocolGUI (MackieControlProtocol& p) touch_sensitivity_adjustment.signal_value_changed().connect (sigc::mem_fun (*this, &MackieControlProtocolGUI::touch_sensitive_change)); touch_sensitivity_scale.set_update_policy (Gtk::UPDATE_DISCONTINUOUS); - + l = manage (new Gtk::Label (_("Button click"))); l->set_alignment (1.0, 0.5); table->attach (*l, 0, 1, row, row+1, AttachOptions(FILL|EXPAND), AttachOptions (0)); @@ -173,7 +173,7 @@ MackieControlProtocolGUI::MackieControlProtocolGUI (MackieControlProtocol& p) align->add (relay_click_button); table->attach (*align, 1, 2, row, row+1, AttachOptions(FILL|EXPAND), AttachOptions (0)); row++; - + l = manage (new Gtk::Label (_("Backlight"))); l->set_alignment (1.0, 0.5); table->attach (*l, 0, 1, row, row+1, AttachOptions(FILL|EXPAND), AttachOptions (0)); @@ -182,7 +182,7 @@ MackieControlProtocolGUI::MackieControlProtocolGUI (MackieControlProtocol& p) align->add (backlight_button); table->attach (*align, 1, 2, row, row+1, AttachOptions(FILL|EXPAND), AttachOptions (0)); row++; - + l = manage (new Gtk::Label (_("Send Fader Position Only When Touched"))); l->set_alignment (1.0, 0.5); table->attach (*l, 0, 1, row, row+1, AttachOptions(FILL|EXPAND), AttachOptions (0)); @@ -191,7 +191,7 @@ MackieControlProtocolGUI::MackieControlProtocolGUI (MackieControlProtocol& p) align->add (absolute_touch_mode_button); table->attach (*align, 1, 2, row, row+1, AttachOptions(FILL|EXPAND), AttachOptions (0)); row++; - + l = manage (new Gtk::Label (_("Send Fader Position When Moved"))); l->set_alignment (1.0, 0.5); table->attach (*l, 0, 1, row, row+1, AttachOptions(FILL|EXPAND), AttachOptions (0)); @@ -200,7 +200,7 @@ MackieControlProtocolGUI::MackieControlProtocolGUI (MackieControlProtocol& p) align->add (touch_move_mode_button); table->attach (*align, 1, 2, row, row+1, AttachOptions(FILL|EXPAND), AttachOptions (0)); row++; - + l = manage (new Gtk::Label (_("Fader Touch Sense Sensitivity"))); l->set_alignment (1.0, 0.5); table->attach (*l, 0, 1, row, row+1, AttachOptions(FILL|EXPAND), AttachOptions (0)); @@ -209,14 +209,14 @@ MackieControlProtocolGUI::MackieControlProtocolGUI (MackieControlProtocol& p) table->attach (touch_sensitivity_scale, 1, 2, 5, 6, AttachOptions(FILL|EXPAND), AttachOptions (0)); table->attach (recalibrate_fader_button, row, row+1, 6, 7, AttachOptions(FILL|EXPAND), AttachOptions (0)); row++; - + table->attach (discover_button, 1, 2, row, row+1, AttachOptions(FILL|EXPAND), AttachOptions (0)); discover_button.signal_clicked().connect (sigc::mem_fun (*this, &MackieControlProtocolGUI::discover_clicked)); row++; - + vector<string> profiles; - + profiles.push_back ("default"); for (std::map<std::string,DeviceProfile>::iterator i = DeviceProfile::device_profiles.begin(); i != DeviceProfile::device_profiles.end(); ++i) { @@ -234,13 +234,13 @@ MackieControlProtocolGUI::MackieControlProtocolGUI (MackieControlProtocol& p) VBox* fkey_packer = manage (new VBox); HBox* profile_packer = manage (new HBox); HBox* observation_packer = manage (new HBox); - + l = manage (new Gtk::Label (_("Profile/Settings:"))); profile_packer->pack_start (*l, false, false); profile_packer->pack_start (_profile_combo, true, true); profile_packer->set_spacing (12); profile_packer->set_border_width (12); - + l = manage (new Gtk::Label (_("* Button available at the original Mackie MCU PRO or current device if enabled (NOT implemented yet). Device specific name presented."))); observation_packer->pack_start (*l, false, false); @@ -322,7 +322,7 @@ MackieControlProtocolGUI::build_available_action_menu () parent = *(rowp); parent[available_action_columns.name] = _("CmdAlt"); - + for (l = labels.begin(), k = keys.begin(), p = paths.begin(), t = tooltips.begin(); l != labels.end(); ++k, ++p, ++t, ++l) { TreeModel::Row row; @@ -395,7 +395,7 @@ MackieControlProtocolGUI::build_function_key_editor () col = manage (new TreeViewColumn (_("Plain"), *renderer)); col->add_attribute (renderer->property_text(), function_key_columns.plain); function_key_editor.append_column (*col); - + renderer = make_action_renderer (available_action_model, function_key_columns.shift); col = manage (new TreeViewColumn (_("Shift"), *renderer)); col->add_attribute (renderer->property_text(), function_key_columns.shift); @@ -461,7 +461,7 @@ MackieControlProtocolGUI::refresh_function_key_editor () /* Probably a key alias */ row[function_key_columns.plain] = action; } else { - + act = ActionManager::get_action (action.c_str()); if (act) { row[function_key_columns.plain] = act->get_label(); @@ -569,7 +569,7 @@ MackieControlProtocolGUI::action_changed (const Glib::ustring &sPath, const Glib if (row) { std::map<std::string,std::string>::iterator i = action_map.find (text); - + if (i == action_map.end()) { if (!remove) { return; diff --git a/libs/surfaces/mackie/gui.h b/libs/surfaces/mackie/gui.h index 7927d106b0..2bc17d306b 100644 --- a/libs/surfaces/mackie/gui.h +++ b/libs/surfaces/mackie/gui.h @@ -41,14 +41,14 @@ class MackieControlProtocolGUI : public Gtk::Notebook { public: MackieControlProtocolGUI (MackieControlProtocol &); - + private: MackieControlProtocol& _cp; Gtk::ComboBoxText _surface_combo; Gtk::ComboBoxText _profile_combo; Gtk::ComboBoxText _input_port_combo; Gtk::ComboBoxText _output_port_combo; - + struct AvailableActionColumns : public Gtk::TreeModel::ColumnRecord { AvailableActionColumns() { add (name); diff --git a/libs/surfaces/mackie/interface.cc b/libs/surfaces/mackie/interface.cc index bb0a4d0509..1a9760bcbe 100644 --- a/libs/surfaces/mackie/interface.cc +++ b/libs/surfaces/mackie/interface.cc @@ -35,7 +35,7 @@ static ControlProtocol* new_mackie_protocol (ControlProtocolDescriptor*, Session* s) { MackieControlProtocol* mcp = 0; - + try { mcp = new MackieControlProtocol (*s); /* do not set active here - wait for set_state() */ @@ -45,7 +45,7 @@ new_mackie_protocol (ControlProtocolDescriptor*, Session* s) delete mcp; mcp = 0; } - + return mcp; } @@ -90,6 +90,6 @@ static ControlProtocolDescriptor mackie_descriptor = { /*initialize : */ new_mackie_protocol, /*destroy : */ delete_mackie_protocol }; - + extern "C" ARDOURSURFACE_API ControlProtocolDescriptor* protocol_descriptor () { return &mackie_descriptor; } diff --git a/libs/surfaces/mackie/jog_wheel.h b/libs/surfaces/mackie/jog_wheel.h index 568589e54d..f54e3efeb3 100644 --- a/libs/surfaces/mackie/jog_wheel.h +++ b/libs/surfaces/mackie/jog_wheel.h @@ -18,7 +18,7 @@ class JogWheel { public: enum Mode { scroll }; - + JogWheel (MackieControlProtocol & mcp); /// As the wheel turns... diff --git a/libs/surfaces/mackie/led.cc b/libs/surfaces/mackie/led.cc index d103829a77..59b9f6cb20 100644 --- a/libs/surfaces/mackie/led.cc +++ b/libs/surfaces/mackie/led.cc @@ -48,18 +48,18 @@ Led::set_state (LedState new_state) MIDI::byte msg = 0; switch (state.state()) { - case LedState::on: + case LedState::on: msg = 0x7f; break; - case LedState::off: + case LedState::off: msg = 0x00; break; - case LedState::flashing: + case LedState::flashing: msg = 0x01; break; - case LedState::none: + case LedState::none: return MidiByteArray (); } - + return MidiByteArray (3, 0x90, id(), msg); } diff --git a/libs/surfaces/mackie/led.h b/libs/surfaces/mackie/led.h index 8361c4bb8d..19c48cb6a8 100644 --- a/libs/surfaces/mackie/led.h +++ b/libs/surfaces/mackie/led.h @@ -42,12 +42,12 @@ public: , state (off) { } - + Led & led() { return *this; } MidiByteArray set_state (LedState); MidiByteArray zero() { return set_state (off); } - + static Control* factory (Surface&, int id, const char*, Group&); private: diff --git a/libs/surfaces/mackie/mackie_control_exception.h b/libs/surfaces/mackie/mackie_control_exception.h index b40c5c3915..6dcca3dd39 100644 --- a/libs/surfaces/mackie/mackie_control_exception.h +++ b/libs/surfaces/mackie/mackie_control_exception.h @@ -30,14 +30,14 @@ public: : _msg( msg ) { } - + virtual ~MackieControlException() throw () {} - + const char * what() const throw () { return _msg.c_str(); } - + private: std::string _msg; }; diff --git a/libs/surfaces/mackie/mackie_control_protocol.h b/libs/surfaces/mackie/mackie_control_protocol.h index ac1ba53896..0536a0c764 100644 --- a/libs/surfaces/mackie/mackie_control_protocol.h +++ b/libs/surfaces/mackie/mackie_control_protocol.h @@ -118,12 +118,12 @@ class MackieControlProtocol Swap, /* fader controls secondary, vpot controls primary */ Zero, /* fader controls primary, but doesn't move, vpot controls secondary */ }; - + MackieControlProtocol(ARDOUR::Session &); virtual ~MackieControlProtocol(); static MackieControlProtocol* instance() { return _instance; } - + const Mackie::DeviceInfo& device_info() const { return _device_info; } Mackie::DeviceProfile& device_profile() { return _device_profile; } @@ -148,9 +148,9 @@ class MackieControlProtocol we do not implement get/set_feedback() since this aspect of support for the protocol is not optional. */ - + static bool probe(); - + Glib::Threads::Mutex surfaces_lock; typedef std::list<boost::shared_ptr<Mackie::Surface> > Surfaces; Surfaces surfaces; @@ -159,9 +159,9 @@ class MackieControlProtocol void set_master_on_surface_strip (uint32_t surface, uint32_t strip); void set_monitor_on_surface_strip (uint32_t surface, uint32_t strip); - + uint32_t n_strips (bool with_locked_strips = true) const; - + bool has_editor () const { return true; } void* get_gui () const; void tear_down_gui (); @@ -174,7 +174,7 @@ class MackieControlProtocol void recalibrate_faders (); void toggle_backlight (); void set_touch_sensitivity (int); - + /// rebuild the current bank. Called on route added/removed and /// remote id changed. void refresh_current_bank(); @@ -191,7 +191,7 @@ class MackieControlProtocol /// Turn timecode on and beats off, or vice versa, depending /// on state of _timecode_type 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); @@ -209,7 +209,7 @@ class MackieControlProtocol void add_down_button (ARDOUR::AutomationType, int surface, int strip); void remove_down_button (ARDOUR::AutomationType, int surface, int strip); ControlList down_controls (ARDOUR::AutomationType); - + void add_down_select_button (int surface, int strip); void remove_down_select_button (int surface, int strip); void select_range (); @@ -221,7 +221,7 @@ class MackieControlProtocol void not_session_load () { _session_load = false; } void midi_connectivity_established (); - + protected: // shut down the surface void close(); @@ -229,14 +229,14 @@ class MackieControlProtocol // This sets up the notifications and sets the // controls to the correct values void update_surfaces(); - + // connects global (not strip) signals from the Session to here // so the surface can be notified of changes from the other UIs. void connect_session_signals(); - + // set all controls to their zero position void zero_all(); - + /** Fetch the set of routes to be considered for control by the surface. Excluding master, hidden and control routes, and inactive routes @@ -254,7 +254,7 @@ class MackieControlProtocol std::string format_bbt_timecode (ARDOUR::framepos_t now_frame); std::string format_timecode_timecode (ARDOUR::framepos_t now_frame); - + void do_request (MackieControlUIRequest*); int stop (); @@ -267,7 +267,7 @@ class MackieControlProtocol struct ButtonHandlers { Mackie::LedState (MackieControlProtocol::*press) (Mackie::Button&); Mackie::LedState (MackieControlProtocol::*release) (Mackie::Button&); - + ButtonHandlers (Mackie::LedState (MackieControlProtocol::*p) (Mackie::Button&), Mackie::LedState (MackieControlProtocol::*r) (Mackie::Button&)) : press (p) @@ -277,7 +277,7 @@ class MackieControlProtocol typedef std::map<Mackie::Button::ID,ButtonHandlers> ButtonMap; static MackieControlProtocol* _instance; - + Mackie::DeviceInfo _device_info; Mackie::DeviceProfile _device_profile; sigc::connection periodic_connection; diff --git a/libs/surfaces/mackie/mcp_buttons.cc b/libs/surfaces/mackie/mcp_buttons.cc index c2d3680ff0..5bf52ce4c4 100644 --- a/libs/surfaces/mackie/mcp_buttons.cc +++ b/libs/surfaces/mackie/mcp_buttons.cc @@ -189,7 +189,7 @@ LedState MackieControlProtocol::cursor_right_press (Button& ) { if (zoom_mode()) { - + if (main_modifier_state() & MODIFIER_OPTION) { /* reset selected tracks to default vertical zoom */ } else { @@ -209,7 +209,7 @@ MackieControlProtocol::cursor_right_press (Button& ) ScrollTimeline (page_fraction); } - + return off; } @@ -223,7 +223,7 @@ LedState MackieControlProtocol::cursor_up_press (Button&) { if (zoom_mode()) { - + if (main_modifier_state() & MODIFIER_CONTROL) { VerticalZoomInSelected (); /* EMIT SIGNAL */ } else { diff --git a/libs/surfaces/mackie/meter.cc b/libs/surfaces/mackie/meter.cc index 91de8d6ef6..27171aff16 100644 --- a/libs/surfaces/mackie/meter.cc +++ b/libs/surfaces/mackie/meter.cc @@ -43,24 +43,24 @@ Meter::factory (Surface& surface, int id, const char* name, Group& group) void Meter::notify_metering_state_changed(Surface& surface, bool transport_is_rolling, bool metering_active) -{ +{ MidiByteArray msg; - + // sysex header msg << surface.sysex_hdr(); - + // code for Channel Meter Enable Message msg << 0x20; - + // Channel identification msg << id(); - + // Enable (0x07) / Disable (0x00) level meter on LCD, peak hold display on horizontal meter and signal LED msg << ((transport_is_rolling && metering_active) ? 0x07 : 0x00); - + // sysex trailer msg << MIDI::eox; - + surface.write (msg); } @@ -70,7 +70,7 @@ Meter::send_update (Surface& surface, float dB) float def = 0.0f; /* Meter deflection %age */ // DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Meter ID %1 dB %2\n", id(), dB)); - + if (dB < -70.0f) { def = 0.0f; } else if (dB < -60.0f) { @@ -88,19 +88,19 @@ Meter::send_update (Surface& surface, float dB) } else { def = 115.0f; } - + /* 115 is the deflection %age that would be when dB=6.0. this is an arbitrary endpoint for our scaling. */ MidiByteArray msg; - + if (def > 100.0f) { if (!overload_on) { overload_on = true; surface.write (MidiByteArray (2, 0xd0, (id() << 4) | 0xe)); - + } } else { if (overload_on) { @@ -108,11 +108,11 @@ Meter::send_update (Surface& surface, float dB) surface.write (MidiByteArray (2, 0xd0, (id() << 4) | 0xf)); } } - + /* we can use up to 13 segments */ int segment = lrintf ((def/115.0) * 13.0); - + surface.write (MidiByteArray (2, 0xd0, (id()<<4) | segment)); } diff --git a/libs/surfaces/mackie/meter.h b/libs/surfaces/mackie/meter.h index 1cbeeac0af..9a5d88ed23 100644 --- a/libs/surfaces/mackie/meter.h +++ b/libs/surfaces/mackie/meter.h @@ -35,7 +35,7 @@ public: Meter (int id, std::string name, Group & group) : Control (id, name, group) , overload_on (false) {} - + void send_update (Surface&, float dB); MidiByteArray zero(); diff --git a/libs/surfaces/mackie/midi_byte_array.cc b/libs/surfaces/mackie/midi_byte_array.cc index 1e94e781c0..ffb94a03a9 100644 --- a/libs/surfaces/mackie/midi_byte_array.cc +++ b/libs/surfaces/mackie/midi_byte_array.cc @@ -34,7 +34,7 @@ MidiByteArray::MidiByteArray (size_t size, MIDI::byte array[]) for (size_t i = 0; i < size; ++i) { push_back (array[i]); - } + } } MidiByteArray::MidiByteArray (size_t count, MIDI::byte first, ...) diff --git a/libs/surfaces/mackie/midi_byte_array.h b/libs/surfaces/mackie/midi_byte_array.h index 372e48ab90..3d3bcecd28 100644 --- a/libs/surfaces/mackie/midi_byte_array.h +++ b/libs/surfaces/mackie/midi_byte_array.h @@ -49,14 +49,14 @@ class MidiByteArray : public std::vector<MIDI::byte> { public: MidiByteArray() : std::vector<MIDI::byte>() {} - + MidiByteArray( size_t count, MIDI::byte array[] ); /** Accepts a preceding count, and then a list of bytes */ MidiByteArray( size_t count, MIDI::byte first, ... ); - + /// copy the given number of bytes from the given array void copy( size_t count, MIDI::byte arr[] ); }; diff --git a/libs/surfaces/mackie/pot.cc b/libs/surfaces/mackie/pot.cc index e1ddae82f8..3ac991116f 100644 --- a/libs/surfaces/mackie/pot.cc +++ b/libs/surfaces/mackie/pot.cc @@ -45,7 +45,7 @@ Pot::set (float val, bool onoff, Mode mode) // center on if val is "very close" to 0.50 MIDI::byte msg = (val > 0.48 && val < 0.58 ? 1 : 0) << 6; - + // Pot/LED mode msg |= (mode << 4); @@ -57,7 +57,7 @@ Pot::set (float val, bool onoff, Mode mode) if (val < 0){ val = val * -1; } - + // val, but only if off hasn't explicitly been set if (onoff) { if (mode == spread) { @@ -73,4 +73,4 @@ Pot::set (float val, bool onoff, Mode mode) return MidiByteArray (3, 0xb0, 0x20 + id(), msg); } - + diff --git a/libs/surfaces/mackie/strip.cc b/libs/surfaces/mackie/strip.cc index ca5c79e9e0..4528e7b155 100644 --- a/libs/surfaces/mackie/strip.cc +++ b/libs/surfaces/mackie/strip.cc @@ -111,7 +111,7 @@ Strip::Strip (Surface& s, const std::string& name, int index, const map<Button:: _surface->number(), index, Button::id_to_name (bb->bid()), bb->id(), b->second.base_id)); } -} +} Strip::~Strip () { @@ -161,7 +161,7 @@ Strip::set_route (boost::shared_ptr<Route> r, bool /*with_messages*/) } route_connections.drop_connections (); - + _solo->set_control (boost::shared_ptr<AutomationControl>()); _mute->set_control (boost::shared_ptr<AutomationControl>()); _select->set_control (boost::shared_ptr<AutomationControl>()); @@ -181,12 +181,12 @@ Strip::set_route (boost::shared_ptr<Route> r, bool /*with_messages*/) DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Surface %1 strip %2 now mapping route %3\n", _surface->number(), _index, _route->name())); - + _solo->set_control (_route->solo_control()); _mute->set_control (_route->mute_control()); set_vpot_parameter (PanAzimuthAutomation); - + _route->solo_changed.connect (route_connections, MISSING_INVALIDATOR, boost::bind (&Strip::notify_solo_changed, this), ui_context()); _route->listen_changed.connect (route_connections, MISSING_INVALIDATOR, boost::bind (&Strip::notify_solo_changed, this), ui_context()); @@ -200,28 +200,28 @@ Strip::set_route (boost::shared_ptr<Route> r, bool /*with_messages*/) } _route->gain_control()->Changed.connect(route_connections, MISSING_INVALIDATOR, boost::bind (&Strip::notify_gain_changed, this, false), ui_context()); _route->PropertyChanged.connect (route_connections, MISSING_INVALIDATOR, boost::bind (&Strip::notify_property_changed, this, _1), ui_context()); - + boost::shared_ptr<Track> trk = boost::dynamic_pointer_cast<ARDOUR::Track>(_route); - + if (trk) { _recenable->set_control (trk->rec_enable_control()); trk->rec_enable_control()->Changed .connect(route_connections, MISSING_INVALIDATOR, boost::bind (&Strip::notify_record_enable_changed, this), ui_context()); - + } - + // TODO this works when a currently-banked route is made inactive, but not // when a route is activated which should be currently banked. - + _route->active_changed.connect (route_connections, MISSING_INVALIDATOR, boost::bind (&Strip::notify_active_changed, this), ui_context()); _route->DropReferences.connect (route_connections, MISSING_INVALIDATOR, boost::bind (&Strip::notify_route_deleted, this), ui_context()); - + /* Update */ - + notify_all (); /* setup legal VPot modes for this route */ - + build_input_list (_route->input()->n_ports()); build_output_list (_route->output()->n_ports()); @@ -232,11 +232,11 @@ Strip::set_route (boost::shared_ptr<Route> r, bool /*with_messages*/) if (panner) { set<Evoral::Parameter> automatable = panner->what_can_be_automated (); set<Evoral::Parameter>::iterator a; - + if ((a = automatable.find (PanAzimuthAutomation)) != automatable.end()) { possible_pot_parameters.push_back (PanAzimuthAutomation); } - + if ((a = automatable.find (PanWidthAutomation)) != automatable.end()) { possible_pot_parameters.push_back (PanWidthAutomation); } @@ -305,7 +305,7 @@ void Strip::notify_gain_changed (bool force_update) { if (_route) { - + Control* control; if (_surface->mcp().flip_mode() != MackieControlProtocol::Normal) { @@ -315,13 +315,13 @@ Strip::notify_gain_changed (bool force_update) } boost::shared_ptr<AutomationControl> ac = _route->gain_control(); - + float gain_coefficient = ac->get_value(); float normalized_position = ac->internal_to_interface (gain_coefficient); if (force_update || normalized_position != _last_gain_position_written) { - + if (_surface->mcp().flip_mode() != MackieControlProtocol::Normal) { if (!control->in_use()) { _surface->write (_vpot->set (normalized_position, true, Pot::wrap)); @@ -350,13 +350,13 @@ Strip::notify_property_changed (const PropertyChange& what_changed) if (_route) { string line1; string fullname = _route->name(); - + if (fullname.length() <= 6) { line1 = fullname; } else { line1 = PBD::short_version (fullname, 6); } - + _surface->write (display (0, line1)); } } @@ -382,7 +382,7 @@ Strip::notify_panner_azi_changed (bool force_update) } double pos = pannable->pan_azimuth_control->internal_to_interface (pannable->pan_azimuth_control->get_value()); - + if (force_update || pos != _last_pan_azi_position_written) { if (control == _fader) { @@ -392,7 +392,7 @@ Strip::notify_panner_azi_changed (bool force_update) } else if (control == _vpot) { _surface->write (_vpot->set (pos, true, Pot::dot)); } - + queue_parameter_display (PanAzimuthAutomation, pos); queue_display_reset (2000); _last_pan_azi_position_written = pos; @@ -419,12 +419,12 @@ Strip::notify_panner_width_changed (bool force_update) if (!control) { return; - } - + } + double pos = pannable->pan_width_control->internal_to_interface (pannable->pan_width_control->get_value()); - + if (force_update || pos != _last_pan_azi_position_written) { - + if (_surface->mcp().flip_mode() != MackieControlProtocol::Normal) { if (control == _fader) { @@ -436,7 +436,7 @@ Strip::notify_panner_width_changed (bool force_update) } else if (control == _vpot) { _surface->write (_vpot->set (pos, true, Pot::spread)); } - + queue_parameter_display (PanWidthAutomation, pos); queue_display_reset (2000); _last_pan_azi_position_written = pos; @@ -448,9 +448,9 @@ void Strip::select_event (Button&, ButtonState bs) { DEBUG_TRACE (DEBUG::MackieControl, "select button\n"); - + if (bs == press) { - + int ms = _surface->mcp().main_modifier_state(); if (ms & MackieControlProtocol::MODIFIER_CMDALT) { @@ -459,7 +459,7 @@ Strip::select_event (Button&, ButtonState bs) queue_display_reset (1000); return; } - + if (ms & MackieControlProtocol::MODIFIER_SHIFT) { /* reset to default */ boost::shared_ptr<AutomationControl> ac = _fader->control (); @@ -468,14 +468,14 @@ Strip::select_event (Button&, ButtonState bs) } return; } - + DEBUG_TRACE (DEBUG::MackieControl, "add select button on press\n"); - _surface->mcp().add_down_select_button (_surface->number(), _index); + _surface->mcp().add_down_select_button (_surface->number(), _index); _surface->mcp().select_range (); - + } else { DEBUG_TRACE (DEBUG::MackieControl, "remove select button on release\n"); - _surface->mcp().remove_down_select_button (_surface->number(), _index); + _surface->mcp().remove_down_select_button (_surface->number(), _index); } } @@ -485,13 +485,13 @@ Strip::vselect_event (Button&, ButtonState bs) if (bs == press) { int ms = _surface->mcp().main_modifier_state(); - + if (ms & MackieControlProtocol::MODIFIER_SHIFT) { boost::shared_ptr<AutomationControl> ac = _vpot->control (); - + if (ac) { - + /* reset to default/normal value */ ac->set_value (ac->normal()); } @@ -509,7 +509,7 @@ void Strip::fader_touch_event (Button&, ButtonState bs) { DEBUG_TRACE (DEBUG::MackieControl, string_compose ("fader touch, press ? %1\n", (bs == press))); - + if (bs == press) { boost::shared_ptr<AutomationControl> ac = _fader->control (); @@ -522,20 +522,20 @@ Strip::fader_touch_event (Button&, ButtonState bs) _fader->set_in_use (true); _fader->start_touch (_surface->mcp().transport_frame()); - + if (ac) { queue_parameter_display ((AutomationType) ac->parameter().type(), ac->internal_to_interface (ac->get_value())); queue_display_reset (2000); } } - + } else { - + _fader->set_in_use (false); _fader->stop_touch (_surface->mcp().transport_frame(), true); - + } -} +} void @@ -550,12 +550,12 @@ Strip::handle_button (Button& button, ButtonState bs) } DEBUG_TRACE (DEBUG::MackieControl, string_compose ("strip %1 handling button %2 press ? %3\n", _index, button.bid(), (bs == press))); - + switch (button.bid()) { case Button::Select: select_event (button, bs); break; - + case Button::VSelect: vselect_event (button, bs); break; @@ -569,34 +569,34 @@ Strip::handle_button (Button& button, ButtonState bs) if (bs == press) { DEBUG_TRACE (DEBUG::MackieControl, "add button on press\n"); _surface->mcp().add_down_button ((AutomationType) control->parameter().type(), _surface->number(), _index); - + float new_value; int ms = _surface->mcp().main_modifier_state(); - + if (ms & MackieControlProtocol::MODIFIER_SHIFT) { /* reset to default/normal value */ new_value = control->normal(); } else { new_value = control->get_value() ? 0.0 : 1.0; } - + /* get all controls that either have their * button down or are within a range of * several down buttons */ - + MackieControlProtocol::ControlList controls = _surface->mcp().down_controls ((AutomationType) control->parameter().type()); - - + + DEBUG_TRACE (DEBUG::MackieControl, string_compose ("there are %1 buttons down for control type %2, new value = %3\n", controls.size(), control->parameter().type(), new_value)); /* apply change */ - + for (MackieControlProtocol::ControlList::iterator c = controls.begin(); c != controls.end(); ++c) { (*c)->set_value (new_value); } - + } else { DEBUG_TRACE (DEBUG::MackieControl, "remove button on release\n"); _surface->mcp().remove_down_button ((AutomationType) control->parameter().type(), _surface->number(), _index); @@ -629,7 +629,7 @@ Strip::do_parameter_display (AutomationType type, float val) float dB = accurate_coefficient_to_dB (val); snprintf (buf, sizeof (buf), "%6.1f", dB); _surface->write (display (1, buf)); - } + } break; case PanAzimuthAutomation: @@ -691,7 +691,7 @@ Strip::handle_pot (Pot& pot, float delta) /* Pots only emit events when they move, not when they stop moving. So to get a stop event, we need to use a timeout. */ - + boost::shared_ptr<AutomationControl> ac = pot.control(); double p = pot.get_value (); p += delta; @@ -786,12 +786,12 @@ Strip::display (uint32_t line_number, const std::string& line) // sysex header retval << _surface->sysex_hdr(); - + // code for display retval << 0x12; // offset (0 to 0x37 first line, 0x38 to 0x6f for second line) retval << (_index * 7 + (line_number * 0x38)); - + // ascii data to display. @param line is UTF-8 string ascii = Glib::convert_with_fallback (line, "UTF-8", "ISO-8859-1", "_"); string::size_type len = ascii.length(); @@ -804,7 +804,7 @@ Strip::display (uint32_t line_number, const std::string& line) for (int i = len; i < 6; ++i) { retval << ' '; } - + // column spacer, unless it's the right-hand column if (_index < 7) { retval << ' '; @@ -812,7 +812,7 @@ Strip::display (uint32_t line_number, const std::string& line) // sysex trailer retval << MIDI::eox; - + return retval; } @@ -845,7 +845,7 @@ string Strip::vpot_mode_string () const { boost::shared_ptr<AutomationControl> ac = _vpot->control(); - + if (!ac) { return string(); } @@ -900,10 +900,10 @@ Strip::queue_display_reset (uint32_t msecs) struct timeval delta; struct timeval when; gettimeofday (&now, 0); - + delta.tv_sec = msecs/1000; delta.tv_usec = (msecs - ((msecs/1000) * 1000)) * 1000; - + timeradd (&now, &delta, &when); _reset_display_at = (when.tv_sec * 1000000) + when.tv_usec; @@ -923,10 +923,10 @@ Strip::reset_display () } else { _surface->write (blank_display (1)); } - + clear_display_reset (); } - + struct RouteCompareByName { bool operator() (boost::shared_ptr<Route> a, boost::shared_ptr<Route> b) { return a->name().compare (b->name()) < 0; @@ -951,19 +951,19 @@ Strip::build_input_list (const ChanCount& channels) input_bundles.clear (); /* give user bundles first chance at being in the menu */ - + for (ARDOUR::BundleList::iterator i = b->begin(); i != b->end(); ++i) { if (boost::dynamic_pointer_cast<UserBundle> (*i)) { maybe_add_to_bundle_map (input_bundles, *i, true, channels); } } - + for (ARDOUR::BundleList::iterator i = b->begin(); i != b->end(); ++i) { if (boost::dynamic_pointer_cast<UserBundle> (*i) == 0) { maybe_add_to_bundle_map (input_bundles, *i, true, channels); } } - + boost::shared_ptr<ARDOUR::RouteList> routes = _surface->mcp().get_session().get_routes (); RouteList copy = *routes; copy.sort (RouteCompareByName ()); @@ -982,19 +982,19 @@ Strip::build_output_list (const ChanCount& channels) output_bundles.clear (); /* give user bundles first chance at being in the menu */ - + for (ARDOUR::BundleList::iterator i = b->begin(); i != b->end(); ++i) { if (boost::dynamic_pointer_cast<UserBundle> (*i)) { maybe_add_to_bundle_map (output_bundles, *i, false, channels); } } - + for (ARDOUR::BundleList::iterator i = b->begin(); i != b->end(); ++i) { if (boost::dynamic_pointer_cast<UserBundle> (*i) == 0) { maybe_add_to_bundle_map (output_bundles, *i, false, channels); } } - + boost::shared_ptr<ARDOUR::RouteList> routes = _surface->mcp().get_session().get_routes (); RouteList copy = *routes; copy.sort (RouteCompareByName ()); @@ -1141,21 +1141,21 @@ Strip::notify_metering_state_changed() if (!_route || !_meter) { return; } - + bool transport_is_rolling = (_surface->mcp().get_transport_speed () != 0.0f); bool metering_active = _surface->mcp().metering_active (); - + if ((_transport_is_rolling == transport_is_rolling) && (_metering_active == metering_active)) { return; } - + _meter->notify_metering_state_changed (*_surface, transport_is_rolling, metering_active); - + if (!transport_is_rolling || !metering_active) { notify_property_changed (PBD::PropertyChange (ARDOUR::Properties::name)); notify_panner_azi_changed (true); } - + _transport_is_rolling = transport_is_rolling; _metering_active = metering_active; } diff --git a/libs/surfaces/mackie/strip.h b/libs/surfaces/mackie/strip.h index 4099dce8af..c2cbfc2ee6 100644 --- a/libs/surfaces/mackie/strip.h +++ b/libs/surfaces/mackie/strip.h @@ -56,7 +56,7 @@ public: void add (Control & control); int index() const { return _index; } // zero based - + void set_route (boost::shared_ptr<ARDOUR::Route>, bool with_messages = true); // call all signal handlers manually @@ -117,7 +117,7 @@ private: void notify_panner_width_changed (bool force_update = true); void notify_active_changed (); void notify_route_deleted (); - + void update_automation (); void update_meter (); @@ -136,7 +136,7 @@ private: void do_parameter_display (ARDOUR::AutomationType, float val); void queue_parameter_display (ARDOUR::AutomationType, float val); - + typedef std::map<std::string,boost::shared_ptr<ARDOUR::Bundle> > BundleMap; BundleMap input_bundles; BundleMap output_bundles; diff --git a/libs/surfaces/mackie/surface.cc b/libs/surfaces/mackie/surface.cc index 51b03f86a3..5bbb081487 100644 --- a/libs/surfaces/mackie/surface.cc +++ b/libs/surfaces/mackie/surface.cc @@ -90,7 +90,7 @@ Surface::Surface (MackieControlProtocol& mcp, const std::string& device_name, ui , _last_master_gain_written (-0.0f) { DEBUG_TRACE (DEBUG::MackieControl, "Surface::Surface init\n"); - + try { _port = new SurfacePort (*this); } catch (...) { @@ -114,12 +114,12 @@ Surface::Surface (MackieControlProtocol& mcp, const std::string& device_name, ui } uint32_t n = _mcp.device_info().strip_cnt(); - + if (n) { init_strips (n); DEBUG_TRACE (DEBUG::MackieControl, "init_strips done\n"); } - + connect_to_signals (); DEBUG_TRACE (DEBUG::MackieControl, "Surface::Surface done\n"); @@ -135,12 +135,12 @@ Surface::~Surface () for (Groups::iterator it = groups.begin(); it != groups.end(); ++it) { delete it->second; } - + // delete controls for (Controls::iterator it = controls.begin(); it != controls.end(); ++it) { delete *it; } - + delete _jog_wheel; delete _port; @@ -205,7 +205,7 @@ void Surface::init_controls() { Group* group; - + DEBUG_TRACE (DEBUG::MackieControl, "Surface::init_controls: creating groups\n"); groups["assignment"] = new Group ("assignment"); groups["automation"] = new Group ("automation"); @@ -220,7 +220,7 @@ Surface::init_controls() groups["transport"] = new Group ("transport"); groups["user"] = new Group ("user"); groups["utilities"] = new Group ("utilities"); - + DEBUG_TRACE (DEBUG::MackieControl, "Surface::init_controls: creating jog wheel\n"); if (_mcp.device_info().has_jog_wheel()) { _jog_wheel = new Mackie::JogWheel (_mcp); @@ -251,11 +251,11 @@ Surface::init_strips (uint32_t n) for (uint32_t i = 0; i < n; ++i) { char name[32]; - + snprintf (name, sizeof (name), "strip_%d", (8* _number) + i); Strip* strip = new Strip (*this, name, i, strip_buttons); - + groups[name] = strip; strips.push_back (strip); } @@ -265,17 +265,17 @@ void Surface::setup_master () { boost::shared_ptr<Route> m; - + if ((m = _mcp.get_session().monitor_out()) == 0) { m = _mcp.get_session().master_out(); } - + if (!m) { return; } _master_fader = dynamic_cast<Fader*> (Fader::factory (*this, _mcp.device_info().strip_cnt(), "master", *groups["master"])); - + _master_fader->set_control (m->gain_control()); m->gain_control()->Changed.connect (*this, MISSING_INVALIDATOR, boost::bind (&Surface::master_gain_changed, this), ui_context()); @@ -384,7 +384,7 @@ Surface::connect_to_signals () } // Master fader p->channel_pitchbend[_mcp.device_info().strip_cnt()].connect_same_thread (*this, boost::bind (&Surface::handle_midi_pitchbend_message, this, _1, _2, _mcp.device_info().strip_cnt())); - + _connected = true; } } @@ -402,7 +402,7 @@ Surface::handle_midi_pitchbend_message (MIDI::Parser&, MIDI::pitchbend_t pb, uin DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Surface::handle_midi_pitchbend_message on port %3, fader = %1 value = %2 (%4)\n", fader_id, pb, _number, pb/16384.0)); - + if (_mcp.device_info().no_handshake()) { turn_it_on (); } @@ -437,7 +437,7 @@ void Surface::handle_midi_note_on_message (MIDI::Parser &, MIDI::EventTwoBytes* ev) { DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Surface::handle_midi_note_on_message %1 = %2\n", (int) ev->note_number, (int) ev->velocity)); - + if (_mcp.device_info().no_handshake()) { turn_it_on (); } @@ -445,7 +445,7 @@ Surface::handle_midi_note_on_message (MIDI::Parser &, MIDI::EventTwoBytes* ev) if (_mcp.device_info().device_type() == DeviceInfo::HUI && ev->note_number == 0 && ev->velocity == 127) { turn_it_on (); } - + /* fader touch sense is given by "buttons" 0xe..0xe7 and 0xe8 for the * master. */ @@ -516,7 +516,7 @@ Surface::handle_midi_controller_message (MIDI::Parser &, MIDI::EventTwoBytes* ev } else { delta = sign * (ticks / (float) 0x3f); } - + if (!pot) { if (ev->controller_number == Jog::ID && _jog_wheel) { @@ -595,16 +595,16 @@ calculate_challenge_response (MidiByteArray::iterator begin, MidiByteArray::iter MidiByteArray l; back_insert_iterator<MidiByteArray> back (l); copy (begin, end, back); - + MidiByteArray retval; - + // this is how to calculate the response to the challenge. // from the Logic docs. retval << (0x7f & (l[0] + (l[1] ^ 0xa) - l[3])); retval << (0x7f & ( (l[2] >> l[3]) ^ (l[0] + l[3]))); retval << (0x7f & ((l[3] - (l[2] << 2)) ^ (l[0] | l[1]))); retval << (0x7f & (l[1] - l[2] + (0xf0 ^ (l[3] << 4)))); - + return retval; } @@ -613,7 +613,7 @@ MidiByteArray Surface::host_connection_query (MidiByteArray & bytes) { MidiByteArray response; - + if (bytes[4] != 0x10 && bytes[4] != 0x11) { /* not a Logic Control device - no response required */ return response; @@ -621,7 +621,7 @@ Surface::host_connection_query (MidiByteArray & bytes) // handle host connection query DEBUG_TRACE (DEBUG::MackieControl, string_compose ("host connection query: %1\n", bytes)); - + if (bytes.size() != 18) { cerr << "expecting 18 bytes, read " << bytes << " from " << _port->input_port().name() << endl; return response; @@ -639,14 +639,14 @@ MidiByteArray Surface::host_connection_confirmation (const MidiByteArray & bytes) { DEBUG_TRACE (DEBUG::MackieControl, string_compose ("host_connection_confirmation: %1\n", bytes)); - + // decode host connection confirmation if (bytes.size() != 14) { ostringstream os; os << "expecting 14 bytes, read " << bytes << " from " << _port->input_port().name(); throw MackieControlException (os.str()); } - + // send version request return MidiByteArray (2, 0x13, 0x00); } @@ -725,7 +725,7 @@ Surface::zero_all () if (_mcp.device_info().has_timecode_display ()) { display_timecode (string (10, '0'), string (10, ' ')); } - + if (_mcp.device_info().has_two_character_display()) { show_two_char_display (string (2, '0'), string (2, ' ')); } @@ -839,13 +839,13 @@ Surface::show_two_char_display (const std::string & msg, const std::string & dot if (_stype != mcu || !_mcp.device_info().has_two_character_display() || msg.length() != 2 || dots.length() != 2) { return; } - + MidiByteArray right (3, 0xb0, 0x4b, 0x00); MidiByteArray left (3, 0xb0, 0x4a, 0x00); - + right[2] = translate_seven_segment (msg[0]) + (dots[0] == '.' ? 0x40 : 0x00); left[2] = translate_seven_segment (msg[1]) + (dots[1] == '.' ? 0x40 : 0x00); - + _port->write (right); _port->write (left); } @@ -866,7 +866,7 @@ Surface::display_timecode (const std::string & timecode, const std::string & las } // if there's no change, send nothing, not even sysex header if (timecode == last_timecode) return; - + // length sanity checking string local_timecode = timecode; @@ -879,7 +879,7 @@ Surface::display_timecode (const std::string & timecode, const std::string & las while (local_timecode.length() < 10) { local_timecode += " "; } - + // translate characters. // Only the characters that actually changed are sent. int position = 0x3f; @@ -949,7 +949,7 @@ Surface::update_view_mode_display () } if (id >= 0) { - + /* we are attempting to turn a global button/LED on */ map<int,Control*>::iterator x = controls_by_device_independent_id.find (id); @@ -999,7 +999,7 @@ Surface::next_jog_mode () void Surface::set_jog_mode (JogWheel::Mode) { -} +} bool Surface::route_is_locked_to_strip (boost::shared_ptr<Route> r) const @@ -1065,13 +1065,13 @@ Surface::recalibrate_faders () msg[4] = 0x11; /* reset Logic Control XT */ _port->write (msg); } -} +} void Surface::set_touch_sensitivity (int sensitivity) { /* NOTE: assumed called from GUI code, hence sleep() */ - + /* sensitivity already clamped by caller */ if (_port) { diff --git a/libs/surfaces/mackie/surface.h b/libs/surfaces/mackie/surface.h index 7ca620d3b6..1c989ec518 100644 --- a/libs/surfaces/mackie/surface.h +++ b/libs/surfaces/mackie/surface.h @@ -62,7 +62,7 @@ public: std::map<int,Led*> leds; std::map<int,Meter*> meters; std::map<int,Control*> controls_by_device_independent_id; - + Mackie::JogWheel* jog_wheel() const { return _jog_wheel; } Fader* master_fader() const { return _master_fader; } @@ -88,7 +88,7 @@ public: void periodic (uint64_t now_usecs); void redisplay (); void hui_heartbeat (); - + void handle_midi_pitchbend_message (MIDI::Parser&, MIDI::pitchbend_t, uint32_t channel_id); void handle_midi_controller_message (MIDI::Parser&, MIDI::EventTwoBytes*); void handle_midi_note_on_message (MIDI::Parser&, MIDI::EventTwoBytes*); @@ -105,7 +105,7 @@ public: /// display an indicator of the first switched-in Route. Do nothing by default. void display_bank_start (uint32_t /*current_bank*/); - + /// called from MackieControlProtocol::zero_all to turn things off void zero_all (); void zero_controls (); @@ -122,7 +122,7 @@ public: void recalibrate_faders (); void toggle_backlight (); void set_touch_sensitivity (int); - + /** This is used to calculate the clicks per second that define a transport speed of 1.0 for the jog wheel. 100.0 is 10 clicks @@ -144,7 +144,7 @@ public: // be two characters void show_two_char_display (const std::string & msg, const std::string & dots = " "); void show_two_char_display (unsigned int value, const std::string & dots = " "); - + void update_view_mode_display (); void update_flip_mode_display (); @@ -162,7 +162,7 @@ public: int set_state (const XMLNode&, int version); protected: - + private: MackieControlProtocol& _mcp; SurfacePort* _port; diff --git a/libs/surfaces/mackie/surface_port.cc b/libs/surfaces/mackie/surface_port.cc index 4a8cff6e16..3129b5a1fd 100644 --- a/libs/surfaces/mackie/surface_port.cc +++ b/libs/surfaces/mackie/surface_port.cc @@ -57,7 +57,7 @@ SurfacePort::SurfacePort (Surface& s) _output_port = _input_port; } else { - + _async_in = AudioEngine::instance()->register_input_port (DataType::MIDI, string_compose (_("%1 in"), _surface->name()), true); _async_out = AudioEngine::instance()->register_output_port (DataType::MIDI, string_compose (_("%1 out"), _surface->name()), true); @@ -81,7 +81,7 @@ SurfacePort::~SurfacePort() AudioEngine::instance()->unregister_port (_async_in); _async_in.reset ((ARDOUR::Port*) 0); } - + if (_async_out) { _output_port->drain (10000); DEBUG_TRACE (DEBUG::MackieControl, string_compose ("unregistering output port %1\n", _async_out->name())); @@ -106,7 +106,7 @@ SurfacePort::get_state () child = new XMLNode (X_("Input")); child->add_child_nocopy (_async_in->get_state()); node->add_child_nocopy (*child); - + child = new XMLNode (X_("Output")); child->add_child_nocopy (_async_out->get_state()); @@ -150,7 +150,7 @@ string fetch_errmsg (int error_number) char * msg = strerror (error_number); return msg; } - + int SurfacePort::write (const MidiByteArray & mba) { @@ -164,7 +164,7 @@ SurfacePort::write (const MidiByteArray & mba) if (mba[0] != 0xf0 && mba.size() > 3) { std::cerr << "TOO LONG WRITE: " << mba << std::endl; } - + /* this call relies on std::vector<T> using contiguous storage. not * actually guaranteed by the standard, but way, way beyond likely. */ diff --git a/libs/surfaces/mackie/surface_port.h b/libs/surfaces/mackie/surface_port.h index d22e46f4bf..2c78e692a7 100644 --- a/libs/surfaces/mackie/surface_port.h +++ b/libs/surfaces/mackie/surface_port.h @@ -58,7 +58,7 @@ public: /// an easier way to output bytes via midi int write (const MidiByteArray&); - + MIDI::Port& input_port() const { return *_input_port; } MIDI::Port& output_port() const { return *_output_port; } @@ -73,7 +73,7 @@ private: MIDI::Port* _output_port; boost::shared_ptr<ARDOUR::Port> _async_in; boost::shared_ptr<ARDOUR::Port> _async_out; -}; +}; std::ostream& operator << (std::ostream& , const SurfacePort& port); diff --git a/libs/surfaces/mackie/timer.h b/libs/surfaces/mackie/timer.h index 31470a92c3..423b962ce8 100644 --- a/libs/surfaces/mackie/timer.h +++ b/libs/surfaces/mackie/timer.h @@ -36,7 +36,7 @@ namespace Mackie class Timer { public: - + /** start the timer running if true, or just create the object if false. @@ -46,7 +46,7 @@ public: if ( shouldStart ) start(); } - + /** Start the timer running. Return the current timestamp, in milliseconds */ @@ -81,7 +81,7 @@ public: return (_stop - _start) / 1000; } } - + /** Call stop and then start. Return the value from stop. */ diff --git a/libs/surfaces/mackie/types.h b/libs/surfaces/mackie/types.h index fd1b225c65..87676ae0f6 100644 --- a/libs/surfaces/mackie/types.h +++ b/libs/surfaces/mackie/types.h @@ -41,19 +41,19 @@ public: LedState (state_t state): _state (state) {} LedState& operator= (state_t s) { _state = s; return *this; } - + bool operator == (const LedState & other) const { return state() == other.state(); } - + bool operator != (const LedState & other) const { return state() != other.state(); } - + state_t state() const { return _state; } - + private: state_t _state; }; @@ -72,27 +72,27 @@ enum ButtonState { neither = -1, release = 0, press = 1 }; struct ControlState { ControlState(): pos(0.0), sign(0), delta(0.0), ticks(0), led_state(off), button_state(neither) {} - + ControlState (LedState ls): pos(0.0), delta(0.0), led_state(ls), button_state(neither) {} - + // Note that this sets both pos and delta to the flt value ControlState (LedState ls, float flt): pos(flt), delta(flt), ticks(0), led_state(ls), button_state(neither) {} ControlState (float flt): pos(flt), delta(flt), ticks(0), led_state(none), button_state(neither) {} ControlState (float flt, unsigned int tcks): pos(flt), delta(flt), ticks(tcks), led_state(none), button_state(neither) {} ControlState (ButtonState bs): pos(0.0), delta(0.0), ticks(0), led_state(none), button_state(bs) {} - + /// For faders. Between 0 and 1. float pos; - + /// For pots. Sign. Either -1 or 1; int sign; /// For pots. Signed value of total movement. Between 0 and 1 float delta; - + /// For pots. Unsigned number of ticks. Usually between 1 and 16. unsigned int ticks; - + LedState led_state; ButtonState button_state; }; |