Use XMLNode::get/set_property API in ARDOUR::Diskstream
[ardour.git] / libs / ardour / port_manager.cc
index a7341c442dab60f0418be6e8cf4332698202e4a5..268d7cb9feb3b6be80fe6d27089ffadb3b2f082b 100644 (file)
@@ -896,6 +896,7 @@ PortManager::port_is_control_only (std::string const& name)
                const char * const control_only_ports[] = {
                        X_(".*Ableton Push.*"),
                        X_(".*FaderPort .*"),
+                       X_(".*FaderPort8 .*"),
                };
 
                pattern = "(";
@@ -1069,7 +1070,6 @@ PortManager::save_midi_port_info ()
                for (MidiPortInfo::iterator i = midi_port_info.begin(); i != midi_port_info.end(); ++i) {
                        XMLNode* node = new XMLNode (X_("port"));
                        node->add_property (X_("name"), i->first);
-                       node->add_property (X_("pretty-name"), i->second.pretty_name);
                        node->add_property (X_("input"), i->second.input ? X_("yes") : X_("no"));
                        node->add_property (X_("properties"), enum_2_string (i->second.properties));
                        root->add_child_nocopy (*node);
@@ -1113,11 +1113,6 @@ PortManager::load_midi_port_info ()
 
                name = prop->value ();
 
-               if ((prop = (*i)->property (X_("pretty-name"))) == 0) {
-                       continue;
-               }
-               mpi.pretty_name = prop->value();
-
                if ((prop = (*i)->property (X_("input"))) == 0) {
                        continue;
                }
@@ -1212,19 +1207,25 @@ PortManager::fill_midi_port_info_locked ()
        for (MidiPortInfo::iterator x = midi_port_info.begin(); x != midi_port_info.end(); ++x) {
                PortEngine::PortHandle ph = _backend->get_port_by_name (x->first);
 
+               if (!ph) {
+                       /* port info saved from some condition where this port
+                        * existed, but no longer does (i.e. device unplugged
+                        * at present)
+                        */
+                       continue;
+               }
+
                if (x->second.pretty_name != x->first) {
                        /* name set in port info ... propagate */
                        _backend->set_port_property (ph, "http://jackaudio.org/metadata/pretty-name", x->second.pretty_name, string());
                } else {
                        /* check with backend for pre-existing pretty name */
-                       if (ph) {
-                               string value;
-                               string type;
-                               if (0 == _backend->get_port_property (ph,
-                                                                     "http://jackaudio.org/metadata/pretty-name",
-                                                                     value, type)) {
-                                       x->second.pretty_name = value;
-                               }
+                       string value;
+                       string type;
+                       if (0 == _backend->get_port_property (ph,
+                                                             "http://jackaudio.org/metadata/pretty-name",
+                                                             value, type)) {
+                               x->second.pretty_name = value;
                        }
                }
        }