Skip to content

feat: model pedal number so overlapping pedal lines keep their identity - #460

Merged
webern merged 2 commits into
mainfrom
m/mxdev-pedalnum
Sep 19, 2026
Merged

webern merged 2 commits into
mainfrom
m/mxdev-pedalnum

Conversation

@webern

@webern webern commented Sep 19, 2026

Copy link
Copy Markdown
Owner

Human Summary

The ability to specify the line level for pedal lines was missing. Added here.

Summary

mx::api::PedalLineData now carries a SpannerNumber number, and both translation directions
honour MusicXML's <pedal number="..."> attribute. The field is the same identity type wedges,
curves and wavy lines already use: leave it unspecified for a lone pedal line, give an explicit
level to write that level verbatim, or give the events of one line a shared identity label and the
writer assigns a level from serialization order.

The reader takes the number off the element in DirectionReader::parsePedal. The writer emits it
from DirectionWriter::emitPedal through SpannerResolver, which now gives pedal lines their own
pool of numbers 1..16 like every other spanner family. A pedal line opens with start, sostenuto
or resume and closes with stop or discontinue; change and continueLine happen while the
line stays open.

Nothing changes for an ordinary score: a single pedal line with no number writes no number
attribute, and every other spanner family keeps its own pool and assignments.

Deliberately left out, as separate gaps: pedal/@sign and pedal/@abbreviated (the sign form is
modelled through MarkType::pedal / MarkType::damp), the font and color half of
print-style-align on <pedal>, and numbers on the pedal sign form.

Testing

  • New reader test: <pedal type="start" line="yes" number="2"> reads as PedalLineKind::start with explicit level 2; a pedal with no number reads as unspecified
  • New resolver/writer tests: two overlapping identity pedal lines get distinct numbers and both survive a round trip; an explicit pedal level is written verbatim and round-trips; a pedal number and a wedge number come from separate pools
  • New round-trip tests: an explicit pedal number comes back; a pedal line without a number writes no number attribute
  • Reverting just the reader/writer/resolver sites fails 5 of the new test cases (10 assertions), so they are real regressions
  • make api-test: all pass (5909 assertions in 664 test cases)
  • make api-roundtrip: 414 passed, 0 failed (of 414 pinned)
  • make api-roundtrip-discover: 414 PASS, 426 FAIL, 0 LOADFAIL/GETDATAFAIL/CREATEFAIL -- no file unlocked, so no baseline pin. synthetic/pedal.3.1.xml still fails because its pedal also carries abbreviated, font and color attributes that mx::api does not model
  • make test-all, make fmt-check

References

@webern webern added feature new feature request non-breaking fixes or implementation that do not require breaking changes api Affects the mx::api layer ai Issues opened by, or through, a coding agent. labels Sep 19, 2026
Add api::PedalLineData::number and read <pedal>'s number attribute, so two
pedal lines held down at once stay distinguishable on read.

The writer emits the attribute through SpannerResolver, which now gives
pedals their own number pool like every other spanner family; an authored
identity is assigned a level from serialization order and an explicit level
is written verbatim. A single pedal line is unchanged and writes no number.
Comment thread src/include/mx/api/PedalLineData.h Outdated
Signed-off-by: Matthew James Briggs <matthew.james.briggs@gmail.com>
@webern
webern merged commit 0c0b7cc into main Sep 19, 2026
8 checks passed
@webern
webern deleted the m/mxdev-pedalnum branch September 19, 2026 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai Issues opened by, or through, a coding agent. api Affects the mx::api layer feature new feature request non-breaking fixes or implementation that do not require breaking changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

expose pedal/@number in mx::api::PedalLineData

1 participant