Skip to content

Commit

Permalink
fix: loss of decorations when on combined rests
Browse files Browse the repository at this point in the history
Issue #8
  • Loading branch information
moinejf committed Oct 4, 2017
1 parent 1bcbfd1 commit b629560
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions music.c
Original file line number Diff line number Diff line change
Expand Up @@ -453,19 +453,6 @@ static void do_combine(struct SYMBOL *s)
memcpy(&s->pits[nhd + 1], s2->pits,
sizeof s->pits[0] * (nhd2 + 1));
s->sflags |= s2->sflags & (S_SL1 | S_SL2 | S_TI1);
if (s2->u.note.dc.n > 0) { // update the added decorations
int n;

for (i = 0; i < s2->u.note.dc.n; i++) {
if (s2->u.note.dc.tm[i].m >= 0)
s2->u.note.dc.tm[i].m += nhd + 1;
}
n = s->u.note.dc.n;
memcpy(&s->u.note.dc.tm[n],
s2->u.note.dc.tm,
sizeof s->u.note.dc.tm[0] * s2->u.note.dc.n);
s->u.note.dc.n += s2->u.note.dc.n;
}

nhd += nhd2;
s->nhd = nhd;
Expand Down Expand Up @@ -502,6 +489,19 @@ static void do_combine(struct SYMBOL *s)
s->text = s2->text;
s->gch = s2->gch;
}
if (s2->u.note.dc.n > 0) { // update the added decorations
int n;

for (i = 0; i < s2->u.note.dc.n; i++) {
if (s2->u.note.dc.tm[i].m >= 0)
s2->u.note.dc.tm[i].m += nhd + 1;
}
n = s->u.note.dc.n;
memcpy(&s->u.note.dc.tm[n],
s2->u.note.dc.tm,
sizeof s->u.note.dc.tm[0] * s2->u.note.dc.n);
s->u.note.dc.n += s2->u.note.dc.n;
}
unlksym(s2); /* remove the next symbol */

/* there may be more voices */
Expand Down

0 comments on commit b629560

Please sign in to comment.