feat: chord degree display options in mx::api - #376
Merged
Conversation
Expose the MusicXML kind stack-degrees and parentheses-degrees attributes, which control how a chord symbol's degree alterations are laid out. Both are api::Bool defaulting to unspecified, so the writer emits nothing unless the field is set. DirectionReader reads them off core::Kind; DirectionWriter writes them back. Adds round-trip, negative, and file-based tests in HarmonyExtrasApiTest, and registers data/synthetic/kind.3.0.xml with MxFileRepository.
DirectionWriter built each core::Degree with only degree-type, degree-value, and degree-alter, so api::Extension::printObject was dropped on write. The read side already populated it, meaning the field round-tripped to nothing. MusicXML marks a degree print-object="no" when the kind text attribute already spells it out; Finale exports <kind text="7sus4">suspended-fourth</kind> with a hidden added seventh. Without this the seventh prints twice. Covered by a round-trip test, a negative test, and a read of the three hidden degrees in recsuite/BrookeWestSample.xml.
webern
approved these changes
Jul 30, 2026
| myNameSubdirectoryMap.emplace("segno.3.1.xml", "synthetic"); | ||
| myNameSubdirectoryMap.emplace("coda.3.0.xml", "synthetic"); | ||
| myNameSubdirectoryMap.emplace("coda.3.1.xml", "synthetic"); | ||
| myNameSubdirectoryMap.emplace("kind.3.0.xml", "synthetic"); |
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.
Human Summary
Add
parenthesesDegreesandstackDegreestoChordData. Also modified writer to write print-object for Degree. (It was already being read.)Summary
Three MusicXML attributes that control how a chord symbol's degrees are displayed were unreachable through
mx::api.ChordDatagainsstackDegreesandparenthesesDegrees, bothapi::Booldefaulting tounspecified. They map to the<kind>attributesstack-degrees(degrees stacked vertically rather than left to right) andparentheses-degrees(all degrees wrapped in parentheses, e.g.C7(#9b13)).DirectionReaderreads them offcore::Kind;DirectionWriteremits them only when the field is set, so an author who never touches them gets the same XML as before. The core type already supported both. No behavior change for existing callers.Separately,
DirectionWriterwas droppingExtension::printObject: eachcore::Degreewas built with only degree-type, degree-value, and degree-alter, so the<degree>print-objectattribute was never written. The read side already populated the field, so it round-tripped to nothing. MusicXML marks a degreeprint-object="no"when the<kind>text attribute already spells it out — Finale exports<kind text="7sus4">suspended-fourth</kind>followed by a hidden added seventh, and without the writer support that seventh prints twice.data/synthetic/kind.3.0.xmlis now registered withMxFileRepositoryso it can serve as a read fixture. No new corpus files, so no pinned-count or audit regeneration.Testing
harmonyDegreePrintObjectRoundTripfails before the writer fix (2 assertions), passes afterHarmonyExtrasApiTest.cpp: round-trip, negative (unspecified writes no attribute), and read-path coverage for both featuressynthetic/kind.3.0.xmlfor the kind attributes, and the three hidden degrees inrecsuite/BrookeWestSample.xmlfor print-objectharmony*: 32 assertions in 9 test cases)make api-roundtripclean (295 passed, 0 failed of 295 pinned)make fmt-checkclean on touched filesDiscovery is unchanged.
synthetic/kind.3.0.xmlstill fails the strict compare, now onbracket-degreesrather thanstack-degrees;recsuite/BrookeWestSample.xmlfails earlier in the document on acredit-wordsattribute count. Neither is baseline-eligible yet.