2012-04-12 07:46:35 -04:00
|
|
|
/*
|
2019-08-03 08:34:29 -04:00
|
|
|
* Copyright (C) 2006-2007 John Anderson
|
|
|
|
* Copyright (C) 2012-2016 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
* Copyright (C) 2012-2016 Tim Mayberry <mojofunk@gmail.com>
|
|
|
|
* Copyright (C) 2014-2015 Robin Gareus <robin@gareus.org>
|
|
|
|
* Copyright (C) 2015 Len Ovens <len@ovenwerks.net>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
2012-04-12 07:46:35 -04:00
|
|
|
|
2012-04-14 15:02:54 -04:00
|
|
|
#include <cstdlib>
|
2012-04-12 08:58:42 -04:00
|
|
|
#include <cstring>
|
|
|
|
#include <glibmm/miscutils.h>
|
|
|
|
|
2012-04-12 07:46:35 -04:00
|
|
|
#include "pbd/xml++.h"
|
2012-04-12 08:58:42 -04:00
|
|
|
#include "pbd/error.h"
|
2014-06-17 07:41:29 -04:00
|
|
|
#include "pbd/file_utils.h"
|
2013-09-05 05:03:07 -04:00
|
|
|
#include "pbd/convert.h"
|
2014-06-14 22:09:48 -04:00
|
|
|
#include "pbd/stl_delete.h"
|
2012-04-12 08:58:42 -04:00
|
|
|
|
|
|
|
#include "ardour/filesystem_paths.h"
|
2012-04-12 07:46:35 -04:00
|
|
|
|
|
|
|
#include "device_info.h"
|
|
|
|
|
2016-07-14 14:44:52 -04:00
|
|
|
#include "pbd/i18n.h"
|
2012-04-12 07:46:35 -04:00
|
|
|
|
|
|
|
using namespace PBD;
|
2012-04-12 08:58:42 -04:00
|
|
|
using namespace ARDOUR;
|
2015-04-15 20:37:20 -04:00
|
|
|
using namespace ArdourSurface;
|
|
|
|
using namespace Mackie;
|
|
|
|
|
2012-04-12 07:46:35 -04:00
|
|
|
using std::string;
|
2012-04-12 08:58:42 -04:00
|
|
|
using std::vector;
|
|
|
|
|
|
|
|
std::map<std::string,DeviceInfo> DeviceInfo::device_info;
|
2012-04-12 07:46:35 -04:00
|
|
|
|
|
|
|
DeviceInfo::DeviceInfo()
|
|
|
|
: _strip_cnt (8)
|
2012-04-12 12:57:34 -04:00
|
|
|
, _extenders (0)
|
2015-06-04 18:07:43 -04:00
|
|
|
, _master_position (0)
|
2012-04-12 07:46:35 -04:00
|
|
|
, _has_two_character_display (true)
|
|
|
|
, _has_master_fader (true)
|
|
|
|
, _has_timecode_display (true)
|
2012-04-12 13:52:57 -04:00
|
|
|
, _has_global_controls (true)
|
|
|
|
, _has_jog_wheel (true)
|
2012-04-12 14:36:14 -04:00
|
|
|
, _has_touch_sense_faders (true)
|
2012-04-15 09:28:45 -04:00
|
|
|
, _uses_logic_control_buttons (false)
|
2012-04-23 22:28:51 -04:00
|
|
|
, _uses_ipmidi (false)
|
2012-05-11 12:04:09 -04:00
|
|
|
, _no_handshake (false)
|
2018-02-01 15:39:17 -05:00
|
|
|
, _is_qcon(false)
|
2022-03-04 15:08:31 -05:00
|
|
|
, _is_platformMp(false)
|
2022-03-04 15:18:57 -05:00
|
|
|
, _is_proG2(false)
|
2023-03-05 18:08:38 -05:00
|
|
|
, _is_xtouch(false)
|
2021-07-02 17:00:51 -04:00
|
|
|
, _has_qcon_second_lcd(false)
|
|
|
|
, _has_qcon_master_meters(false)
|
2012-05-24 15:27:29 -04:00
|
|
|
, _has_meters (true)
|
2015-10-13 10:04:58 -04:00
|
|
|
, _has_separate_meters (false)
|
2019-10-20 23:24:17 -04:00
|
|
|
, _single_fader_follows_selection (false)
|
2015-10-03 11:31:17 -04:00
|
|
|
, _device_type (MCU)
|
2012-04-12 07:46:35 -04:00
|
|
|
, _name (X_("Mackie Control Universal Pro"))
|
|
|
|
{
|
2012-04-15 09:28:45 -04:00
|
|
|
mackie_control_buttons ();
|
|
|
|
}
|
|
|
|
|
|
|
|
DeviceInfo::~DeviceInfo()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-06-09 15:06:52 -04:00
|
|
|
GlobalButtonInfo&
|
|
|
|
DeviceInfo::get_global_button(Button::ID id)
|
|
|
|
{
|
|
|
|
GlobalButtonsInfo::iterator it;
|
|
|
|
|
|
|
|
it = _global_buttons.find (id);
|
|
|
|
|
|
|
|
return it->second;
|
|
|
|
}
|
|
|
|
|
2012-06-06 08:20:57 -04:00
|
|
|
std::string&
|
|
|
|
DeviceInfo::get_global_button_name(Button::ID id)
|
|
|
|
{
|
2012-06-09 15:06:52 -04:00
|
|
|
GlobalButtonsInfo::iterator it;
|
2015-10-03 16:15:18 -04:00
|
|
|
|
2012-06-06 08:20:57 -04:00
|
|
|
it = _global_buttons.find (id);
|
|
|
|
if (it == _global_buttons.end ()) {
|
|
|
|
_global_button_name = "";
|
|
|
|
return _global_button_name;
|
|
|
|
} else {
|
|
|
|
return it->second.label;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-04-15 09:28:45 -04:00
|
|
|
void
|
|
|
|
DeviceInfo::mackie_control_buttons ()
|
|
|
|
{
|
|
|
|
_global_buttons.clear ();
|
2012-04-15 09:41:20 -04:00
|
|
|
shared_buttons ();
|
2015-10-03 16:15:18 -04:00
|
|
|
|
2012-06-06 08:20:57 -04:00
|
|
|
_global_buttons[Button::UserA] = GlobalButtonInfo ("Rear Panel User Switch 1", "user", 0x66);
|
|
|
|
_global_buttons[Button::UserB] = GlobalButtonInfo ("Rear Panel User Switch 2", "user", 0x67);
|
2015-10-03 16:15:18 -04:00
|
|
|
|
2015-10-04 14:51:05 -04:00
|
|
|
//TODO Implement "rear panel external control": a connection for a resistive
|
|
|
|
//TODO element expression pedal . Message: 0xb0 0x2e 0xVV where 0xVV = external
|
2012-06-06 08:20:57 -04:00
|
|
|
//TODO controller position value (0x00 to 0x7f)
|
2015-10-03 16:15:18 -04:00
|
|
|
|
2012-06-06 08:20:57 -04:00
|
|
|
_strip_buttons[Button::RecEnable] = StripButtonInfo (0x0, "Rec");
|
2012-04-12 07:46:35 -04:00
|
|
|
}
|
|
|
|
|
2012-04-15 09:28:45 -04:00
|
|
|
void
|
|
|
|
DeviceInfo::logic_control_buttons ()
|
2012-04-12 08:16:55 -04:00
|
|
|
{
|
2012-04-15 09:28:45 -04:00
|
|
|
_global_buttons.clear ();
|
2012-04-15 09:41:20 -04:00
|
|
|
shared_buttons ();
|
2015-10-03 16:15:18 -04:00
|
|
|
|
2012-06-06 08:20:57 -04:00
|
|
|
_global_buttons[Button::UserA] = GlobalButtonInfo ("User Switch A", "user", 0x66);
|
|
|
|
_global_buttons[Button::UserB] = GlobalButtonInfo ("User Switch B", "user", 0x67);
|
2012-04-15 09:28:45 -04:00
|
|
|
|
2012-06-06 08:20:57 -04:00
|
|
|
_strip_buttons[Button::RecEnable] = StripButtonInfo (0x0, "Rec/Rdy");
|
2012-04-15 09:41:20 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
DeviceInfo::shared_buttons ()
|
|
|
|
{
|
2012-06-06 08:20:57 -04:00
|
|
|
_global_buttons[Button::Track] = GlobalButtonInfo ("Track", "assignment", 0x28);
|
|
|
|
_global_buttons[Button::Send] = GlobalButtonInfo ("Send", "assignment", 0x29);
|
|
|
|
_global_buttons[Button::Pan] = GlobalButtonInfo ("Pan/Surround", "assignment", 0x2a);
|
|
|
|
_global_buttons[Button::Plugin] = GlobalButtonInfo ("Plugin", "assignment", 0x2b);
|
|
|
|
_global_buttons[Button::Eq] = GlobalButtonInfo ("Eq", "assignment", 0x2c);
|
|
|
|
_global_buttons[Button::Dyn] = GlobalButtonInfo ("Instrument", "assignment", 0x2d);
|
2015-10-03 16:15:18 -04:00
|
|
|
|
2012-06-06 08:20:57 -04:00
|
|
|
_global_buttons[Button::Left] = GlobalButtonInfo ("Bank Left", "bank", 0x2e);
|
|
|
|
_global_buttons[Button::Right] = GlobalButtonInfo ("Bank Right", "bank", 0x2f);
|
|
|
|
_global_buttons[Button::ChannelLeft] = GlobalButtonInfo ("Channel Left", "bank", 0x30);
|
|
|
|
_global_buttons[Button::ChannelRight] = GlobalButtonInfo ("Channel Right", "bank", 0x31);
|
|
|
|
_global_buttons[Button::Flip] = GlobalButtonInfo ("Flip", "assignment", 0x32);
|
|
|
|
_global_buttons[Button::View] = GlobalButtonInfo ("Global View", "global view", 0x33);
|
|
|
|
|
|
|
|
_global_buttons[Button::NameValue] = GlobalButtonInfo ("Name/Value", "display", 0x34);
|
|
|
|
_global_buttons[Button::TimecodeBeats] = GlobalButtonInfo ("Timecode/Beats", "display", 0x35);
|
2015-10-03 16:15:18 -04:00
|
|
|
|
2012-06-06 08:20:57 -04:00
|
|
|
_global_buttons[Button::F1] = GlobalButtonInfo ("F1", "function select", 0x36);
|
|
|
|
_global_buttons[Button::F2] = GlobalButtonInfo ("F2", "function select", 0x37);
|
|
|
|
_global_buttons[Button::F3] = GlobalButtonInfo ("F3", "function select", 0x38);
|
|
|
|
_global_buttons[Button::F4] = GlobalButtonInfo ("F4", "function select", 0x39);
|
|
|
|
_global_buttons[Button::F5] = GlobalButtonInfo ("F5", "function select", 0x3a);
|
|
|
|
_global_buttons[Button::F6] = GlobalButtonInfo ("F6", "function select", 0x3b);
|
|
|
|
_global_buttons[Button::F7] = GlobalButtonInfo ("F7", "function select", 0x3c);
|
|
|
|
_global_buttons[Button::F8] = GlobalButtonInfo ("F8", "function select", 0x3d);
|
2015-10-03 16:15:18 -04:00
|
|
|
|
2012-06-06 08:20:57 -04:00
|
|
|
_global_buttons[Button::MidiTracks] = GlobalButtonInfo ("MIDI Tracks", "global view", 0x3e);
|
|
|
|
_global_buttons[Button::Inputs] = GlobalButtonInfo ("Inputs", "global view", 0x3f);
|
|
|
|
_global_buttons[Button::AudioTracks] = GlobalButtonInfo ("Audio Tracks", "global view", 0x40);
|
|
|
|
_global_buttons[Button::AudioInstruments] = GlobalButtonInfo ("Audio Instruments", "global view", 0x41);
|
|
|
|
_global_buttons[Button::Aux] = GlobalButtonInfo ("Aux", "global view", 0x42);
|
|
|
|
_global_buttons[Button::Busses] = GlobalButtonInfo ("Busses", "global view", 0x43);
|
|
|
|
_global_buttons[Button::Outputs] = GlobalButtonInfo ("Outputs", "global view", 0x44);
|
|
|
|
_global_buttons[Button::User] = GlobalButtonInfo ("User", "global view", 0x45);
|
2015-10-03 16:15:18 -04:00
|
|
|
|
2012-06-06 08:20:57 -04:00
|
|
|
_global_buttons[Button::Shift] = GlobalButtonInfo ("Shift", "modifiers", 0x46);
|
|
|
|
_global_buttons[Button::Option] = GlobalButtonInfo ("Option", "modifiers", 0x47);
|
|
|
|
_global_buttons[Button::Ctrl] = GlobalButtonInfo ("Ctrl", "modifiers", 0x48);
|
|
|
|
_global_buttons[Button::CmdAlt] = GlobalButtonInfo ("Cmd/Alt", "modifiers", 0x49);
|
2015-10-03 16:15:18 -04:00
|
|
|
|
2012-06-06 08:20:57 -04:00
|
|
|
_global_buttons[Button::Read] = GlobalButtonInfo ("Read/Off", "automation", 0x4a);
|
|
|
|
_global_buttons[Button::Write] = GlobalButtonInfo ("Write", "automation", 0x4b);
|
|
|
|
_global_buttons[Button::Trim] = GlobalButtonInfo ("Trim", "automation", 0x4c);
|
|
|
|
_global_buttons[Button::Touch] = GlobalButtonInfo ("Touch", "automation", 0x4d);
|
|
|
|
_global_buttons[Button::Latch] = GlobalButtonInfo ("Latch", "automation", 0x4e);
|
|
|
|
_global_buttons[Button::Grp] = GlobalButtonInfo ("Group", "automation", 0x4f);
|
2015-10-03 16:15:18 -04:00
|
|
|
|
2012-06-06 08:20:57 -04:00
|
|
|
_global_buttons[Button::Save] = GlobalButtonInfo ("Save", "utilities", 0x50);
|
|
|
|
_global_buttons[Button::Undo] = GlobalButtonInfo ("Undo", "utilities", 0x51);
|
|
|
|
_global_buttons[Button::Cancel] = GlobalButtonInfo ("Cancel", "utilities", 0x52);
|
|
|
|
_global_buttons[Button::Enter] = GlobalButtonInfo ("Enter", "utilities", 0x53);
|
|
|
|
|
|
|
|
_global_buttons[Button::Marker] = GlobalButtonInfo ("Marker", "transport", 0x54);
|
|
|
|
_global_buttons[Button::Nudge] = GlobalButtonInfo ("Nudge", "transport", 0x55);
|
|
|
|
_global_buttons[Button::Loop] = GlobalButtonInfo ("Cycle", "transport", 0x56);
|
|
|
|
_global_buttons[Button::Drop] = GlobalButtonInfo ("Drop", "transport", 0x57);
|
|
|
|
_global_buttons[Button::Replace] = GlobalButtonInfo ("Replace", "transport", 0x58);
|
|
|
|
_global_buttons[Button::Click] = GlobalButtonInfo ("Click", "transport", 0x59);
|
2012-06-12 17:04:13 -04:00
|
|
|
_global_buttons[Button::ClearSolo] = GlobalButtonInfo ("Solo", "transport", 0x5a);
|
2015-10-03 16:15:18 -04:00
|
|
|
|
2012-06-06 08:20:57 -04:00
|
|
|
_global_buttons[Button::Rewind] = GlobalButtonInfo ("Rewind", "transport", 0x5b);
|
|
|
|
_global_buttons[Button::Ffwd] = GlobalButtonInfo ("Fast Fwd", "transport", 0x5c);
|
|
|
|
_global_buttons[Button::Stop] = GlobalButtonInfo ("Stop", "transport", 0x5d);
|
|
|
|
_global_buttons[Button::Play] = GlobalButtonInfo ("Play", "transport", 0x5e);
|
|
|
|
_global_buttons[Button::Record] = GlobalButtonInfo ("Record", "transport", 0x5f);
|
2015-10-03 16:15:18 -04:00
|
|
|
|
2012-06-06 08:20:57 -04:00
|
|
|
_global_buttons[Button::CursorUp] = GlobalButtonInfo ("Cursor Up", "cursor", 0x60);
|
|
|
|
_global_buttons[Button::CursorDown] = GlobalButtonInfo ("Cursor Down", "cursor", 0x61);
|
|
|
|
_global_buttons[Button::CursorLeft] = GlobalButtonInfo ("Cursor Left", "cursor", 0x62);
|
|
|
|
_global_buttons[Button::CursorRight] = GlobalButtonInfo ("Cursor Right", "cursor", 0x63);
|
|
|
|
_global_buttons[Button::Zoom] = GlobalButtonInfo ("Zoom", "cursor", 0x64);
|
|
|
|
_global_buttons[Button::Scrub] = GlobalButtonInfo ("Scrub", "cursor", 0x65);
|
|
|
|
|
|
|
|
_strip_buttons[Button::Solo] = StripButtonInfo (0x08, "Solo");
|
|
|
|
_strip_buttons[Button::Mute] = StripButtonInfo (0x10, "Mute");
|
|
|
|
_strip_buttons[Button::Select] = StripButtonInfo (0x18, "Select");
|
|
|
|
_strip_buttons[Button::VSelect] = StripButtonInfo (0x20, "V-Select");
|
2012-06-09 15:06:52 -04:00
|
|
|
|
|
|
|
_strip_buttons[Button::FaderTouch] = StripButtonInfo (0x68, "Fader Touch");
|
|
|
|
|
|
|
|
_global_buttons[Button::MasterFaderTouch] = GlobalButtonInfo ("Master Fader Touch", "master", 0x70);
|
2012-04-12 08:16:55 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
DeviceInfo::set_state (const XMLNode& node, int /* version */)
|
2012-04-12 07:46:35 -04:00
|
|
|
{
|
|
|
|
const XMLProperty* prop;
|
2012-04-12 08:58:42 -04:00
|
|
|
const XMLNode* child;
|
2012-04-12 12:41:07 -04:00
|
|
|
|
|
|
|
if (node.name() != "MackieProtocolDevice") {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2015-10-03 11:39:36 -04:00
|
|
|
/* Device type ought to be mandatory but early versions missed it */
|
|
|
|
if ((child = node.child ("DeviceType")) != 0) {
|
|
|
|
if ((prop = child->property ("value")) != 0) {
|
|
|
|
if (prop->value() == X_("MCU")) {
|
|
|
|
_device_type = MCU;
|
|
|
|
} else if (prop->value() == X_("MCXT")) {
|
|
|
|
_device_type = MCXT;
|
|
|
|
} else if (prop->value() == X_("LC")) {
|
|
|
|
_device_type = LC;
|
|
|
|
} else if (prop->value() == X_("LCXT")) {
|
|
|
|
_device_type = LCXT;
|
|
|
|
} else if (prop->value() == X_("HUI")) {
|
|
|
|
_device_type = HUI;
|
|
|
|
} else {
|
|
|
|
error << string_compose (_("Unknown Mackie device type \"%1\" used in device info file, using MCU instead"), prop->value()) << endmsg;
|
|
|
|
_device_type = MCU;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
_device_type = MCU;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-04-12 12:41:07 -04:00
|
|
|
/* name is mandatory */
|
|
|
|
if ((child = node.child ("Name")) != 0) {
|
2016-08-31 01:38:04 -04:00
|
|
|
if (!child->get_property ("value", _name)) {
|
2012-04-12 12:41:07 -04:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-04-25 17:21:36 -04:00
|
|
|
/* strip count is mandatory */
|
2012-04-12 08:58:42 -04:00
|
|
|
if ((child = node.child ("Strips")) != 0) {
|
2016-08-31 01:38:04 -04:00
|
|
|
if (!child->get_property ("value", _strip_cnt)) {
|
|
|
|
_strip_cnt = 8;
|
2012-04-12 07:46:35 -04:00
|
|
|
}
|
2012-04-25 17:21:36 -04:00
|
|
|
} else {
|
|
|
|
return -1;
|
2012-04-12 07:46:35 -04:00
|
|
|
}
|
|
|
|
|
2019-10-22 15:39:38 -04:00
|
|
|
if ((child = node.child ("SingleFaderFollowsSelection")) != 0) {
|
|
|
|
child->get_property ("value", _single_fader_follows_selection);
|
|
|
|
} else {
|
|
|
|
_single_fader_follows_selection = false;
|
|
|
|
}
|
|
|
|
|
2012-04-12 12:41:07 -04:00
|
|
|
if ((child = node.child ("Extenders")) != 0) {
|
2016-08-31 01:38:04 -04:00
|
|
|
if (!child->get_property ("value", _extenders)) {
|
|
|
|
_extenders = 0;
|
2012-04-12 12:41:07 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-06-04 18:07:43 -04:00
|
|
|
if ((child = node.child ("MasterPosition")) != 0) {
|
2016-08-31 01:38:04 -04:00
|
|
|
if (child->get_property ("value", _master_position)) {
|
|
|
|
if (_master_position > 0) {
|
|
|
|
_master_position--;
|
2015-06-04 18:07:43 -04:00
|
|
|
}
|
2016-08-31 01:38:04 -04:00
|
|
|
} else {
|
|
|
|
_master_position = 0;
|
2015-06-04 18:07:43 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-04-12 08:58:42 -04:00
|
|
|
if ((child = node.child ("TwoCharacterDisplay")) != 0) {
|
2016-08-31 01:38:04 -04:00
|
|
|
child->get_property ("value", _has_two_character_display);
|
2012-04-12 07:46:35 -04:00
|
|
|
}
|
|
|
|
|
2012-04-12 08:58:42 -04:00
|
|
|
if ((child = node.child ("MasterFader")) != 0) {
|
2016-08-31 01:38:04 -04:00
|
|
|
child->get_property ("value", _has_master_fader);
|
2012-04-12 07:46:35 -04:00
|
|
|
}
|
|
|
|
|
2012-04-12 08:58:42 -04:00
|
|
|
if ((child = node.child ("TimecodeDisplay")) != 0) {
|
2016-08-31 01:38:04 -04:00
|
|
|
child->get_property ("value", _has_timecode_display);
|
2012-04-25 00:42:01 -04:00
|
|
|
} else {
|
|
|
|
_has_timecode_display = false;
|
2012-04-12 07:46:35 -04:00
|
|
|
}
|
|
|
|
|
2012-04-12 13:52:57 -04:00
|
|
|
if ((child = node.child ("GlobalControls")) != 0) {
|
2016-08-31 01:38:04 -04:00
|
|
|
child->get_property ("value", _has_global_controls);
|
2012-04-25 00:42:01 -04:00
|
|
|
} else {
|
|
|
|
_has_global_controls = false;
|
2012-04-12 13:52:57 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if ((child = node.child ("JogWheel")) != 0) {
|
2016-08-31 01:38:04 -04:00
|
|
|
child->get_property ("value", _has_jog_wheel);
|
2012-04-25 00:42:01 -04:00
|
|
|
} else {
|
|
|
|
_has_jog_wheel = false;
|
2012-04-12 13:52:57 -04:00
|
|
|
}
|
|
|
|
|
2012-04-12 14:36:14 -04:00
|
|
|
if ((child = node.child ("TouchSenseFaders")) != 0) {
|
2016-08-31 01:38:04 -04:00
|
|
|
child->get_property ("value", _has_touch_sense_faders);
|
2012-04-25 00:42:01 -04:00
|
|
|
} else {
|
|
|
|
_has_touch_sense_faders = false;
|
2012-04-12 14:36:14 -04:00
|
|
|
}
|
2012-04-15 09:28:45 -04:00
|
|
|
|
2012-04-23 22:28:51 -04:00
|
|
|
if ((child = node.child ("UsesIPMIDI")) != 0) {
|
2016-08-31 01:38:04 -04:00
|
|
|
child->get_property ("value", _uses_ipmidi);
|
2012-04-25 00:42:01 -04:00
|
|
|
} else {
|
|
|
|
_uses_ipmidi = false;
|
2012-04-23 22:28:51 -04:00
|
|
|
}
|
|
|
|
|
2012-05-11 12:04:09 -04:00
|
|
|
if ((child = node.child ("NoHandShake")) != 0) {
|
2016-08-31 01:38:04 -04:00
|
|
|
child->get_property ("value", _no_handshake);
|
2012-05-11 12:04:09 -04:00
|
|
|
} else {
|
|
|
|
_no_handshake = false;
|
|
|
|
}
|
|
|
|
|
2012-05-24 15:27:29 -04:00
|
|
|
if ((child = node.child ("HasMeters")) != 0) {
|
2016-08-31 01:38:04 -04:00
|
|
|
child->get_property ("value", _has_meters);
|
2012-05-24 15:27:29 -04:00
|
|
|
} else {
|
|
|
|
_has_meters = true;
|
|
|
|
}
|
|
|
|
|
2018-02-01 15:39:17 -05:00
|
|
|
if ((child = node.child ("IsQCon")) != 0) {
|
|
|
|
child->get_property ("value", _is_qcon);
|
|
|
|
} else {
|
|
|
|
_is_qcon = false;
|
|
|
|
}
|
2023-03-05 18:08:38 -05:00
|
|
|
|
|
|
|
if ((child = node.child ("IsXTouch")) != 0) {
|
|
|
|
child->get_property ("value", _is_xtouch);
|
|
|
|
} else {
|
|
|
|
_is_xtouch = false;
|
|
|
|
}
|
2018-02-01 15:39:17 -05:00
|
|
|
|
2022-03-04 15:08:31 -05:00
|
|
|
if ((child = node.child ("IsPlatformMp")) != 0) {
|
|
|
|
child->get_property ("value", _is_platformMp);
|
|
|
|
} else {
|
|
|
|
_is_platformMp = false;
|
|
|
|
}
|
|
|
|
|
2022-03-04 15:18:57 -05:00
|
|
|
if ((child = node.child ("IsProG2")) != 0) {
|
|
|
|
child->get_property ("value", _is_proG2);
|
|
|
|
} else {
|
|
|
|
_is_proG2 = false;
|
|
|
|
}
|
|
|
|
|
2021-07-02 17:00:51 -04:00
|
|
|
if ((child = node.child ("HasQConSecondLCD")) != 0) {
|
|
|
|
child->get_property ("value", _has_qcon_second_lcd);
|
|
|
|
} else {
|
|
|
|
_has_qcon_second_lcd = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((child = node.child ("HasQConMasterMeters")) != 0) {
|
|
|
|
child->get_property ("value", _has_qcon_master_meters);
|
|
|
|
} else {
|
|
|
|
_has_qcon_master_meters = false;
|
|
|
|
}
|
|
|
|
|
2015-10-13 10:04:58 -04:00
|
|
|
if ((child = node.child ("HasSeparateMeters")) != 0) {
|
2016-08-31 01:38:04 -04:00
|
|
|
child->get_property ("value", _has_separate_meters);
|
2015-10-13 10:04:58 -04:00
|
|
|
} else {
|
|
|
|
_has_separate_meters = false;
|
|
|
|
}
|
|
|
|
|
2012-04-15 09:28:45 -04:00
|
|
|
if ((child = node.child ("LogicControlButtons")) != 0) {
|
2016-08-31 01:38:04 -04:00
|
|
|
if (child->get_property ("value", _uses_logic_control_buttons)) {
|
2012-04-15 09:28:45 -04:00
|
|
|
if (_uses_logic_control_buttons) {
|
2016-08-31 01:38:04 -04:00
|
|
|
logic_control_buttons ();
|
2012-04-15 09:28:45 -04:00
|
|
|
} else {
|
|
|
|
mackie_control_buttons ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-04-14 15:02:54 -04:00
|
|
|
if ((child = node.child ("Buttons")) != 0) {
|
|
|
|
XMLNodeConstIterator i;
|
|
|
|
const XMLNodeList& nlist (child->children());
|
|
|
|
|
2016-08-31 01:38:04 -04:00
|
|
|
std::string name;
|
2012-04-14 15:02:54 -04:00
|
|
|
for (i = nlist.begin(); i != nlist.end(); ++i) {
|
2016-08-31 01:38:04 -04:00
|
|
|
if ((*i)->name () == "GlobalButton") {
|
|
|
|
if ((*i)->get_property ("name", name)) {
|
|
|
|
int id = Button::name_to_id (name);
|
2012-04-14 15:02:54 -04:00
|
|
|
if (id >= 0) {
|
2016-08-31 01:38:04 -04:00
|
|
|
Button::ID bid = (Button::ID)id;
|
|
|
|
int32_t id;
|
|
|
|
if ((*i)->get_property ("id", id)) {
|
|
|
|
std::map<Button::ID, GlobalButtonInfo>::iterator b = _global_buttons.find (bid);
|
|
|
|
if (b != _global_buttons.end ()) {
|
|
|
|
b->second.id = id;
|
|
|
|
(*i)->get_property ("label", b->second.label);
|
2012-04-14 15:02:54 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-08-31 01:38:04 -04:00
|
|
|
} else if ((*i)->name () == "StripButton") {
|
|
|
|
if ((*i)->get_property ("name", name)) {
|
|
|
|
int id = Button::name_to_id (name);
|
2012-04-14 15:02:54 -04:00
|
|
|
if (id >= 0) {
|
2016-08-31 01:38:04 -04:00
|
|
|
Button::ID bid = (Button::ID)id;
|
|
|
|
int32_t base_id;
|
|
|
|
if ((*i)->get_property ("baseid", base_id)) {
|
|
|
|
std::map<Button::ID, StripButtonInfo>::iterator b = _strip_buttons.find (bid);
|
|
|
|
if (b != _strip_buttons.end ()) {
|
|
|
|
b->second.base_id = base_id;
|
2012-04-14 15:02:54 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-04-12 14:36:14 -04:00
|
|
|
|
2012-04-12 08:16:55 -04:00
|
|
|
return 0;
|
2012-04-12 07:46:35 -04:00
|
|
|
}
|
|
|
|
|
2012-04-12 08:58:42 -04:00
|
|
|
const string&
|
|
|
|
DeviceInfo::name() const
|
|
|
|
{
|
|
|
|
return _name;
|
|
|
|
}
|
|
|
|
|
2012-04-12 07:46:35 -04:00
|
|
|
uint32_t
|
|
|
|
DeviceInfo::strip_cnt() const
|
|
|
|
{
|
|
|
|
return _strip_cnt;
|
|
|
|
}
|
|
|
|
|
2012-04-12 12:41:07 -04:00
|
|
|
uint32_t
|
|
|
|
DeviceInfo::extenders() const
|
|
|
|
{
|
|
|
|
return _extenders;
|
|
|
|
}
|
|
|
|
|
2015-06-04 18:07:43 -04:00
|
|
|
uint32_t
|
|
|
|
DeviceInfo::master_position() const
|
|
|
|
{
|
|
|
|
return _master_position;
|
|
|
|
}
|
|
|
|
|
2012-04-12 07:46:35 -04:00
|
|
|
bool
|
|
|
|
DeviceInfo::has_master_fader() const
|
|
|
|
{
|
|
|
|
return _has_master_fader;
|
|
|
|
}
|
|
|
|
|
2012-05-25 13:56:26 -04:00
|
|
|
bool
|
|
|
|
DeviceInfo::has_meters() const
|
|
|
|
{
|
|
|
|
return _has_meters;
|
|
|
|
}
|
|
|
|
|
2019-10-20 23:24:17 -04:00
|
|
|
bool
|
|
|
|
DeviceInfo::single_fader_follows_selection() const
|
|
|
|
{
|
|
|
|
return _single_fader_follows_selection;
|
|
|
|
}
|
|
|
|
|
2015-10-13 15:34:53 -04:00
|
|
|
bool
|
|
|
|
DeviceInfo::has_separate_meters() const
|
|
|
|
{
|
2016-01-31 12:58:46 -05:00
|
|
|
return _has_separate_meters;
|
2015-10-13 15:34:53 -04:00
|
|
|
}
|
|
|
|
|
2012-04-12 07:46:35 -04:00
|
|
|
bool
|
|
|
|
DeviceInfo::has_two_character_display() const
|
|
|
|
{
|
|
|
|
return _has_two_character_display;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
DeviceInfo::has_timecode_display () const
|
|
|
|
{
|
|
|
|
return _has_timecode_display;
|
|
|
|
}
|
|
|
|
|
2012-04-23 22:28:51 -04:00
|
|
|
bool
|
|
|
|
DeviceInfo::uses_ipmidi () const
|
|
|
|
{
|
|
|
|
return _uses_ipmidi;
|
|
|
|
}
|
|
|
|
|
2012-04-12 13:52:57 -04:00
|
|
|
bool
|
|
|
|
DeviceInfo::has_global_controls () const
|
|
|
|
{
|
|
|
|
return _has_global_controls;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
DeviceInfo::has_jog_wheel () const
|
|
|
|
{
|
|
|
|
return _has_jog_wheel;
|
|
|
|
}
|
|
|
|
|
2012-05-11 12:04:09 -04:00
|
|
|
bool
|
|
|
|
DeviceInfo::no_handshake () const
|
|
|
|
{
|
|
|
|
return _no_handshake;
|
|
|
|
}
|
|
|
|
|
2018-02-01 15:39:17 -05:00
|
|
|
bool
|
|
|
|
DeviceInfo::is_qcon () const
|
|
|
|
{
|
|
|
|
return _is_qcon;
|
|
|
|
}
|
|
|
|
|
2022-03-04 15:08:31 -05:00
|
|
|
bool DeviceInfo::is_platformMp () const
|
|
|
|
{
|
|
|
|
return _is_platformMp;
|
|
|
|
}
|
|
|
|
|
2022-03-04 15:18:57 -05:00
|
|
|
bool DeviceInfo::is_proG2 () const
|
|
|
|
{
|
|
|
|
return _is_proG2;
|
|
|
|
}
|
|
|
|
|
2023-03-05 18:08:38 -05:00
|
|
|
bool DeviceInfo::is_xtouch () const
|
|
|
|
{
|
|
|
|
return _is_xtouch;
|
|
|
|
}
|
|
|
|
|
2021-07-02 17:00:51 -04:00
|
|
|
bool
|
|
|
|
DeviceInfo::has_qcon_second_lcd () const
|
|
|
|
{
|
|
|
|
return _has_qcon_second_lcd;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
DeviceInfo::has_qcon_master_meters () const
|
|
|
|
{
|
|
|
|
return _has_qcon_master_meters;
|
|
|
|
}
|
|
|
|
|
2012-04-12 14:36:14 -04:00
|
|
|
bool
|
|
|
|
DeviceInfo::has_touch_sense_faders () const
|
|
|
|
{
|
|
|
|
return _has_touch_sense_faders;
|
|
|
|
}
|
|
|
|
|
2012-04-17 16:41:31 -04:00
|
|
|
static const char * const devinfo_env_variable_name = "ARDOUR_MCP_PATH";
|
|
|
|
static const char* const devinfo_dir_name = "mcp";
|
|
|
|
static const char* const devinfo_suffix = ".device";
|
2012-04-12 08:58:42 -04:00
|
|
|
|
2013-08-15 06:04:08 -04:00
|
|
|
static Searchpath
|
2012-05-18 13:24:06 -04:00
|
|
|
devinfo_search_path ()
|
2012-04-12 08:58:42 -04:00
|
|
|
{
|
|
|
|
bool devinfo_path_defined = false;
|
2012-06-23 01:06:54 -04:00
|
|
|
std::string spath_env (Glib::getenv (devinfo_env_variable_name, devinfo_path_defined));
|
2012-04-12 08:58:42 -04:00
|
|
|
|
|
|
|
if (devinfo_path_defined) {
|
|
|
|
return spath_env;
|
|
|
|
}
|
|
|
|
|
2013-08-15 06:04:08 -04:00
|
|
|
Searchpath spath (ardour_data_search_path());
|
2012-04-12 08:58:42 -04:00
|
|
|
spath.add_subdirectory_to_paths(devinfo_dir_name);
|
|
|
|
|
2012-05-05 16:29:46 -04:00
|
|
|
return spath;
|
2012-04-12 08:58:42 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
2013-09-05 05:03:07 -04:00
|
|
|
devinfo_filter (const string &str, void* /*arg*/)
|
2012-04-12 08:58:42 -04:00
|
|
|
{
|
|
|
|
return (str.length() > strlen(devinfo_suffix) &&
|
|
|
|
str.find (devinfo_suffix) == (str.length() - strlen (devinfo_suffix)));
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
DeviceInfo::reload_device_info ()
|
|
|
|
{
|
|
|
|
vector<string> s;
|
2014-06-16 06:39:45 -04:00
|
|
|
vector<string> devinfos;
|
2013-08-15 06:04:08 -04:00
|
|
|
Searchpath spath (devinfo_search_path());
|
2012-04-12 08:58:42 -04:00
|
|
|
|
2014-06-19 04:26:17 -04:00
|
|
|
find_files_matching_filter (devinfos, spath, devinfo_filter, 0, false, true);
|
2012-04-12 08:58:42 -04:00
|
|
|
device_info.clear ();
|
|
|
|
|
2014-06-16 06:39:45 -04:00
|
|
|
if (devinfos.empty()) {
|
2012-04-12 08:58:42 -04:00
|
|
|
error << "No MCP device info files found using " << spath.to_string() << endmsg;
|
|
|
|
std::cerr << "No MCP device info files found using " << spath.to_string() << std::endl;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-06-16 06:39:45 -04:00
|
|
|
for (vector<string>::iterator i = devinfos.begin(); i != devinfos.end(); ++i) {
|
|
|
|
string fullpath = *i;
|
2015-10-03 16:15:18 -04:00
|
|
|
DeviceInfo di; // has to be initial every loop or info from last added.
|
2012-04-12 08:58:42 -04:00
|
|
|
|
|
|
|
XMLTree tree;
|
|
|
|
|
|
|
|
if (!tree.read (fullpath.c_str())) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
XMLNode* root = tree.root ();
|
|
|
|
if (!root) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2012-04-12 12:41:07 -04:00
|
|
|
if (di.set_state (*root, 3000) == 0) { /* version is ignored for now */
|
|
|
|
device_info[di.name()] = di;
|
|
|
|
}
|
2012-04-12 08:58:42 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-04-12 12:41:07 -04:00
|
|
|
std::ostream& operator<< (std::ostream& os, const Mackie::DeviceInfo& di)
|
|
|
|
{
|
2015-10-04 14:51:05 -04:00
|
|
|
os << di.name() << ' '
|
2012-04-12 12:41:07 -04:00
|
|
|
<< di.strip_cnt() << ' '
|
|
|
|
<< di.extenders() << ' '
|
2015-06-04 18:07:43 -04:00
|
|
|
<< di.master_position() << ' '
|
2012-04-12 12:41:07 -04:00
|
|
|
;
|
|
|
|
return os;
|
|
|
|
}
|