Fixes for the iCON Qcon mcp device - LED rings. Submitted by Michal Barhon : mbarhon@seznam.cz

This commit is contained in:
Ben Loftis 2018-02-02 09:26:17 -06:00
parent 16a5e3ce55
commit 3aacdd79ae
6 changed files with 64 additions and 13 deletions

View 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:
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 ();
}

View file

@ -50,6 +50,9 @@ public:
static Control* factory (Surface&, int id, const char*, Group&);
// qcon flag
bool is_qcon;
private:
LedState state;
};

View 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
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

View file

@ -47,6 +47,8 @@ public:
static Control* factory (Surface&, int id, const char*, Group&);
bool is_qcon;
};
}

View file

@ -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,6 +1297,7 @@ Surface::set_touch_sensitivity (int sensitivity)
/* sensitivity already clamped by caller */
if( !is_qcon ) { // Qcon doesn't support fader sensitivity
if (_port) {
MidiByteArray msg;
@ -1303,6 +1313,7 @@ Surface::set_touch_sensitivity (int sensitivity)
}
}
}
}
void
Surface::hui_heartbeat ()

View 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: