diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2015-12-09 00:12:19 -0500 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2015-12-09 00:12:28 -0500 |
commit | 014f010489768a3f0df60cf21f5545460248147d (patch) | |
tree | ba2b27c9e9c9bc58f15b0a0df0dc15ada8729fd6 /libs | |
parent | c88ad30ea0222ebb32939f5449531c2b4eeccf31 (diff) |
if Mackie device profile name is empty, use a default name that makes sense and that will be rediscovered on next startup
Diffstat (limited to 'libs')
-rw-r--r-- | libs/surfaces/mackie/mackie_control_protocol.cc | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/libs/surfaces/mackie/mackie_control_protocol.cc b/libs/surfaces/mackie/mackie_control_protocol.cc index 9e05dbc5a3..e0ef35f15b 100644 --- a/libs/surfaces/mackie/mackie_control_protocol.cc +++ b/libs/surfaces/mackie/mackie_control_protocol.cc @@ -31,6 +31,7 @@ #include <errno.h> #include <boost/shared_array.hpp> +#include <glibmm/miscutils.h> #include "midi++/types.h" #include "midi++/port.h" @@ -720,11 +721,13 @@ MackieControlProtocol::set_profile (const string& profile_name) if (profile_name == "default") { /* reset to default */ _device_profile = DeviceProfile (profile_name); + return; } map<string,DeviceProfile>::iterator d = DeviceProfile::device_profiles.find (profile_name); if (d == DeviceProfile::device_profiles.end()) { + _device_profile = DeviceProfile (profile_name); return; } @@ -1051,7 +1054,17 @@ MackieControlProtocol::set_state (const XMLNode & node, int version) } if ((prop = node.property (X_("device-profile"))) != 0) { - set_profile (prop->value()); + if (prop->value().empty()) { + string default_profile_name; + + default_profile_name = Glib::get_user_name(); + default_profile_name += ' '; + default_profile_name += _device_info.name(); + + set_profile (default_profile_name); + } else { + set_profile (prop->value()); + } } XMLNode* dnode = node.child (X_("Configurations")); |