Previously, it was possible to have notes "stick" on the staff and not
clear off after releasing the note or pedal in some circumstances. We
fix a number of these bugs by checking to see if a note is already
present in a list before adding a duplicate copy of it.
static void
note_group_add_note (note_group_t *group, score_note_t *note)
{
static void
note_group_add_note (note_group_t *group, score_note_t *note)
{
+ int i;
+
+ /* Do nothing if note is already in group. */
+ for (i = 0; i < group->num_notes; i++) {
+ if (group->notes[i]->pitch == note->pitch &&
+ group->notes[i]->octave == note->octave)
+ {
+ return;
+ }
+ }
+
group->num_notes++;
if (group->num_notes > group->size) {
group->num_notes++;
if (group->num_notes > group->size) {
{
score_note_t *note;
double line;
{
score_note_t *note;
double line;
+ int i;
+
+ /* Return existing note if already present. */
+ for (i = 0; i < staff->num_notes; i++) {
+ note = staff->notes[i];
+ if (note->pitch == pitch &&
+ note->octave == octave &&
+ note->duration == duration)
+ {
+ return note;
+ }
+ }
note = talloc (staff, score_note_t);
if (note == NULL)
note = talloc (staff, score_note_t);
if (note == NULL)