feat: round-trip harmony extras and figured-bass#201
Open
webern wants to merge 3 commits into
Open
Conversation
gen-quality
|
Coverage reportCore-dev coverage
|
| Metric | Coverage | Covered / Total |
|---|---|---|
| Lines | 77.9% | 28539 / 36623 |
| Functions | 74.4% | 6360 / 8549 |
| Branches | 50.7% | 22672 / 44725 |
API coverage src/private/mx/{api,impl,utility}/
| Metric | Coverage | Covered / Total |
|---|---|---|
| Lines | 69.5% | 4880 / 7020 |
| Functions | 54.9% | 1479 / 2692 |
| Branches | 40.9% | 3973 / 9720 |
Core HTML report | API HTML report
Commit 3ca01633b076d3e3bbcea4103681cc93ef356f41.
Summary: The harmony-chord choice in the api ChordData only modeled the <root> alternative; <inversion>, the deprecated <function>, and the MusicXML 4.0 <numeral> were dropped on read and could not be written. This adds those fields to ChordData and wires read + write through DirectionReader and DirectionWriter. - ChordData gains: a HarmonyChordSource discriminator (root | numeral | function), functionText, the numeral fields (numeralRoot, numeralRootText, numeralAlter/hasNumeralAlter, numeralKey fifths + NumeralMode), and inversion/hasInversion. - DirectionReader::parseHarmony now branches on the HarmonyChordGroupChoice kind (it previously called asRoot() unconditionally) and reads inversion. The harmony-chord dispatch loop no longer filters to isRoot(), so numeral and function chords are no longer silently skipped. - DirectionWriter rebuilds root / numeral / function and inversion symmetrically. Test plan: - New src/private/mxtest/api/HarmonyExtrasApiTest.cpp: round-trip tests for inversion, function, and numeral (with numeral-alter and numeral-key). - make test (225 cases), make check, make test-api-roundtrip all pass.
Summary: <figured-bass> was read as flattened plain text into a WordsData direction (MeasureReader::parseFiguredBass) and never written back as <figured-bass>, so it was lost on round-trip. This adds an api type that models the element structurally and wires symmetric read + write. - New mx::api FiguredBassData (an ordered list of FigureData with optional prefix / figure-number / suffix, plus parentheses and an optional duration in ticks) and FigureData. Attached to DirectionData via a figuredBasses vector, so it is positioned and flushed at the right tick like harmony. - MeasureReader::parseFiguredBass now builds a FiguredBassData (figures, parentheses, duration) instead of the WordsData text stub. - DirectionWriter::createFiguredBassElements rebuilds <figured-bass> as a core::MusicDataChoice, emitted alongside harmony in getDirectionLikeThings. Scope: <figure> child <extend> and the figured-bass print/position formatting attributes are intentionally not modeled (kept lean); the round-tripped data is the figures' prefix/number/suffix text plus parentheses and duration. Test plan: - New src/private/mxtest/api/FiguredBassApiTest.cpp: round-trips multiple figures with prefix/number/suffix, and parentheses + duration. - make test (227 cases), make check, make test-api-roundtrip all pass.
gen-quality
|
Coverage reportCore-dev coverage
|
| Metric | Coverage | Covered / Total |
|---|---|---|
| Lines | 77.9% | 28539 / 36624 |
| Functions | 74.4% | 6360 / 8550 |
| Branches | 50.7% | 22672 / 44725 |
API coverage src/private/mx/{api,impl,utility}/
| Metric | Coverage | Covered / Total |
|---|---|---|
| Lines | 71.2% | 5144 / 7227 |
| Functions | 56.5% | 1607 / 2843 |
| Branches | 42.4% | 4252 / 10037 |
Core HTML report | API HTML report
Commit 2b2518f69de1e94ab22e4f5ce959bdb0daacdff5.
Owner
Author
|
@copilot resolve the merge conflicts in this pull request |
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.
Summary
Two independent commits addressing audit sections 2.6 and 2.5.
Harmony extras (#191): `ChordData` previously only modeled ``; ``,
``, and the MusicXML 4.0 `` were dropped on read and could not be written.
`ChordData` gains a `HarmonyChordSource` discriminator (root/numeral/function),
`functionText`, numeral fields (`numeralRoot`, `numeralRootText`, `numeralAlter`,
`numeralKeyFifths`, `NumeralMode`), and `inversion`/`hasInversion`.
`DirectionReader::parseHarmony` now branches on `HarmonyChordGroupChoice::Kind` instead of
calling `asRoot()` unconditionally, and reads ``. Also fixes a latent issue: the
harmony-chord dispatch loop filtered to `isRoot()`, silently skipping numeral/function chords.
`DirectionWriter` rebuilds all three variants symmetrically.
Figured-bass (#190): `MeasureReader::parseFiguredBass` emitted a lossy plain-text
`WordsData` stub; the structured `` XML was never written back. New
`FiguredBassData` (ordered `FigureData` list with prefix/figure-number/suffix, parentheses,
`durationTimeTicks`) replaces the stub. `DirectionWriter` emits `` via
`createFiguredBassElements`. Scoped out: `` and print/position formatting attributes.
Testing
References
mx/apilayer. #159 (parent tracker)