Tone Generation
ci / checks (push) Has been cancelled

This commit is contained in:
khodowany
2026-09-18 01:17:36 -05:00
parent 64eac2f11e
commit 80873a0896
39 changed files with 1624 additions and 52 deletions
+17 -1
View File
@@ -58,6 +58,22 @@ def audit_layout(document: dict, layout: LayoutDocument, fonts: Fonts) -> None:
raise EngravingError(f'{item.sources} and {other.sources}: colliding {item.role}/{other.role}')
if previous_end != index.end:
raise EngravingError('layout omits the end of the score')
from generator.repeats import analyze
_, endings = analyze(index.staff['measures'])
for ending in endings:
if not ending.visible:
continue
identifier = index.measures[ending.start][2]['id'] + ':ending'
if not any(p.role == 'ending-label' and p.value == ending.text for p in primitives.get(identifier, [])):
raise EngravingError(f'{identifier}: numbered ending was omitted')
low, high = index.measures[ending.start][0], index.measures[ending.end - 1][1]
for page in layout.pages:
for system in page.systems:
if system.start < high and system.end > low and not any(p.role == 'ending' and identifier in p.sources for p in system.primitives):
raise EngravingError(f'{identifier}: ending continuation was omitted')
for _, _, measure in index.measures:
if measure.get('repeats') and not any(p.role == 'repeat-dot' for p in primitives.get(measure['id'], [])):
raise EngravingError(f'{measure["id"]}: repeat dots were omitted')
for event in index.events:
note = event.value
for source in note['pitches'] or [note]:
@@ -85,7 +101,7 @@ def audit_layout(document: dict, layout: LayoutDocument, fonts: Fonts) -> None:
if any(f.visible for f in pieces) and identifier in index.tones and index.accidentals[identifier]:
if not any(p.role == 'accidental' for p in primitives.get(identifier, [])):
raise EngravingError(f'{identifier}: required accidental was omitted')
if identifier in index.tones and source.get('tie_to') and any(f.visible for f in pieces):
if identifier in index.tones and (source.get('tie_to') or source.get('printed_ties')) and any(f.visible for f in pieces):
if not any(p.role == 'tie' for p in primitives.get(identifier, [])):
raise EngravingError(f'{identifier}: tie was omitted')
if not note.get('hidden'):