13
0

MCU/UF8: Continued work to special case Mackie surface

* Use dedicated port-names for UFx
* Do not show SSL-UFx device-info files in MCU
* Fix Window namespacing/missing symbols
* Address Windows ambiguous symbols (Button, Surface)
  Those used to have a Mackie:: prefix, now they need
  MACKIE_NAMESPACE

When re-opening the GUI, there is still a somewha mysterious warning:
```
glibmm-WARNING **: file value_custom.cc: (Glib::custom_boxed_type_register): The type name `glibmm__CustomBoxed_N13ArdourSurface6NS_UF86Button2IDE' has been registered already.
```
This commit is contained in:
Robin Gareus 2023-08-25 18:08:56 +02:00
parent 70a4f29c59
commit c0366a5f13
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
7 changed files with 82 additions and 64 deletions

View File

@ -30,6 +30,7 @@
#include "pbd/convert.h"
#include "pbd/stl_delete.h"
#include "ardour/debug.h"
#include "ardour/filesystem_paths.h"
#include "device_info.h"
@ -44,7 +45,7 @@ using namespace ArdourSurface::MACKIE_NAMESPACE;
using std::string;
using std::vector;
std::map<std::string,DeviceInfo> DeviceInfo::device_info;
std::map<std::string,DeviceInfo> MACKIE_NAMESPACE::DeviceInfo::device_info;
DeviceInfo::DeviceInfo()
: _strip_cnt (8)
@ -582,11 +583,12 @@ devinfo_filter (const string &str, void* /*arg*/)
{
#ifdef UF8
return (str.length() > strlen(devinfo_suffix) &&
str.find ("uf8") != string::npos &&
str.find ("ssl-uf") != string::npos &&
str.find (devinfo_suffix) == (str.length() - strlen (devinfo_suffix))
);
#else
return (str.length() > strlen(devinfo_suffix) &&
str.find ("ssl-uf") == string::npos &&
str.find (devinfo_suffix) == (str.length() - strlen (devinfo_suffix)));
#endif
}
@ -601,6 +603,8 @@ DeviceInfo::reload_device_info ()
find_files_matching_filter (devinfos, spath, devinfo_filter, 0, false, true);
device_info.clear ();
DEBUG_TRACE (DEBUG::MackieControl, "DeviceProfile::reload_device_info\n");
if (devinfos.empty()) {
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;
@ -623,6 +627,7 @@ DeviceInfo::reload_device_info ()
}
if (di.set_state (*root, 3000) == 0) { /* version is ignored for now */
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Found profile '%1'\n", di.name ()));
device_info[di.name()] = di;
}
}

View File

@ -30,6 +30,7 @@
#include "pbd/stl_delete.h"
#include "pbd/replace_all.h"
#include "ardour/debug.h"
#include "ardour/filesystem_paths.h"
#include "mackie_control_protocol.h"
@ -45,7 +46,8 @@ using namespace ArdourSurface::MACKIE_NAMESPACE;
using std::string;
using std::vector;
std::map<std::string,DeviceProfile> DeviceProfile::device_profiles;
std::map<std::string,DeviceProfile> MACKIE_NAMESPACE::DeviceProfile::device_profiles;
const std::string DeviceProfile::edited_indicator (" (edited)");
const std::string DeviceProfile::default_profile_name ("User");
@ -102,6 +104,8 @@ DeviceProfile::reload_device_profiles ()
find_files_matching_filter (devprofiles, spath, devprofile_filter, 0, false, true);
device_profiles.clear ();
DEBUG_TRACE (DEBUG::MackieControl, "DeviceProfile::reload_device_profiles\n");
if (devprofiles.empty()) {
error << "No MCP device info files found using " << spath.to_string() << endmsg;
return;
@ -123,6 +127,7 @@ DeviceProfile::reload_device_profiles ()
}
if (dp.set_state (*root, 3000) == 0) { /* version is ignored for now */
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Found profile '%1'\n", dp.name ()));
dp.set_path (fullpath);
device_profiles[dp.name()] = dp;
}

View File

@ -293,7 +293,7 @@ MackieControlProtocolGUI::connection_handler ()
for (ic = input_combos.begin(), oc = output_combos.begin(); ic != input_combos.end() && oc != output_combos.end(); ++ic, ++oc) {
std::shared_ptr<Surface> surface = _cp.get_surface_by_raw_pointer ((*ic)->get_data ("surface"));
std::shared_ptr<MACKIE_NAMESPACE::Surface> surface = _cp.get_surface_by_raw_pointer ((*ic)->get_data ("surface"));
if (surface) {
update_port_combos (midi_inputs, midi_outputs, *ic, *oc, surface);
@ -305,7 +305,7 @@ void
MackieControlProtocolGUI::update_port_combos (vector<string> const& midi_inputs, vector<string> const& midi_outputs,
Gtk::ComboBox* input_combo,
Gtk::ComboBox* output_combo,
std::shared_ptr<Surface> surface)
std::shared_ptr<MACKIE_NAMESPACE::Surface> surface)
{
Glib::RefPtr<Gtk::ListStore> input = build_midi_port_list (midi_inputs, true);
Glib::RefPtr<Gtk::ListStore> output = build_midi_port_list (midi_outputs, false);
@ -389,7 +389,7 @@ MackieControlProtocolGUI::device_dependent_widget ()
for (uint32_t n = 0; n < n_surfaces; ++n) {
std::shared_ptr<Surface> surface = _cp.nth_surface (n);
std::shared_ptr<MACKIE_NAMESPACE::Surface> surface = _cp.nth_surface (n);
if (!surface) {
PBD::fatal << string_compose (_("programming error: %1\n"), string_compose ("n=%1 surface not found!", n)) << endmsg;
@ -408,7 +408,7 @@ MackieControlProtocolGUI::device_dependent_widget ()
output_combo->set_data ("surface", surface.get());
output_combos.push_back (output_combo);
std::weak_ptr<Surface> ws (surface);
std::weak_ptr<MACKIE_NAMESPACE::Surface> ws (surface);
input_combo->signal_changed().connect (sigc::bind (sigc::mem_fun (*this, &MackieControlProtocolGUI::active_port_changed), input_combo, ws, true));
output_combo->signal_changed().connect (sigc::bind (sigc::mem_fun (*this, &MackieControlProtocolGUI::active_port_changed), output_combo, ws, false));
@ -825,13 +825,13 @@ MackieControlProtocolGUI::build_midi_port_list (vector<string> const & ports, bo
}
void
MackieControlProtocolGUI::active_port_changed (Gtk::ComboBox* combo, std::weak_ptr<Surface> ws, bool for_input)
MackieControlProtocolGUI::active_port_changed (Gtk::ComboBox* combo, std::weak_ptr<MACKIE_NAMESPACE::Surface> ws, bool for_input)
{
if (ignore_active_change) {
return;
}
std::shared_ptr<Surface> surface = ws.lock();
std::shared_ptr<MACKIE_NAMESPACE::Surface> surface = ws.lock();
if (!surface) {
return;

View File

@ -84,14 +84,14 @@ class MackieControlProtocolGUI : public Gtk::Notebook
add (cmdalt);
add (shiftcontrol);
};
Gtk::TreeModelColumn<std::string> name;
Gtk::TreeModelColumn<MACKIE_NAMESPACE::Button::ID> id;
Gtk::TreeModelColumn<std::string> plain;
Gtk::TreeModelColumn<std::string> shift;
Gtk::TreeModelColumn<std::string> control;
Gtk::TreeModelColumn<std::string> option;
Gtk::TreeModelColumn<std::string> cmdalt;
Gtk::TreeModelColumn<std::string> shiftcontrol;
Gtk::TreeModelColumn<std::string> name;
Gtk::TreeModelColumn<MACKIE_NAMESPACE::Button::ID> id;
Gtk::TreeModelColumn<std::string> plain;
Gtk::TreeModelColumn<std::string> shift;
Gtk::TreeModelColumn<std::string> control;
Gtk::TreeModelColumn<std::string> option;
Gtk::TreeModelColumn<std::string> cmdalt;
Gtk::TreeModelColumn<std::string> shiftcontrol;
};
FunctionKeyColumns function_key_columns;

View File

@ -100,20 +100,20 @@ using namespace ArdourSurface::MACKIE_NAMESPACE;
#include "pbd/abstract_ui.cc" // instantiate template
const int MackieControlProtocol::MODIFIER_OPTION = 0x1;
const int MackieControlProtocol::MODIFIER_CONTROL = 0x2;
const int MackieControlProtocol::MODIFIER_SHIFT = 0x4;
const int MackieControlProtocol::MODIFIER_CMDALT = 0x8;
const int MackieControlProtocol::MODIFIER_ZOOM = 0x10;
const int MackieControlProtocol::MODIFIER_SCRUB = 0x20;
const int MackieControlProtocol::MODIFIER_MARKER = 0x40;
const int MackieControlProtocol::MODIFIER_NUDGE = 0x80;
const int MackieControlProtocol::MAIN_MODIFIER_MASK = (MackieControlProtocol::MODIFIER_OPTION|
const int MACKIE_NAMESPACE::MackieControlProtocol::MODIFIER_OPTION = 0x1;
const int MACKIE_NAMESPACE::MackieControlProtocol::MODIFIER_CONTROL = 0x2;
const int MACKIE_NAMESPACE::MackieControlProtocol::MODIFIER_SHIFT = 0x4;
const int MACKIE_NAMESPACE::MackieControlProtocol::MODIFIER_CMDALT = 0x8;
const int MACKIE_NAMESPACE::MackieControlProtocol::MODIFIER_ZOOM = 0x10;
const int MACKIE_NAMESPACE::MackieControlProtocol::MODIFIER_SCRUB = 0x20;
const int MACKIE_NAMESPACE::MackieControlProtocol::MODIFIER_MARKER = 0x40;
const int MACKIE_NAMESPACE::MackieControlProtocol::MODIFIER_NUDGE = 0x80;
const int MACKIE_NAMESPACE::MackieControlProtocol::MAIN_MODIFIER_MASK = (MackieControlProtocol::MODIFIER_OPTION|
MackieControlProtocol::MODIFIER_CONTROL|
MackieControlProtocol::MODIFIER_SHIFT|
MackieControlProtocol::MODIFIER_CMDALT);
MackieControlProtocol* MackieControlProtocol::_instance = 0;
MACKIE_NAMESPACE::MackieControlProtocol* MACKIE_NAMESPACE::MackieControlProtocol::_instance = 0;
MackieControlProtocol::MackieControlProtocol (Session& session)
: ControlProtocol (session, X_("Mackie"))
@ -211,8 +211,8 @@ MackieControlProtocol::ping_devices ()
{
Glib::Threads::Mutex::Lock lm (surfaces_lock);
for (Surfaces::const_iterator si = surfaces.begin(); si != surfaces.end(); ++si) {
(*si)->connected ();
for (auto const& si : surfaces) {
si->connected ();
}
}
}
@ -624,9 +624,9 @@ MackieControlProtocol::update_timecode_beats_led()
}
void
MackieControlProtocol::update_global_button (int id, LedState ls)
MackieControlProtocol::update_global_button (int id, MACKIE_NAMESPACE::LedState ls)
{
std::shared_ptr<Surface> surface;
std::shared_ptr<MACKIE_NAMESPACE::Surface> surface;
{
Glib::Threads::Mutex::Lock lm (surfaces_lock);
@ -652,7 +652,7 @@ MackieControlProtocol::update_global_button (int id, LedState ls)
}
void
MackieControlProtocol::update_global_led (int id, LedState ls)
MackieControlProtocol::update_global_led (int id, MACKIE_NAMESPACE::LedState ls)
{
Glib::Threads::Mutex::Lock lm (surfaces_lock);
@ -663,7 +663,7 @@ MackieControlProtocol::update_global_led (int id, LedState ls)
if (!_device_info.has_global_controls()) {
return;
}
std::shared_ptr<Surface> surface = _master_surface;
std::shared_ptr<MACKIE_NAMESPACE::Surface> surface = _master_surface;
map<int,Control*>::iterator x = surface->controls_by_device_independent_id.find (id);
@ -879,7 +879,11 @@ MackieControlProtocol::create_surfaces ()
if (_device_info.extenders() == 0) {
device_name = _device_info.name();
} else {
#ifdef UF8
device_name = X_("SSL-UFx");
#else
device_name = X_("mackie control");
#endif
}
}
@ -890,7 +894,7 @@ MackieControlProtocol::create_surfaces ()
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Port Name for surface %1 is %2\n", n, device_name));
std::shared_ptr<Surface> surface;
std::shared_ptr<MACKIE_NAMESPACE::Surface> surface;
if (is_master) {
stype = mcu;
@ -898,7 +902,7 @@ MackieControlProtocol::create_surfaces ()
stype = ext;
}
try {
surface.reset (new Surface (*this, device_name, n, stype));
surface.reset (new MACKIE_NAMESPACE::Surface (*this, device_name, n, stype));
} catch (...) {
return -1;
}
@ -1213,7 +1217,7 @@ MackieControlProtocol::update_timecode_display()
return;
}
std::shared_ptr<Surface> surface = _master_surface;
std::shared_ptr<MACKIE_NAMESPACE::Surface> surface = _master_surface;
if (surface->type() != mcu || !_device_info.has_timecode_display() || !surface->active ()) {
return;
@ -1315,7 +1319,7 @@ MackieControlProtocol::notify_monitor_added_or_removed ()
void
MackieControlProtocol::notify_solo_active_changed (bool active)
{
std::shared_ptr<Surface> surface;
std::shared_ptr<MACKIE_NAMESPACE::Surface> surface;
{
Glib::Threads::Mutex::Lock lm (surfaces_lock);
@ -1407,7 +1411,7 @@ MackieControlProtocol::notify_record_state_changed ()
return;
}
std::shared_ptr<Surface> surface;
std::shared_ptr<MACKIE_NAMESPACE::Surface> surface;
{
Glib::Threads::Mutex::Lock lm (surfaces_lock);
@ -1494,7 +1498,7 @@ MackieControlProtocol::stop ()
}
void
MackieControlProtocol::update_led (Surface& surface, Button& button, MACKIE_NAMESPACE::LedState ls)
MackieControlProtocol::update_led (MACKIE_NAMESPACE::Surface& surface, MACKIE_NAMESPACE::Button& button, MACKIE_NAMESPACE::LedState ls)
{
if (ls != none) {
surface.port().write (button.set_state (ls));
@ -1615,7 +1619,7 @@ MackieControlProtocol::build_device_specific_button_map()
}
void
MackieControlProtocol::handle_button_event (Surface& surface, Button& button, ButtonState bs)
MackieControlProtocol::handle_button_event (MACKIE_NAMESPACE::Surface& surface, MACKIE_NAMESPACE::Button& button, MACKIE_NAMESPACE::ButtonState bs)
{
Button::ID button_id = button.bid();
@ -1788,7 +1792,7 @@ MackieControlProtocol::redisplay_subview_mode ()
}
bool
MackieControlProtocol::set_subview_mode (Subview::Mode sm, std::shared_ptr<Stripable> r)
MackieControlProtocol::set_subview_mode (MACKIE_NAMESPACE::Subview::Mode sm, std::shared_ptr<Stripable> r)
{
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("set subview mode %1 with stripable %2, current flip mode %3\n", sm, (r ? r->name() : string ("null")), _flip_mode));
@ -2282,8 +2286,8 @@ MackieControlProtocol::recalibrate_faders ()
{
Glib::Threads::Mutex::Lock lm (surfaces_lock);
for (Surfaces::const_iterator s = surfaces.begin(); s != surfaces.end(); ++s) {
(*s)->recalibrate_faders ();
for (auto const& s : surfaces) {
s->recalibrate_faders ();
}
}
@ -2292,26 +2296,26 @@ MackieControlProtocol::toggle_backlight ()
{
Glib::Threads::Mutex::Lock lm (surfaces_lock);
for (Surfaces::const_iterator s = surfaces.begin(); s != surfaces.end(); ++s) {
(*s)->toggle_backlight ();
for (auto const& s : surfaces) {
s->toggle_backlight ();
}
}
std::shared_ptr<Surface>
std::shared_ptr<MACKIE_NAMESPACE::Surface>
MackieControlProtocol::get_surface_by_raw_pointer (void* ptr) const
{
Glib::Threads::Mutex::Lock lm (surfaces_lock);
for (Surfaces::const_iterator s = surfaces.begin(); s != surfaces.end(); ++s) {
if ((*s).get() == (Surface*) ptr) {
return *s;
for (auto const& s : surfaces) {
if (s.get() == (MACKIE_NAMESPACE::Surface*) ptr) {
return s;
}
}
return std::shared_ptr<Surface> ();
return std::shared_ptr<MACKIE_NAMESPACE::Surface> ();
}
std::shared_ptr<Surface>
std::shared_ptr<MACKIE_NAMESPACE::Surface>
MackieControlProtocol::nth_surface (uint32_t n) const
{
Glib::Threads::Mutex::Lock lm (surfaces_lock);
@ -2322,7 +2326,7 @@ MackieControlProtocol::nth_surface (uint32_t n) const
}
}
return std::shared_ptr<Surface> ();
return std::shared_ptr<MACKIE_NAMESPACE::Surface> ();
}
void
@ -2480,14 +2484,14 @@ MackieControlProtocol::first_selected_stripable () const
}
uint32_t
MackieControlProtocol::global_index (Strip& strip)
MackieControlProtocol::global_index (MACKIE_NAMESPACE::Strip& strip)
{
Glib::Threads::Mutex::Lock lm (surfaces_lock);
return global_index_locked (strip);
}
uint32_t
MackieControlProtocol::global_index_locked (Strip& strip)
MackieControlProtocol::global_index_locked (MACKIE_NAMESPACE::Strip& strip)
{
uint32_t global = 0;

View File

@ -122,7 +122,7 @@ class MackieControlProtocol
int set_active (bool yn);
int set_device (const std::string&, bool force);
void set_profile (const std::string&);
void set_profile (const std::string&);
FlipMode flip_mode () const { return _flip_mode; }
ViewMode view_mode () const { return _view_mode; }

View File

@ -60,20 +60,24 @@ SurfacePort::SurfacePort (Surface& s)
} else {
string in_name;
string out_name;
#ifdef UF8
string in_name = X_("SSL-UFx control in");
string out_name = X_("SSL-UFx control out");
#else
string in_name = X_("mackie control in");
string out_name = X_("mackie control out");
#endif
if (_surface->mcp().device_info().extenders() > 0) {
if (_surface->number() == _surface->mcp().device_info().master_position()) {
in_name = X_("mackie control in");
out_name = X_("mackie control out");
} else {
if (_surface->number() != _surface->mcp().device_info().master_position()) {
#ifdef UF8
in_name = string_compose (X_("SSL-UFx control in ext %1"), (_surface->number() + 1));
out_name = string_compose (X_("SSL-UFx control out ext %1"), _surface->number() + 1);
#else
in_name = string_compose (X_("mackie control in ext %1"), (_surface->number() + 1));
out_name = string_compose (X_("mackie control out ext %1"), _surface->number() + 1);
#endif
}
} else {
in_name = X_("mackie control in");
out_name = X_("mackie control out");
}
_async_in = AudioEngine::instance()->register_input_port (DataType::MIDI, in_name, true);