mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-15 19:16:40 +01:00
fix insidious bugs in midnam_patch.cc which account for garbled data
git-svn-id: svn://localhost/ardour2/branches/3.0@13219 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
dec0e3d6da
commit
9a19da77e3
2 changed files with 17 additions and 9 deletions
|
|
@ -45,6 +45,7 @@ InstrumentInfo::~InstrumentInfo ()
|
|||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
InstrumentInfo::set_external_instrument (const string& model, const string& mode)
|
||||
{
|
||||
|
|
@ -114,10 +115,14 @@ InstrumentInfo::get_patches (uint8_t channel)
|
|||
return plugin_programs_to_channel_name_set (p);
|
||||
}
|
||||
|
||||
return MidiPatchManager::instance().find_channel_name_set (external_instrument_model,
|
||||
external_instrument_mode,
|
||||
channel);
|
||||
|
||||
boost::shared_ptr<MIDI::Name::ChannelNameSet> channel_name_set =
|
||||
MidiPatchManager::instance().find_channel_name_set (external_instrument_model,
|
||||
external_instrument_mode,
|
||||
channel);
|
||||
|
||||
//std::cerr << "got channel name set with name '" << channel_name_set->name() << std::endl;
|
||||
|
||||
return channel_name_set;
|
||||
}
|
||||
|
||||
boost::shared_ptr<MIDI::Name::ChannelNameSet>
|
||||
|
|
|
|||
|
|
@ -44,8 +44,11 @@ Patch::Patch (std::string name, uint8_t p_number, uint16_t b_number)
|
|||
|
||||
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();
|
||||
|
|
@ -53,13 +56,12 @@ int initialize_primary_key_from_commands (PatchPrimaryKey& id, const XMLNode* no
|
|||
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 != "");
|
||||
|
|
@ -333,13 +335,14 @@ ChannelNameSet::set_state (const XMLTree& tree, const XMLNode& node)
|
|||
{
|
||||
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) {
|
||||
|
|
@ -372,7 +375,7 @@ CustomDeviceMode::set_state(const XMLTree& tree, const XMLNode& a_node)
|
|||
_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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue