From: Paul Davis Date: Wed, 25 Apr 2012 04:42:01 +0000 (+0000) Subject: MCP: various fixes, plus removal of ui_bind() (just for mackie code) X-Git-Tag: 3.0~1607 X-Git-Url: https://main.carlh.net/gitweb/?a=commitdiff_plain;h=b31400207efae605c135ce9d7e2af31305f04da6;p=ardour.git MCP: various fixes, plus removal of ui_bind() (just for mackie code) git-svn-id: svn://localhost/ardour2/branches/3.0@12086 d708f5d6-7413-0410-9779-e7cbd77b26cf --- diff --git a/libs/surfaces/mackie/device_info.cc b/libs/surfaces/mackie/device_info.cc index 93800aa43b..ba14d9f8fd 100644 --- a/libs/surfaces/mackie/device_info.cc +++ b/libs/surfaces/mackie/device_info.cc @@ -44,7 +44,6 @@ DeviceInfo::DeviceInfo() , _extenders (0) , _has_two_character_display (true) , _has_master_fader (true) - , _has_segmented_display (false) , _has_timecode_display (true) , _has_global_controls (true) , _has_jog_wheel (true) @@ -238,40 +237,44 @@ DeviceInfo::set_state (const XMLNode& node, int /* version */) } } - if ((child = node.child ("DisplaySegments")) != 0) { - if ((prop = child->property ("value")) != 0) { - _has_segmented_display = string_is_affirmative (prop->value()); - } - } - if ((child = node.child ("TimecodeDisplay")) != 0) { if ((prop = child->property ("value")) != 0) { _has_timecode_display = string_is_affirmative (prop->value()); } + } else { + _has_timecode_display = false; } if ((child = node.child ("GlobalControls")) != 0) { if ((prop = child->property ("value")) != 0) { _has_global_controls = string_is_affirmative (prop->value()); } + } else { + _has_global_controls = false; } if ((child = node.child ("JogWheel")) != 0) { if ((prop = child->property ("value")) != 0) { _has_jog_wheel = string_is_affirmative (prop->value()); } + } else { + _has_jog_wheel = false; } if ((child = node.child ("TouchSenseFaders")) != 0) { if ((prop = child->property ("value")) != 0) { _has_touch_sense_faders = string_is_affirmative (prop->value()); } + } else { + _has_touch_sense_faders = false; } if ((child = node.child ("UsesIPMIDI")) != 0) { if ((prop = child->property ("value")) != 0) { _uses_ipmidi = string_is_affirmative (prop->value()); } + } else { + _uses_ipmidi = false; } if ((child = node.child ("LogicControlButtons")) != 0) { @@ -364,12 +367,6 @@ DeviceInfo::has_two_character_display() const return _has_two_character_display; } -bool -DeviceInfo::has_segmented_display() const -{ - return _has_segmented_display; -} - bool DeviceInfo::has_timecode_display () const { diff --git a/libs/surfaces/mackie/device_info.h b/libs/surfaces/mackie/device_info.h index 4071fcffc7..4366cd09b1 100644 --- a/libs/surfaces/mackie/device_info.h +++ b/libs/surfaces/mackie/device_info.h @@ -62,7 +62,6 @@ class DeviceInfo uint32_t extenders() const; bool has_two_character_display() const; bool has_master_fader () const; - bool has_segmented_display() const; bool has_timecode_display() const; bool has_global_controls() const; bool has_jog_wheel () const; @@ -81,7 +80,6 @@ class DeviceInfo uint32_t _extenders; bool _has_two_character_display; bool _has_master_fader; - bool _has_segmented_display; bool _has_timecode_display; bool _has_global_controls; bool _has_jog_wheel; diff --git a/libs/surfaces/mackie/gui.cc b/libs/surfaces/mackie/gui.cc index 2136a64d22..409fd75831 100644 --- a/libs/surfaces/mackie/gui.cc +++ b/libs/surfaces/mackie/gui.cc @@ -72,13 +72,15 @@ MackieControlProtocolGUI::MackieControlProtocolGUI (MackieControlProtocol& p) , touch_sensitivity_adjustment (0, 0, 9, 1, 4) , touch_sensitivity_scale (touch_sensitivity_adjustment) , recalibrate_fader_button (_("Recalibrate Faders")) + , ipmidi_base_port_adjustment (MIDI::IPMIDIPort::lowest_ipmidi_port_default, 0, 32767, 1, 1000) + , ipmidi_base_port_spinner (ipmidi_base_port_adjustment) { Gtk::Label* l; Gtk::Alignment* align; set_border_width (12); - Gtk::Table* table = Gtk::manage (new Gtk::Table (2, 7)); + Gtk::Table* table = Gtk::manage (new Gtk::Table (2, 8)); table->set_row_spacings (4); table->set_col_spacings (6); l = manage (new Gtk::Label (_("Device Type:"))); @@ -133,6 +135,13 @@ MackieControlProtocolGUI::MackieControlProtocolGUI (MackieControlProtocol& p) table->attach (touch_sensitivity_scale, 1, 2, 5, 6, AttachOptions(FILL|EXPAND), AttachOptions (0)); table->attach (recalibrate_fader_button, 1, 2, 6, 7, AttachOptions(FILL|EXPAND), AttachOptions (0)); + l = manage (new Gtk::Label (_("ipMIDI Port (lowest)"))); + l->set_alignment (1.0, 0.5); + table->attach (*l, 0, 1, 7, 8, AttachOptions(FILL|EXPAND), AttachOptions (0)); + table->attach (ipmidi_base_port_spinner, 1, 2, 7, 8, AttachOptions(FILL|EXPAND), AttachOptions (0)); + + ipmidi_base_port_spinner.set_sensitive (_cp.device_info().uses_ipmidi()); + vector profiles; profiles.push_back ("default"); @@ -474,6 +483,12 @@ void MackieControlProtocolGUI::surface_combo_changed () { _cp.set_device (_surface_combo.get_active_text()); + + /* update ipMIDI field */ + + cerr << "New device called " << _cp.device_info().name() << " with ipMIDI ? " << _cp.device_info().uses_ipmidi() << endl; + + ipmidi_base_port_spinner.set_sensitive (_cp.device_info().uses_ipmidi()); } void diff --git a/libs/surfaces/mackie/gui.h b/libs/surfaces/mackie/gui.h index 6255702e7b..f8268b9e35 100644 --- a/libs/surfaces/mackie/gui.h +++ b/libs/surfaces/mackie/gui.h @@ -102,5 +102,7 @@ class MackieControlProtocolGUI : public Gtk::Notebook Gtk::Adjustment touch_sensitivity_adjustment; Gtk::HScale touch_sensitivity_scale; Gtk::Button recalibrate_fader_button; + Gtk::Adjustment ipmidi_base_port_adjustment; + Gtk::SpinButton ipmidi_base_port_spinner; }; diff --git a/libs/surfaces/mackie/mackie_control_protocol.cc b/libs/surfaces/mackie/mackie_control_protocol.cc index 6817564244..f93379f3e7 100644 --- a/libs/surfaces/mackie/mackie_control_protocol.cc +++ b/libs/surfaces/mackie/mackie_control_protocol.cc @@ -78,8 +78,6 @@ using namespace Glib; #include "pbd/abstract_ui.cc" // instantiate template -#define ui_bind(f, ...) boost::protect (boost::bind (f, __VA_ARGS__)) - const int MackieControlProtocol::MODIFIER_OPTION = 0x1; const int MackieControlProtocol::MODIFIER_CONTROL = 0x2; const int MackieControlProtocol::MODIFIER_SHIFT = 0x4; @@ -115,7 +113,7 @@ MackieControlProtocol::MackieControlProtocol (Session& session) set_device (Config->get_mackie_device_name()); set_profile (Config->get_mackie_device_profile()); - TrackSelectionChanged.connect (gui_connections, MISSING_INVALIDATOR, ui_bind (&MackieControlProtocol::gui_track_selection_changed, this, _1), this); + TrackSelectionChanged.connect (gui_connections, MISSING_INVALIDATOR, boost::bind (&MackieControlProtocol::gui_track_selection_changed, this, _1), this); _instance = this; @@ -497,24 +495,24 @@ void MackieControlProtocol::connect_session_signals() { // receive routes added - session->RouteAdded.connect(session_connections, MISSING_INVALIDATOR, ui_bind (&MackieControlProtocol::notify_route_added, this, _1), this); + session->RouteAdded.connect(session_connections, MISSING_INVALIDATOR, boost::bind (&MackieControlProtocol::notify_route_added, this, _1), this); // receive record state toggled - session->RecordStateChanged.connect(session_connections, MISSING_INVALIDATOR, ui_bind (&MackieControlProtocol::notify_record_state_changed, this), this); + session->RecordStateChanged.connect(session_connections, MISSING_INVALIDATOR, boost::bind (&MackieControlProtocol::notify_record_state_changed, this), this); // receive transport state changed - session->TransportStateChange.connect(session_connections, MISSING_INVALIDATOR, ui_bind (&MackieControlProtocol::notify_transport_state_changed, this), this); - session->TransportLooped.connect (session_connections, MISSING_INVALIDATOR, ui_bind (&MackieControlProtocol::notify_loop_state_changed, this), this); + session->TransportStateChange.connect(session_connections, MISSING_INVALIDATOR, boost::bind (&MackieControlProtocol::notify_transport_state_changed, this), this); + session->TransportLooped.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&MackieControlProtocol::notify_loop_state_changed, this), this); // receive punch-in and punch-out - Config->ParameterChanged.connect(session_connections, MISSING_INVALIDATOR, ui_bind (&MackieControlProtocol::notify_parameter_changed, this, _1), this); - session->config.ParameterChanged.connect (session_connections, MISSING_INVALIDATOR, ui_bind (&MackieControlProtocol::notify_parameter_changed, this, _1), this); + Config->ParameterChanged.connect(session_connections, MISSING_INVALIDATOR, boost::bind (&MackieControlProtocol::notify_parameter_changed, this, _1), this); + session->config.ParameterChanged.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&MackieControlProtocol::notify_parameter_changed, this, _1), this); // receive rude solo changed - session->SoloActive.connect(session_connections, MISSING_INVALIDATOR, ui_bind (&MackieControlProtocol::notify_solo_active_changed, this, _1), this); + session->SoloActive.connect(session_connections, MISSING_INVALIDATOR, boost::bind (&MackieControlProtocol::notify_solo_active_changed, this, _1), this); // make sure remote id changed signals reach here // see also notify_route_added Sorted sorted = get_sorted_routes(); for (Sorted::iterator it = sorted.begin(); it != sorted.end(); ++it) { - (*it)->RemoteControlIDChanged.connect (route_connections, MISSING_INVALIDATOR, ui_bind(&MackieControlProtocol::notify_remote_id_changed, this), this); + (*it)->RemoteControlIDChanged.connect (route_connections, MISSING_INVALIDATOR, boost::bind (&MackieControlProtocol::notify_remote_id_changed, this), this); } } @@ -544,6 +542,11 @@ MackieControlProtocol::set_device (const string& device_name) return; } + if (_active) { + clear_ports (); + surfaces.clear (); + } + _device_info = d->second; /* store it away in a global location */ @@ -551,8 +554,6 @@ MackieControlProtocol::set_device (const string& device_name) Config->set_mackie_device_name (device_name); if (_active) { - clear_ports (); - surfaces.clear (); create_surfaces (); switch_banks (0, true); } @@ -794,7 +795,7 @@ MackieControlProtocol::notify_route_added (ARDOUR::RouteList & rl) typedef ARDOUR::RouteList ARS; for (ARS::iterator it = rl.begin(); it != rl.end(); ++it) { - (*it)->RemoteControlIDChanged.connect (route_connections, MISSING_INVALIDATOR, ui_bind (&MackieControlProtocol::notify_remote_id_changed, this), this); + (*it)->RemoteControlIDChanged.connect (route_connections, MISSING_INVALIDATOR, boost::bind (&MackieControlProtocol::notify_remote_id_changed, this), this); } } diff --git a/libs/surfaces/mackie/strip.cc b/libs/surfaces/mackie/strip.cc index fc9e690c87..6f3ed10bad 100644 --- a/libs/surfaces/mackie/strip.cc +++ b/libs/surfaces/mackie/strip.cc @@ -59,7 +59,6 @@ using namespace ARDOUR; using namespace PBD; #define ui_context() MackieControlProtocol::instance() /* a UICallback-derived object that specifies the event loop for signal handling */ -#define ui_bind(f, ...) boost::protect (boost::bind (f, __VA_ARGS__)) Strip::Strip (Surface& s, const std::string& name, int index, const map& strip_buttons) : Group (name) @@ -83,14 +82,12 @@ Strip::Strip (Surface& s, const std::string& name, int index, const map (Pot::factory (*_surface, Pot::ID + index, "vpot", *this)); _meter = dynamic_cast (Meter::factory (*_surface, index, "meter", *this)); -#ifndef NDEBUG for (map::const_iterator b = strip_buttons.begin(); b != strip_buttons.end(); ++b) { Button* bb = dynamic_cast (Button::factory (*_surface, b->first, b->second.base_id + index, b->second.name, *this)); DEBUG_TRACE (DEBUG::MackieControl, string_compose ("surface %1 strip %2 new button BID %3 id %4 from base %5\n", _surface->number(), index, Button::id_to_name (bb->bid()), bb->id(), b->second.base_id)); } -#endif } Strip::~Strip () @@ -165,23 +162,23 @@ Strip::set_route (boost::shared_ptr r, bool with_messages) set_vpot_parameter (PanAzimuthAutomation); - _route->solo_control()->Changed.connect(route_connections, MISSING_INVALIDATOR, ui_bind (&Strip::notify_solo_changed, this), ui_context()); - _route->mute_control()->Changed.connect(route_connections, MISSING_INVALIDATOR, ui_bind (&Strip::notify_mute_changed, this), ui_context()); + _route->solo_control()->Changed.connect(route_connections, MISSING_INVALIDATOR, boost::bind (&Strip::notify_solo_changed, this), ui_context()); + _route->mute_control()->Changed.connect(route_connections, MISSING_INVALIDATOR, boost::bind (&Strip::notify_mute_changed, this), ui_context()); boost::shared_ptr pannable = _route->pannable(); if (pannable) { - pannable->pan_azimuth_control->Changed.connect(route_connections, MISSING_INVALIDATOR, ui_bind (&Strip::notify_panner_azi_changed, this, false), ui_context()); - pannable->pan_width_control->Changed.connect(route_connections, MISSING_INVALIDATOR, ui_bind (&Strip::notify_panner_width_changed, this, false), ui_context()); + pannable->pan_azimuth_control->Changed.connect(route_connections, MISSING_INVALIDATOR, boost::bind (&Strip::notify_panner_azi_changed, this, false), ui_context()); + pannable->pan_width_control->Changed.connect(route_connections, MISSING_INVALIDATOR, boost::bind (&Strip::notify_panner_width_changed, this, false), ui_context()); } - _route->gain_control()->Changed.connect(route_connections, MISSING_INVALIDATOR, ui_bind (&Strip::notify_gain_changed, this, false), ui_context()); - _route->PropertyChanged.connect (route_connections, MISSING_INVALIDATOR, ui_bind (&Strip::notify_property_changed, this, _1), ui_context()); + _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 trk = boost::dynamic_pointer_cast(_route); if (trk) { _recenable->set_control (trk->rec_enable_control()); - trk->rec_enable_control()->Changed .connect(route_connections, MISSING_INVALIDATOR, ui_bind (&Strip::notify_record_enable_changed, this), ui_context()); + trk->rec_enable_control()->Changed .connect(route_connections, MISSING_INVALIDATOR, boost::bind (&Strip::notify_record_enable_changed, this), ui_context()); } @@ -189,8 +186,8 @@ Strip::set_route (boost::shared_ptr r, bool with_messages) // 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, ui_bind (&Strip::notify_active_changed, this), ui_context()); - _route->DropReferences.connect (route_connections, MISSING_INVALIDATOR, ui_bind (&Strip::notify_route_deleted, this), ui_context()); + _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 */ diff --git a/libs/surfaces/mackie/surface.cc b/libs/surfaces/mackie/surface.cc index e2c364b523..7c604138c3 100644 --- a/libs/surfaces/mackie/surface.cc +++ b/libs/surfaces/mackie/surface.cc @@ -42,7 +42,6 @@ using ARDOUR::Pannable; using ARDOUR::AutomationControl; #define ui_context() MackieControlProtocol::instance() /* a UICallback-derived object that specifies the event loop for signal handling */ -#define ui_bind(f, ...) boost::protect (boost::bind (f, __VA_ARGS__)) // The MCU sysex header.4th byte Will be overwritten // when we get an incoming sysex that identifies @@ -205,7 +204,7 @@ Surface::setup_master () } _master_fader->set_control (m->gain_control()); - m->gain_control()->Changed.connect (*this, MISSING_INVALIDATOR, ui_bind (&Surface::master_gain_changed, this), ui_context()); + m->gain_control()->Changed.connect (*this, MISSING_INVALIDATOR, boost::bind (&Surface::master_gain_changed, this), ui_context()); } void diff --git a/libs/surfaces/mackie/surface_port.cc b/libs/surfaces/mackie/surface_port.cc index 645da67b43..77d71b1a6a 100644 --- a/libs/surfaces/mackie/surface_port.cc +++ b/libs/surfaces/mackie/surface_port.cc @@ -52,6 +52,8 @@ using namespace PBD; */ SurfacePort::SurfacePort (Surface& s) : _surface (&s) + , _input_port (0) + , _output_port (0) { if (_surface->mcp().device_info().uses_ipmidi()) { _input_port = new MIDI::IPMIDIPort (MIDI::IPMIDIPort::lowest_ipmidi_port_default+_surface->number());