|
From: | Urs Liska |
Subject: | Catch possible non-rhythmic-event music expressions |
Date: | Mon, 25 Jun 2018 14:30:22 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 |
Hi,I'm working on a music-function that takes one music argument, determines the type of music and dispatches to a styling function that will apply either a \tweak, a \once \override or that will wrap the music in \temporary \override / \revert expressions.
I got pretty far in the determination of when to use which modification type, and I arrived at using the \once \override appraoch for non-rhythmic events like key signatures, clefs, time signatures etc., which so far seems to work pretty well.
However, now I want to add the functionality to auto-detect the grob to override, and I thought checking for the 'types music-property. But there arise a few questions:
#(define (infer-item music) (let ((types (ly:music-property music 'types))) (ly:message "Types: ~a" types) (cond ((memq 'key-change-event types) '(Staff KeySignature)) ((memq 'time-signature-music types) '(Staff TimeSignature)) ((memq 'mark-event types) '(Score RehearsalMark)) ((memq 'tempo-change-event types) '(Score MetronomeMark)) ((memq 'music-wrapper-music types) '(Staff Clef))))) 1)Determining Staff.Clef is obviously not correct since there are other music-wrapper-music types around. How can I reliably determine if a music expression (which has already been determined not to be sequential and not to be rhythmic) consists of a \clef assignment?
2)How can I know the comprehensive list of type/grob mappings I have to support?
3)What would be a better structure than the growing list of memq conditionals, especially if the list should turn out to be significantly longer than the five I currently have?
Thanks Urs
[Prev in Thread] | Current Thread | [Next in Thread] |