summaryrefslogtreecommitdiff
path: root/libs/surfaces/mackie
diff options
context:
space:
mode:
authorBen Loftis <ben@harrisonconsoles.com>2018-02-02 09:26:17 -0600
committerBen Loftis <ben@harrisonconsoles.com>2018-02-02 09:27:37 -0600
commit3aacdd79ae7537f507e6ee86ad6ffb85bc55bdfc (patch)
treeb61e115ac8a124cd8db5bfa1f2b96a34353d3ccb /libs/surfaces/mackie
parent16a5e3ce55be272ec8934996a474e9beb6b8c9f2 (diff)
Fixes for the iCON Qcon mcp device - LED rings. Submitted by Michal Barhon : mbarhon@seznam.cz
Diffstat (limited to 'libs/surfaces/mackie')
-rw-r--r--libs/surfaces/mackie/led.cc12
-rw-r--r--libs/surfaces/mackie/led.h3
-rw-r--r--libs/surfaces/mackie/pot.cc24
-rw-r--r--libs/surfaces/mackie/pot.h2
-rwxr-xr-xlibs/surfaces/mackie/surface.cc31
-rw-r--r--libs/surfaces/mackie/surface.h5
6 files changed, 64 insertions, 13 deletions
diff --git a/libs/surfaces/mackie/led.cc b/libs/surfaces/mackie/led.cc
index 59b9f6cb20..9f46ad5e8e 100644
--- a/libs/surfaces/mackie/led.cc
+++ b/libs/surfaces/mackie/led.cc
@@ -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 ();
}
diff --git a/libs/surfaces/mackie/led.h b/libs/surfaces/mackie/led.h
index 19c48cb6a8..877fb6391d 100644
--- a/libs/surfaces/mackie/led.h
+++ b/libs/surfaces/mackie/led.h
@@ -50,6 +50,9 @@ public:
static Control* factory (Surface&, int id, const char*, Group&);
+ // qcon flag
+ bool is_qcon;
+
private:
LedState state;
};
diff --git a/libs/surfaces/mackie/pot.cc b/libs/surfaces/mackie/pot.cc
index 3ac991116f..bb2cccce40 100644
--- a/libs/surfaces/mackie/pot.cc
+++ b/libs/surfaces/mackie/pot.cc
@@ -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
diff --git a/libs/surfaces/mackie/pot.h b/libs/surfaces/mackie/pot.h
index 9511db0b71..42129b7ac7 100644
--- a/libs/surfaces/mackie/pot.h
+++ b/libs/surfaces/mackie/pot.h
@@ -47,6 +47,8 @@ public:
static Control* factory (Surface&, int id, const char*, Group&);
+ bool is_qcon;
+
};
}
diff --git a/libs/surfaces/mackie/surface.cc b/libs/surfaces/mackie/surface.cc
index 7ed0c5c26a..f8316e0e5b 100755
--- a/libs/surfaces/mackie/surface.cc
+++ b/libs/surfaces/mackie/surface.cc
@@ -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);
+ }
}
}
}
diff --git a/libs/surfaces/mackie/surface.h b/libs/surfaces/mackie/surface.h
index 1c1096fbc4..082f0cc77e 100644
--- a/libs/surfaces/mackie/surface.h
+++ b/libs/surfaces/mackie/surface.h
@@ -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: