summaryrefslogtreecommitdiff
path: root/libs/midi++2/midnam_patch.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libs/midi++2/midnam_patch.cc')
-rw-r--r--libs/midi++2/midnam_patch.cc62
1 files changed, 58 insertions, 4 deletions
diff --git a/libs/midi++2/midnam_patch.cc b/libs/midi++2/midnam_patch.cc
index f48ae7b6e2..1608b418b0 100644
--- a/libs/midi++2/midnam_patch.cc
+++ b/libs/midi++2/midnam_patch.cc
@@ -129,7 +129,6 @@ Patch::set_state (const XMLTree&, const XMLNode& node)
_id.program_number = PBD::atoi(program_change);
}
-
return 0;
}
@@ -143,7 +142,6 @@ Note::get_state (void)
return *node;
}
-
int
Note::set_state (const XMLTree&, const XMLNode& node)
{
@@ -179,6 +177,52 @@ NoteNameList::set_state (const XMLTree& tree, const XMLNode& node)
return 0;
}
+XMLNode&
+Control::get_state (void)
+{
+ XMLNode* node = new XMLNode("Control");
+ node->add_property("Type", _type);
+ node->add_property("Number", _number);
+ node->add_property("Name", _name);
+
+ return *node;
+}
+
+int
+Control::set_state (const XMLTree&, const XMLNode& node)
+{
+ assert(node.name() == "Control");
+ _type = node.property("Type")->value();
+ _number = node.property("Number")->value();
+ _name = node.property("Name")->value();
+
+ return 0;
+}
+
+XMLNode&
+ControlNameList::get_state (void)
+{
+ XMLNode* node = new XMLNode("ControlNameList");
+ node->add_property("Name", _name);
+
+ return *node;
+}
+
+int
+ControlNameList::set_state (const XMLTree& tree, const XMLNode& node)
+{
+ assert(node.name() == "ControlNameList");
+ _name = node.property("Name")->value();
+
+ for (XMLNodeList::const_iterator i = node.children().begin();
+ i != node.children().end(); ++i) {
+ boost::shared_ptr<Control> control(new Control());
+ control->set_state (tree, *(*i));
+ _controls.push_back(control);
+ }
+
+ return 0;
+}
XMLNode&
PatchBank::get_state (void)
@@ -427,7 +471,7 @@ MasterDeviceNames::find_patch(std::string mode, uint8_t channel, PatchPrimaryKey
}
int
-MasterDeviceNames::set_state(const XMLTree& tree, const XMLNode& a_node)
+MasterDeviceNames::set_state(const XMLTree& tree, const XMLNode&)
{
// Manufacturer
boost::shared_ptr<XMLSharedNodeList> manufacturer = tree.find("//Manufacturer");
@@ -479,6 +523,16 @@ MasterDeviceNames::set_state(const XMLTree& tree, const XMLNode& a_node)
_note_name_lists.push_back(note_name_list);
}
+ // ControlNameLists
+ boost::shared_ptr<XMLSharedNodeList> control_name_lists = tree.find("//ControlNameList");
+ for (XMLSharedNodeList::iterator i = control_name_lists->begin();
+ i != control_name_lists->end();
+ ++i) {
+ boost::shared_ptr<ControlNameList> control_name_list(new ControlNameList());
+ control_name_list->set_state (tree, *(*i));
+ _control_name_lists.push_back(control_name_list);
+ }
+
// global/post-facto PatchNameLists
boost::shared_ptr<XMLSharedNodeList> patch_name_lists = tree.find("/child::MIDINameDocument/child::MasterDeviceNames/child::PatchNameList");
for (XMLSharedNodeList::iterator i = patch_name_lists->begin();
@@ -544,7 +598,7 @@ MIDINameDocument::MIDINameDocument (const string& filename)
}
int
-MIDINameDocument::set_state (const XMLTree& tree, const XMLNode& a_node)
+MIDINameDocument::set_state (const XMLTree& tree, const XMLNode&)
{
// Author