13
0

MCP: more surface properties, correctly close IOSources when switching surfaces; write select button msgs one by one, change port name back to generic terms

git-svn-id: svn://localhost/ardour2/branches/3.0@11945 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2012-04-12 17:52:57 +00:00
parent cd78f52bd8
commit 17b442971b
7 changed files with 49 additions and 28 deletions

View File

@ -45,6 +45,8 @@ DeviceInfo::DeviceInfo()
, _has_master_fader (true)
, _has_segmented_display (false)
, _has_timecode_display (true)
, _has_global_controls (true)
, _has_jog_wheel (true)
, _name (X_("Mackie Control Universal Pro"))
{
@ -114,6 +116,18 @@ DeviceInfo::set_state (const XMLNode& node, int /* version */)
}
}
if ((child = node.child ("GlobalControls")) != 0) {
if ((prop = child->property ("value")) != 0) {
_has_global_controls = string_is_affirmative (prop->value());
}
}
if ((child = node.child ("JogWheel")) != 0) {
if ((prop = child->property ("value")) != 0) {
_has_jog_wheel = string_is_affirmative (prop->value());
}
}
return 0;
}
@ -159,6 +173,18 @@ DeviceInfo::has_timecode_display () const
return _has_timecode_display;
}
bool
DeviceInfo::has_global_controls () const
{
return _has_global_controls;
}
bool
DeviceInfo::has_jog_wheel () const
{
return _has_jog_wheel;
}
static const char * const devinfo_env_variable_name = "ARDOUR_MCP_DEVINFO_PATH";
static const char* const devinfo_dir_name = "mcp_devices";
static const char* const devinfo_suffix = ".xml";

View File

@ -43,6 +43,8 @@ class DeviceInfo
bool has_master_fader () const;
bool has_segmented_display() const;
bool has_timecode_display() const;
bool has_global_controls() const;
bool has_jog_wheel () const;
const std::string& name() const;
static std::map<std::string,DeviceInfo> device_info;
@ -55,6 +57,8 @@ class DeviceInfo
bool _has_master_fader;
bool _has_segmented_display;
bool _has_timecode_display;
bool _has_global_controls;
bool _has_jog_wheel;
std::string _name;
};

View File

@ -354,7 +354,6 @@ MackieControlProtocol::set_active (bool yn)
create_surfaces ();
connect_session_signals ();
_active = true;
update_surfaces ();
@ -508,6 +507,7 @@ MackieControlProtocol::set_device (const string& device_name)
_device_info = d->second;
if (_active) {
clear_ports ();
surfaces.clear ();
create_surfaces ();
switch_banks (0, true);
@ -517,9 +517,8 @@ MackieControlProtocol::set_device (const string& device_name)
void
MackieControlProtocol::create_surfaces ()
{
string device_name = _device_info.name();
string device_name = X_("MC Main");
surface_type_t stype = mcu;
char buf[128];
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Create %1 surfaces\n", 1 + _device_info.extenders()));
@ -530,8 +529,7 @@ MackieControlProtocol::create_surfaces ()
/* next device will be an extender */
snprintf (buf, sizeof (buf), "%s XT%d", _device_info.name().c_str(), n+1);
device_name = buf;
device_name = X_("MC Extender");
stype = ext;
_input_bundle->add_channel (

View File

@ -138,23 +138,18 @@ Surface::Surface (MackieControlProtocol& mcp, const std::string& device_name, ui
_port = new SurfacePort (*this);
switch (stype) {
case mcu:
if (_mcp.device_info().has_global_controls()) {
init_controls ();
_jog_wheel = new Mackie::JogWheel (_mcp);
break;
default:
break;
}
switch (stype) {
case mcu:
case ext:
strips.resize (8);
init_strips ();
break;
default:
break;
if (_mcp.device_info().has_jog_wheel()) {
_jog_wheel = new Mackie::JogWheel (_mcp);
}
uint32_t n = _mcp.device_info().strip_cnt();
if (n) {
init_strips (n);
}
connect_to_signals ();
@ -237,9 +232,9 @@ static StripControlDefinition mackie_strip_controls[] = {
};
void
Surface::init_strips ()
Surface::init_strips (uint32_t n)
{
for (uint32_t i = 0; i < 8; ++i) {
for (uint32_t i = 0; i < n; ++i) {
char name[32];
@ -248,7 +243,7 @@ Surface::init_strips ()
Strip* strip = new Strip (*this, name, i, mackie_strip_controls);
groups[name] = strip;
strips[i] = strip;
strips.push_back (strip);
}
}
@ -833,12 +828,8 @@ Surface::update_view_mode_display ()
void
Surface::gui_selection_changed (ARDOUR::RouteNotificationListPtr routes)
{
MidiByteArray msg;
for (Strips::iterator s = strips.begin(); s != strips.end(); ++s) {
msg << (*s)->gui_selection_changed (routes);
_port->write ((*s)->gui_selection_changed (routes));
}
_port->write (msg);
}

View File

@ -151,7 +151,7 @@ public:
protected:
void init_controls();
void init_strips ();
void init_strips (uint32_t n);
private:
MackieControlProtocol& _mcp;

View File

@ -8,4 +8,5 @@
<TwoCharacterDisplay value="yes"/>
<Extenders value="0"/>
<GlobalControls value="yes"/>
<JogWheel value="yes"/>
</MackieProtocolDevice>

View File

@ -8,4 +8,5 @@
<TwoCharacterDisplay value="yes"/>
<Extenders value="1"/>
<GlobalControls value="yes"/>
<JogWheel value="no"/>
</MackieProtocolDevice>