diff options
author | David Robillard <d@drobilla.net> | 2014-12-29 20:18:57 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2014-12-29 20:20:16 -0500 |
commit | 2e62ca9631286df44a42f250323c5eb9775a8aee (patch) | |
tree | 24a29488dc6d7d05687760bc012407f8da54df9e /libs/midi++2 | |
parent | 196e29ddefd20518fb82235f4654f7527c83ceb2 (diff) |
Fix off-by-one MIDI note names.
Much like everything else in midnam, it's not specified whether the numbers are
0 or 1 relative, but everything out there seems to be 0 relative and this
matches the canvas, so go with that.
Diffstat (limited to 'libs/midi++2')
-rw-r--r-- | libs/midi++2/midnam_patch.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libs/midi++2/midnam_patch.cc b/libs/midi++2/midnam_patch.cc index e69842e6cd..55e7ac1898 100644 --- a/libs/midi++2/midnam_patch.cc +++ b/libs/midi++2/midnam_patch.cc @@ -151,7 +151,7 @@ XMLNode& Note::get_state (void) { XMLNode* node = new XMLNode("Note"); - node->add_property("Number", _number + 1); + node->add_property("Number", _number); node->add_property("Name", _name); return *node; @@ -163,14 +163,14 @@ Note::set_state (const XMLTree& tree, const XMLNode& node) assert(node.name() == "Note"); const int num = string_to_int(tree, node.property("Number")->value()); - if (num < 1 || num > 128) { + if (num > 127) { PBD::warning << string_compose("%1: Note number %2 (%3) out of range", tree.filename(), num, _name) << endmsg; return -1; } - _number = num - 1; + _number = num; _name = node.property("Name")->value(); return 0; |