summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2013-01-20 01:12:12 +0000
committerDavid Robillard <d@drobilla.net>2013-01-20 01:12:12 +0000
commit4a47edeaf0b1a663277e0423d60fe6a3a2f7375c (patch)
tree88aed80c524a89a5d336e3f03ac30099b683d7b4 /libs
parent230c4e080ed14a945cf1e9651d3c768c3c293cff (diff)
Fix MIDI note number off by one error.
Bloody one-based indices... git-svn-id: svn://localhost/ardour2/branches/3.0@13911 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/midi++2/midnam_patch.cc11
1 files changed, 6 insertions, 5 deletions
diff --git a/libs/midi++2/midnam_patch.cc b/libs/midi++2/midnam_patch.cc
index 490baec806..83f701777b 100644
--- a/libs/midi++2/midnam_patch.cc
+++ b/libs/midi++2/midnam_patch.cc
@@ -141,7 +141,7 @@ XMLNode&
Note::get_state (void)
{
XMLNode* node = new XMLNode("Note");
- node->add_property("Number", _number);
+ node->add_property("Number", _number + 1);
node->add_property("Name", _name);
return *node;
@@ -153,10 +153,11 @@ Note::set_state (const XMLTree&, const XMLNode& node)
assert(node.name() == "Note");
/* If the note number is junk, this will pull a number from the start, or
- return zero if there isn't one. Better error detection would be a good
- idea, but the duplicate check in NoteNameList::set_state() will probably
- catch really broken files anyway. */
- _number = atoi(node.property("Number")->value().c_str());
+ return zero if there isn't one. The decrement will make that zero
+ illegal since note numbers in the file are one-based. Better error
+ detection would be a good idea, but the duplicate check in
+ NoteNameList::set_state() will probably catch most errors anyway. */
+ _number = atoi(node.property("Number")->value().c_str()) - 1;
_name = node.property("Name")->value();
return 0;