Menu

#30 Phrase copy(int highestPitch, int lowestPitch)

open
nobody
None
5
2013-02-07
2007-05-01
No

In release 1.5, the Phrase method
"copy(int highestPitch, int lowestPitch)" has a bug:

The statement
"if (n.getPitch() > highestPitch &&
n.getPitch() < lowestPitch) n.setPitch(REST);"

sets a condition that is impossible to fulfill,
namely, note "n" must be both higher than "highestPitch" and lower than "lowestPitch" at the same time.

Fix: replace the "&&" operator with the "||" operator.

As well, the doc comment for this method,

"Returns a copy of the entire Phrase only containing notes between highest and lowset specified pitch."

remains misleading even after the bug is fixed because the copy of the Phrase returned contains not only notes but also rests in place of notes outside of the specified range.

Someone expecting a phrase containing only notes will have to deal with unexpected rests.

Discussion


Log in to post a comment.

MongoDB Logo MongoDB