Fixes for the iCON Qcon mcp device - LED rings. Submitted by Michal Barhon : mbarhon...
authorBen Loftis <ben@harrisonconsoles.com>
Fri, 2 Feb 2018 15:26:17 +0000 (09:26 -0600)
committerBen Loftis <ben@harrisonconsoles.com>
Fri, 2 Feb 2018 15:27:37 +0000 (09:27 -0600)
libs/surfaces/mackie/led.cc
libs/surfaces/mackie/led.h
libs/surfaces/mackie/pot.cc
libs/surfaces/mackie/pot.h
libs/surfaces/mackie/surface.cc
libs/surfaces/mackie/surface.h

index 59b9f6cb20a9026ac99b1e648dfb6b709f70c69c..9f46ad5e8e834dd73d475ea47b17f710c17545e8 100644 (file)
@@ -35,6 +35,7 @@ Led::factory (Surface& surface, int id, const char* name, Group& group)
 {
        Led* l = new Led (id, name, group);
        surface.leds[id] = l;
+       l->is_qcon = surface.get_qcon_flag(); // get qcon flag from surface
        surface.controls.push_back (l);
        group.add (*l);
        return l;
@@ -55,8 +56,17 @@ Led::set_state (LedState new_state)
                msg = 0x00;
                break;
        case LedState::flashing:
-               msg = 0x01;
+               
+               if( !is_qcon ) { // Standard mackie surfaces supports flashing LEDs
+                       msg = 0x01; 
+                       break;
+               } else {
+                       msg = 0x7f; // For qcon set LED to ON state - qcon don't support LED flashing. 
+                       break;
+               }
+
                break;
+
        case LedState::none:
                return MidiByteArray ();
        }
index 19c48cb6a867f1ae89ae0c2cb49741a4bbe787da..877fb6391dc1a42f45dc25a6d1e7a6fee5bd1780 100644 (file)
@@ -50,6 +50,9 @@ public:
 
        static Control* factory (Surface&, int id, const char*, Group&);
 
+       // qcon flag
+       bool is_qcon;
+
   private:
        LedState state;
 };
index 3ac991116f2153aa19982d1c8ecd5232015dca99..bb2cccce40270a00b529c103b64a2fa925cd9e34 100644 (file)
@@ -33,6 +33,7 @@ Pot::factory (Surface& surface, int id, const char* name, Group& group)
 {
        Pot* p = new Pot (id, name, group);
        surface.pots[id] = p;
+       p->is_qcon = surface.get_qcon_flag();
        surface.controls.push_back (p);
        group.add (*p);
        return p;
@@ -43,11 +44,30 @@ Pot::set (float val, bool onoff, Mode mode)
 {
        // TODO do an exact calc for 0.50? To allow manually re-centering the port.
 
+       MIDI::byte msg;
+
        // center on if val is "very close" to 0.50
-       MIDI::byte msg =  (val > 0.48 && val < 0.58 ? 1 : 0) << 6;
+       if( !is_qcon ) {
+               // center the position and shift bits for standard mackie surface
+               msg =  (val > 0.48 && val < 0.58 ? 1 : 0) << 6; 
+       } else {        //center the position and don't shift anything for qcon - TODO: on center position lit the center LED on the ring
+               if(val > 0.48 && val < 0.58) {
+                       val = 0.50;             
+               }
+
+               // set msg
+               msg = val;
+       }       
+
 
        // Pot/LED mode
-       msg |=  (mode << 4);
+       if( !is_qcon ) {
+               // Mackie mode - Supports all ring modes
+               msg |=  (mode << 4);
+       } else {        
+               // Qcon rotary mode - Only "DOT" mode? - TODO: Investigate how to proper set vpot rings to different modes on qcon
+               msg |=  (0 << 4);
+       }
 
        /*
         * Even though a width value may be negative, there is
index 9511db0b71ca4edb5486dee922367de5eaa6db9d..42129b7ac720745b888b77301111beee45684d73 100644 (file)
@@ -47,6 +47,8 @@ public:
 
        static Control* factory (Surface&, int id, const char*, Group&);
 
+       bool is_qcon;
+
 };
 
 }
index 7ed0c5c26af364db53796da695976f0631e3ba11..f8316e0e5b355a4f06eff4457d5d57d020a39fdb 100755 (executable)
@@ -116,6 +116,13 @@ Surface::Surface (MackieControlProtocol& mcp, const std::string& device_name, ui
                throw failed_constructor ();
        }
 
+       //Store Qcon flag
+       if( mcp.device_info().is_qcon() ) {
+               is_qcon = true;
+       } else {
+               is_qcon = false;
+       }
+
        /* only the first Surface object has global controls */
        /* lets use master_position instead */
        uint32_t mp = _mcp.device_info().master_position();
@@ -1044,6 +1051,8 @@ Surface::show_two_char_display (unsigned int value, const std::string & /*dots*/
 void
 Surface::display_timecode (const std::string & timecode, const std::string & last_timecode)
 {
+       //TODO: Fix for Qcon to correct timecode value if is over 1000 bars
+
        if (!_active || !_mcp.device_info().has_timecode_display()) {
                return;
        }
@@ -1288,18 +1297,20 @@ Surface::set_touch_sensitivity (int sensitivity)
 
        /* sensitivity already clamped by caller */
 
-       if (_port) {
-               MidiByteArray msg;
+       if( !is_qcon ) { // Qcon doesn't support fader sensitivity
+               if (_port) {
+                       MidiByteArray msg;
 
-               msg << sysex_hdr ();
-               msg << 0x0e;
-               msg << 0xff; /* overwritten for each fader below */
-               msg << (sensitivity & 0x7f);
-               msg << MIDI::eox;
+                       msg << sysex_hdr ();
+                       msg << 0x0e;
+                       msg << 0xff; /* overwritten for each fader below */
+                       msg << (sensitivity & 0x7f);
+                       msg << MIDI::eox;
 
-               for (int fader = 0; fader < 9; ++fader) {
-                       msg[6] = fader;
-                       _port->write (msg);
+                       for (int fader = 0; fader < 9; ++fader) {
+                               msg[6] = fader;
+                               _port->write (msg);
+                       }
                }
        }
 }
index 1c1096fbc4ea787a6df0f0b25bc1f03b548aae0d..082f0cc77ece93caa3d8ea87e6291e70d706b3f6 100644 (file)
@@ -176,6 +176,8 @@ public:
        XMLNode& get_state ();
        int set_state (const XMLNode&, int version);
 
+       bool get_qcon_flag() { return is_qcon; }
+
   private:
        MackieControlProtocol& _mcp;
        SurfacePort*           _port;
@@ -206,6 +208,9 @@ public:
 
        int connection_state;
 
+       // QCon Flag
+       bool is_qcon = false;
+
        MidiByteArray display_line (std::string const& msg, int line_num);
 
   public: