#include "jog.h"
#include "meter.h"
-#include "i18n.h"
+#include "pbd/i18n.h"
#ifdef PLATFORM_WINDOWS
#define random() rand()
// the device type
static MidiByteArray mackie_sysex_hdr_xt (5, MIDI::sysex, 0x0, 0x0, 0x66, 0x15);
+//QCON
+// The MCU sysex header for QCon Control surface
+static MidiByteArray mackie_sysex_hdr_qcon (5, MIDI::sysex, 0x0, 0x0, 0x66, 0x14);
+
+// The MCU sysex header for QCon Control - extender
+// The extender differs from Mackie by 4th bit - it's same like for main control surface (for display)
+static MidiByteArray mackie_sysex_hdr_xt_qcon (5, MIDI::sysex, 0x0, 0x0, 0x66, 0x14);
+
+
static MidiByteArray empty_midi_byte_array;
Surface::Surface (MackieControlProtocol& mcp, const std::string& device_name, uint32_t number, surface_type_t stype)
, _master_fader (0)
, _last_master_gain_written (-0.0f)
, connection_state (0)
+ , is_qcon (false)
, input_source (0)
{
DEBUG_TRACE (DEBUG::MackieControl, "Surface::Surface init\n");
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();
Surface::get_state()
{
XMLNode* node = new XMLNode (X_("Surface"));
- node->add_property (X_("name"), _name);
+ node->set_property (X_("name"), _name);
node->add_child_nocopy (_port->get_state());
return *node;
}
XMLNode* mynode = 0;
for (XMLNodeList::const_iterator c = children.begin(); c != children.end(); ++c) {
- XMLProperty const* prop = (*c)->property (X_("name"));
- if (prop) {
- if (prop->value() == _name) {
- mynode = *c;
- break;
- }
+ std::string name;
+ if ((*c)->get_property (X_("name"), name) && name == _name) {
+ mynode = *c;
+ break;
}
}
Surface::sysex_hdr() const
{
switch (_stype) {
- case mcu: return mackie_sysex_hdr;
- case ext: return mackie_sysex_hdr_xt;
+ case mcu:
+ if (_mcp.device_info().is_qcon()) {
+ return mackie_sysex_hdr_qcon;
+ } else {
+ return mackie_sysex_hdr;
+ }
+ case ext:
+ if(_mcp.device_info().is_qcon()) {
+ return mackie_sysex_hdr_xt_qcon;
+ } else {
+ return mackie_sysex_hdr_xt;
+ }
}
cout << "SurfacePort::sysex_hdr _port_type not known" << endl;
return mackie_sysex_hdr;
{
MidiByteArray bytes (count, raw_bytes);
- DEBUG_TRACE (DEBUG::MackieControl, string_compose ("handle_midi_sysex: %1\n", bytes));
-
if (_mcp.device_info().no_handshake()) {
turn_it_on ();
}
*/
if (_stype == mcu) {
- mackie_sysex_hdr[4] = bytes[4];
+ if (_mcp.device_info().is_qcon()) {
+ mackie_sysex_hdr_qcon[4] = bytes[4];
+ } else {
+ mackie_sysex_hdr[4] = bytes[4];
+ }
+
} else {
- mackie_sysex_hdr_xt[4] = bytes[4];
+ if (_mcp.device_info().is_qcon()) {
+ mackie_sysex_hdr_xt_qcon[4] = bytes[4];
+ } else {
+ mackie_sysex_hdr_xt[4] = bytes[4];
+ }
}
switch (bytes[5]) {
case 0x01:
+ if (!_active) {
+ DEBUG_TRACE (DEBUG::MackieControl, string_compose ("handle_midi_sysex: %1\n", bytes));
+ }
/* MCP: Device Ready
LCP: Connection Challenge
*/
DEBUG_TRACE (DEBUG::MackieControl, "Logic Control Device connection challenge\n");
write_sysex (host_connection_query (bytes));
} else {
- DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Mackie Control Device ready, current status = %1\n", _active));
+ if (!_active) {
+ DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Mackie Control Device ready, current status = %1\n", _active));
+ }
turn_it_on ();
}
break;
case 0x06:
+ if (!_active) {
+ DEBUG_TRACE (DEBUG::MackieControl, string_compose ("handle_midi_sysex: %1\n", bytes));
+ }
/* Behringer X-Touch Compact: Device Ready
*/
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Behringer X-Touch Compact ready, current status = %1\n", _active));
break;
case 0x03: /* LCP Connection Confirmation */
+ DEBUG_TRACE (DEBUG::MackieControl, string_compose ("handle_midi_sysex: %1\n", bytes));
DEBUG_TRACE (DEBUG::MackieControl, "Logic Control Device confirms connection, ardour replies\n");
if (bytes[4] == 0x10 || bytes[4] == 0x11) {
write_sysex (host_connection_confirmation (bytes));
break;
case 0x04: /* LCP: Confirmation Denied */
+ DEBUG_TRACE (DEBUG::MackieControl, string_compose ("handle_midi_sysex: %1\n", bytes));
DEBUG_TRACE (DEBUG::MackieControl, "Logic Control Device denies connection\n");
_active = false;
break;
default:
+ DEBUG_TRACE (DEBUG::MackieControl, string_compose ("handle_midi_sysex: %1\n", bytes));
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("unknown device ID byte %1", (int) bytes[5]));
error << "MCP: unknown sysex: " << bytes << endmsg;
}
}
}
+void
+Surface::update_strip_selection ()
+{
+ Strips::iterator s = strips.begin();
+ for ( ; s != strips.end(); ++s) {
+ (*s)->update_selection_state();
+ }
+}
+
void
Surface::map_stripables (const vector<boost::shared_ptr<Stripable> >& stripables)
{
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;
}
/* 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);
+ }
}
}
}