Skip to content

feat: full MusicXML key-mode support in mx::api - #380

Open
rpatters1 wants to merge 1 commit into
webern:mainfrom
rpatters1:full-keymode-support
Open

feat: full MusicXML key-mode support in mx::api#380
rpatters1 wants to merge 1 commit into
webern:mainfrom
rpatters1:full-keymode-support

Conversation

@rpatters1

Copy link
Copy Markdown
Contributor

Human Summary

Extend API KeyMode support to include all known values on both read and write. Unknown values are handled as unsupported.

Summary

KeyMode in KeyData.h only had major and minor. MeasureReader mapped every other
<mode> to KeyMode::unsupported and PropertiesWriter wrote a <mode> element only for
major and minor, so a keyless signature (<fifths>0</fifths><mode>none</mode>) could be
neither read nor written.

KeyMode now covers the ten standard MusicXML modes. Reading and writing both go through a
new bridge table in Converter instead of a hand-rolled if-chain, which retires the
// TODO - support all modes in MeasureReader. The new enumerators are appended, so the
existing values are unchanged.

Distinctions that are preserved:

  • unspecified writes no <mode> element; none writes <mode>none</mode>
  • zero fifths implies no mode, so C major, A minor, none, and unspecified stay four
    distinct states
  • unsupported is kept, and still earns its keep: <mode> is an open vocabulary, so it is
    what an unrecognized value reads back as. It writes nothing.
  • none is an ordinary mode value. It writes a traditional key and is not coupled to
    nontraditional key handling.

No print-object support, and nothing Finale-specific: this is general mode support.

lysuite/ly13b_KeySignatures_ChurchModes.xml is pinned to the api roundtrip to defend the
feature. On the base commit it fails with child count mismatch at the key element (the
dropped <mode>), and passes with this change.

Testing

  • ly13b_KeySignatures_ChurchModes.xml fails before the change, passes after
  • 8 new KeyData tests: every value serializes to its exact spelling, every standard mode
    deserializes, zero-fifths none round-trips, absent <mode> stays unspecified, an
    unrecognized mode reads as unsupported, and the four zero-fifths
  • All KeyData tests pass (*_KeyData: 285 assertions in 20 test cases)
  • make api-test passes (5366 assertions in 471 test cases)
  • make api-roundtrip passes (296 of 296 pinned)
  • make core-roundtrip-test passes (837 test cases)
  • make core-unit passes (212 assertions in 41 test cases)

KeyMode covered only major and minor; every other <mode>, including
none, read as unsupported and wrote nothing. Expand it to the ten
standard MusicXML modes and route both directions through a Converter
bridge table.

- unspecified still writes no <mode>; none writes <mode>none</mode>
- zero fifths implies no mode: C major, A minor, none, and unspecified
  stay distinct
- unsupported is retained for out-of-vocabulary <mode> values
- pin lysuite/ly13b_KeySignatures_ChurchModes.xml to the api roundtrip

New enumerators are appended, so existing KeyMode values are unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant