MCP: rename raw_id() to id(); add missign modifier_state() function
authorPaul Davis <paul@linuxaudiosystems.com>
Wed, 11 Apr 2012 16:31:23 +0000 (16:31 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Wed, 11 Apr 2012 16:31:23 +0000 (16:31 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@11907 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/surfaces/mackie/controls.cc
libs/surfaces/mackie/controls.h
libs/surfaces/mackie/fader.cc
libs/surfaces/mackie/led.cc
libs/surfaces/mackie/mackie_control_protocol.cc
libs/surfaces/mackie/mackie_control_protocol.h
libs/surfaces/mackie/meter.cc
libs/surfaces/mackie/pot.cc
libs/surfaces/mackie/strip.cc
libs/surfaces/mackie/surface.cc

index 6c9fb559f486d3a5a64342d09fb6c156037a44a3..9b546f00cf60e3580b99e5e3a485f8d1590551a7 100644 (file)
@@ -73,7 +73,7 @@ ostream & Mackie::operator <<  (ostream & os, const Mackie::Control & control)
        os << " { ";
        os << "name: " << control.name();
        os << ", ";
-       os << "raw_id: " << "0x" << setw(2) << setfill('0') << hex << control.raw_id() << setfill(' ');
+       os << "id: " << "0x" << setw(2) << setfill('0') << hex << control.id() << setfill(' ');
        os << ", ";
        os << "group: " << control.group().name();
        os << " }";
index e3fe7ca131a7ae4fdd323a6f1e35eb91d7426e87..546bd8bd25215e1ca68d19bf3f62dc2b6fb01bd0 100644 (file)
@@ -43,16 +43,10 @@ public:
        Control (int id, std::string name, Group& group);
        virtual ~Control() {}
        
-       /// the value of the second bytes of the message. It's
-       /// the id of the control, but only guaranteed to be
-       /// unique within the control type.
-       int raw_id() const { return _id; }
-
+       int id() const { return _id; }
        const std::string & name() const  { return _name; }
        Group & group() const { return _group; }
 
-       virtual bool accepts_feedback() const  { return true; }
-       
        bool in_use () const;
        void set_in_use (bool);
        
index 9a44f8ef9bbe0607d6b81b68868dd5bd7b7a6e95..bcb8f73ca6c9a776bae4a7f9d4c0280782a951e1 100644 (file)
@@ -45,5 +45,5 @@ MidiByteArray
 Fader::update_message ()
 {
        int posi = int (0x3fff * position);
-       return MidiByteArray  (3, 0xe0 | raw_id(), posi & 0x7f, posi >> 7);
+       return MidiByteArray  (3, 0xe0 | id(), posi & 0x7f, posi >> 7);
 }
index 8dc1d626cc3fa6db526d3dd5bd5eedd8a6d99c85..43628e92bf7e94bff5baa1d827f2a0396d73dc4d 100644 (file)
@@ -55,5 +55,5 @@ Led::set_state (LedState new_state)
                return MidiByteArray ();
        }
        
-       return MidiByteArray  (3, 0x90, raw_id(), msg);
+       return MidiByteArray  (3, 0x90, id(), msg);
 }
index 20f07e6175954e0697674eaeffa331b81ef02f88..d8c89ff37ebfe8dfd6b9501dd85a7a1e405ec42a 100644 (file)
@@ -955,9 +955,9 @@ MackieControlProtocol::handle_button_event (Surface& surface, Button& button, Bu
                return;
        }
        
-       DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Handling %1 for button %2\n", (bs == press ? "press" : "release"), button.raw_id()));
+       DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Handling %1 for button %2\n", (bs == press ? "press" : "release"), button.id()));
 
-       ButtonMap::iterator b = button_map.find (button.raw_id());
+       ButtonMap::iterator b = button_map.find (button.id());
 
        if (b != button_map.end()) {
 
index c89bfa2c10892f82fdd89feb778889de2d6923f5..a93159f36ca4b6231035fb21c1ff980066f0d177 100644 (file)
@@ -285,7 +285,7 @@ class MackieControlProtocol
  
        void add_in_use_timeout (Mackie::Surface& surface, Mackie::Control& in_use_control, Mackie::Control* touch_control);
 
-       int modifier_state();
+       int modifier_state() const { return _modifier_state; }
        
   protected:
        // shut down the surface
index 03c0f1aa3096e5a9a33d3d3007c83138f9e7a387..a4824d3612ce63318719dd776bb709b15cf5685b 100644 (file)
@@ -45,7 +45,7 @@ Meter::update_message (float dB)
 {
        float def = 0.0f; /* Meter deflection %age */
 
-       // DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Meter ID %1 dB %2\n", raw_id(), dB));
+       // DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Meter ID %1 dB %2\n", id(), dB));
        
        if (dB < -70.0f) {
                def = 0.0f;
@@ -75,12 +75,12 @@ Meter::update_message (float dB)
        if (def > 100.0f) {
                if (!overload_on) {
                        overload_on = true;
-                       msg << MidiByteArray (2, 0xd0, (raw_id() << 4) | 0xe);
+                       msg << MidiByteArray (2, 0xd0, (id() << 4) | 0xe);
                }
        } else {
                if (overload_on) {
                        overload_on = false;
-                       msg << MidiByteArray (2, 0xd0, (raw_id() << 4) | 0xf);
+                       msg << MidiByteArray (2, 0xd0, (id() << 4) | 0xf);
                }
        }
        
@@ -90,7 +90,7 @@ Meter::update_message (float dB)
        
        if (last_segment_value_sent != segment) {
                last_segment_value_sent = segment;
-               msg << MidiByteArray (2, 0xD0, (raw_id()<<4) | segment);
+               msg << MidiByteArray (2, 0xD0, (id()<<4) | segment);
        }
 
        return msg;
index 67fcb65ef9be43c3d059fb9f687cf0e38f05a2f5..3b8e8b65a5de4180fa61ea30f2efea75a497fb24 100644 (file)
@@ -81,7 +81,7 @@ Pot::update_message ()
                msg +=  (lrintf (value * 10.0) + 1) & 0x0f; // 0b00001111
        }
 
-       return MidiByteArray (3, 0xb0, raw_id(), msg);
+       return MidiByteArray (3, 0xb0, id(), msg);
 
 }
        
index b8327b82c13544f0619bb374833a263229ee054d..268e77d82c2d64b477a7a420b0fda1a5c55d6377 100644 (file)
@@ -107,33 +107,33 @@ void Strip::add (Control & control)
 
        } else if ((button = dynamic_cast<Button*>(&control)) != 0) {
 
-               if (control.raw_id() >= Button::recenable_base_id &&
-                   control.raw_id() < Button::recenable_base_id + 8) {
+               if (control.id() >= Button::recenable_base_id &&
+                   control.id() < Button::recenable_base_id + 8) {
                        
                        _recenable = button;
 
-               } else if (control.raw_id() >= Button::mute_base_id &&
-                          control.raw_id() < Button::mute_base_id + 8) {
+               } else if (control.id() >= Button::mute_base_id &&
+                          control.id() < Button::mute_base_id + 8) {
 
                        _mute = button;
 
-               } else if (control.raw_id() >= Button::solo_base_id &&
-                          control.raw_id() < Button::solo_base_id + 8) {
+               } else if (control.id() >= Button::solo_base_id &&
+                          control.id() < Button::solo_base_id + 8) {
 
                        _solo = button;
 
-               } else if (control.raw_id() >= Button::select_base_id &&
-                          control.raw_id() < Button::select_base_id + 8) {
+               } else if (control.id() >= Button::select_base_id &&
+                          control.id() < Button::select_base_id + 8) {
 
                        _select = button;
 
-               } else if (control.raw_id() >= Button::vselect_base_id &&
-                          control.raw_id() < Button::vselect_base_id + 8) {
+               } else if (control.id() >= Button::vselect_base_id &&
+                          control.id() < Button::vselect_base_id + 8) {
 
                        _vselect = button;
 
-               } else if (control.raw_id() >= Button::fader_touch_base_id &&
-                          control.raw_id() < Button::fader_touch_base_id + 8) {
+               } else if (control.id() >= Button::fader_touch_base_id &&
+                          control.id() < Button::fader_touch_base_id + 8) {
 
                        _fader_touch = button;
                }
@@ -445,34 +445,34 @@ Strip::handle_button (Button& button, ButtonState bs)
        }
 
        if (bs == press) {
-               if (button.raw_id() >= Button::recenable_base_id &&
-                   button.raw_id() < Button::recenable_base_id + 8) {
+               if (button.id() >= Button::recenable_base_id &&
+                   button.id() < Button::recenable_base_id + 8) {
 
                        _route->set_record_enabled (!_route->record_enabled(), this);
 
-               } else if (button.raw_id() >= Button::mute_base_id &&
-                          button.raw_id() < Button::mute_base_id + 8) {
+               } else if (button.id() >= Button::mute_base_id &&
+                          button.id() < Button::mute_base_id + 8) {
 
                        _route->set_mute (!_route->muted(), this);
 
-               } else if (button.raw_id() >= Button::solo_base_id &&
-                          button.raw_id() < Button::solo_base_id + 8) {
+               } else if (button.id() >= Button::solo_base_id &&
+                          button.id() < Button::solo_base_id + 8) {
 
                        _route->set_solo (!_route->soloed(), this);
 
-               } else if (button.raw_id() >= Button::select_base_id &&
-                          button.raw_id() < Button::select_base_id + 8) {
+               } else if (button.id() >= Button::select_base_id &&
+                          button.id() < Button::select_base_id + 8) {
 
                        _surface->mcp().select_track (_route);
 
-               } else if (button.raw_id() >= Button::vselect_base_id &&
-                          button.raw_id() < Button::vselect_base_id + 8) {
+               } else if (button.id() >= Button::vselect_base_id &&
+                          button.id() < Button::vselect_base_id + 8) {
 
                }
        }
 
-       if (button.raw_id() >= Button::fader_touch_base_id &&
-           button.raw_id() < Button::fader_touch_base_id + 8) {
+       if (button.id() >= Button::fader_touch_base_id &&
+           button.id() < Button::fader_touch_base_id + 8) {
 
                DEBUG_TRACE (DEBUG::MackieControl, string_compose ("fader touch, press ? %1\n", (bs == press)));
 
index 8600d34be7df426e41bb4d44bb1f94cea1f3a6b5..0dab9d87ad7af6729655f98ea8c6bd98d52c1be3 100644 (file)
@@ -374,7 +374,7 @@ Surface::handle_midi_note_on_message (MIDI::Parser &, MIDI::EventTwoBytes* ev)
                        strip->handle_button (*button, ev->velocity == 0x7f ? press : release);
                } else {
                        /* global button */
-                       DEBUG_TRACE (DEBUG::MackieControl, string_compose ("global button %1\n", button->raw_id()));
+                       DEBUG_TRACE (DEBUG::MackieControl, string_compose ("global button %1\n", button->id()));
                        _mcp.handle_button_event (*this, *button, ev->velocity == 0x7f ? press : release);
                }
        } else {
@@ -497,7 +497,7 @@ Surface::zero_all ()
 
        for (Controls::iterator it = controls.begin(); it != controls.end(); ++it) {
                Control & control = **it;
-               if (!control.group().is_strip() && control.accepts_feedback()) {
+               if (!control.group().is_strip()) {
                        _port->write (control.zero());
                }
        }