int initialize_primary_key_from_commands (PatchPrimaryKey& id, const XMLNode* node)
{
+ id.bank_number = 0;
+
const XMLNodeList events = node->children();
for (XMLNodeList::const_iterator i = events.begin(); i != events.end(); ++i) {
+
XMLNode* node = *i;
if (node->name() == "ControlChange") {
string control = node->property("Control")->value();
string value = node->property("Value")->value();
assert(value != "");
- id.bank_number = 0;
-
if (control == "0") {
- id.bank_number |= (PBD::atoi (value)<<7);
+ id.bank_number |= (PBD::atoi (value)) << 7;
} else if (control == "32") {
id.bank_number |= PBD::atoi (value);
}
+
} else if (node->name() == "ProgramChange") {
string number = node->property("Number")->value();
assert(number != "");
{
assert(node.name() == "ChannelNameSet");
_name = node.property("Name")->value();
+
const XMLNodeList children = node.children();
for (XMLNodeList::const_iterator i = children.begin(); i != children.end(); ++i) {
XMLNode* node = *i;
assert(node);
if (node->name() == "AvailableForChannels") {
boost::shared_ptr<XMLSharedNodeList> channels =
- tree.find("//AvailableChannel[@Available = 'true']/@Channel");
+ tree.find("//AvailableChannel[@Available = 'true']/@Channel", node);
for(XMLSharedNodeList::const_iterator i = channels->begin();
i != channels->end();
++i) {
_name = a_node.property("Name")->value();
boost::shared_ptr<XMLSharedNodeList> channel_name_set_assignments =
- tree.find("//ChannelNameSetAssign");
+ tree.find("//ChannelNameSetAssign", (XMLNode *)&a_node);
for(XMLSharedNodeList::const_iterator i = channel_name_set_assignments->begin();
i != channel_name_set_assignments->end();
++i) {
boost::shared_ptr<CustomDeviceMode>
MasterDeviceNames::custom_device_mode_by_name(std::string mode_name)
{
- assert(mode_name != "");
+ // can't assert this, since in many of the patch files the mode name is empty
+ //assert(mode_name != "");
return _custom_device_modes[mode_name];
}
// Manufacturer
boost::shared_ptr<XMLSharedNodeList> manufacturer = tree.find("//Manufacturer");
assert(manufacturer->size() == 1);
- _manufacturer = manufacturer->front()->content();
+ _manufacturer = manufacturer->front()->children().front()->content();
// Models
boost::shared_ptr<XMLSharedNodeList> models = tree.find("//Model");
error << "No author information in MIDNAM file" << endmsg;
return -1;
}
- _author = author->front()->content();
+
+ if (author->front()->children().size() > 0) {
+ _author = author->front()->children().front()->content();
+ }
// MasterDeviceNames