Add support for segno reading#134
Open
SemitoneGene wants to merge 1 commit into
Open
Conversation
Contributor
Author
|
I also made a fix to catch.h in cpul that was causing a crash when building on the M1. |
Closed
Contributor
Author
|
Coda reading added as well. |
Contributor
Author
|
Added rehearsal reading. In typical Gene fashion, I just realized all these changes only deal with reading. I am working on getting the writer work done. |
Contributor
Author
|
I stubbed in the writing functions, but need to do some more work to understand the correct way to write the info out. Any help is appreciated! |
Owner
|
I'll take a look. |
Owner
|
Your commit history lol 😅 Don't push anything else ATM, I'll fix it. |
Owner
|
I think I fixed the git history at least. I force pushed to your fork and branch (because you can do that with GitHub, it's crazy). So, Assuming your fork is at "origin", you should: cd mx
git remote add upstream git@github.com:webern/mx.git
git checkout master
git fetch upstream master
git reset --hard upstream/master
git push origin -f master
git fetch origin gene/351
git checkout gene/351
git reset --hard origin gene/351 |
The reading side (DirectionReader, the *Data headers and the DirectionData vectors) already landed on main, so the rebase reduces to the writer. Port the per-item write-back for segnos, codas and rehearsals onto the new core API (DirectionTypeChoice factories taking OneOrMore<...>). These remain stubs: they emit one empty element per item and do not yet transfer position, color or text.
This was referenced Jun 17, 2026
webern
added a commit
that referenced
this pull request
Jun 17, 2026
## Summary `mx::api` exposed `SegnoData`/`CodaData` but support was partial: the reader only captured position and color (and even then never set `isColorSpecified`, so color was dropped), and the writer emitted nothing for segno or coda, silently losing them on write. This widens both data classes to the full `<segno>`/`<coda>` attribute surface and makes the trip lossless in both directions: - Added `fontData`, `smufl` (+ `isSmuflSpecified`), and `id` (+ `isIdSpecified`) to `SegnoData` and `CodaData`. Position and halign/valign already ride along in `positionData`. - `DirectionReader::parseSegno`/`parseCoda` now read font, smufl, id, and set `isColorSpecified`. - `DirectionWriter` now writes segno and coda (position, font, color, smufl, id), replacing the lossy `MX_UNUSED` stub proposed in the superseded PR. Note: `positionData` carries a `placement` member that does not apply to `<segno>`/`<coda>` (placement lives on the parent `<direction>`). The read/write helpers are attribute-tolerant (`if constexpr (requires ...)`), so this is inert, not a data bug. Documented in the headers. ## Testing - [x] New impl round-trip test `segnoAndCodaRoundTrip_DirectionWriter`: builds a segno and a coda with every field set, writes via `DirectionWriter`, reads back via `DirectionReader`, asserts equality. Passes (8 assertions in 2 test cases with the existing ottava test). - [x] `make dev` builds clean; `make fmt` applied. - [x] Full `make test` deferred to CI. ## TODO (planned, not done in this PR) - #204 Add an api-level round-trip test over `data/synthetic/segno.{3.0,3.1}.xml` and `coda.{3.0,3.1}.xml` (register them in `MxFileRepository`) so the public `DocumentManager` path is exercised, not just the impl layer. These fixtures already carry every attribute (the 3.1 variants add `id` and `smufl`). - #205 Implement rehearsal writing in `DirectionWriter`. Rehearsals are read but not written; PR #134 bundled a lossy rehearsal writer. Scoped out here to keep this segno/coda-only. - #206 Honor `orderedComponents` in `DirectionWriter`. The writer emits each component kind in its own loop (segnos, then codas), so direction-type children interleaved with other kinds are not guaranteed to round-trip in original order. Pre-existing limitation surfaced by this work. - #207 Fix the same latent bug in `parseWords`: `WordsData.isColorSpecified` is never set on read, so words color does not round-trip (same bug class fixed here for segno/coda). ## References - Closes #133 - Supersedes #134
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Segno are now read and made available in the public API.