(define (pitch= pitch1 pitch2)
(and (= (ly:pitch-notename pitch1) (ly:pitch-notename pitch2))
(= (ly:pitch-alteration pitch1) (ly:pitch-alteration pitch2))))
- (let* ((pitches (ly:parser-lookup 'pitchnames))
- (result (rassoc ly-pitch pitches pitch=)))
+ (let* ((result (rassoc ly-pitch pitchnames pitch=)))
(and result (car result))))
(define-public (octave->lily-string pitch)
;;; post events
;;;
-(define (post-event? m)
- (music-is-of-type? m 'post-event))
+(define post-event? (music-type-predicate 'post-event))
(define* (event-direction->lily-string event #:optional (required #t))
(let ((direction (ly:music-property event 'direction)))
(chord-repeat (ly:music-property chord 'duration)))
(call-with-values
(lambda ()
- (partition (lambda (m) (music-is-of-type? m 'rhythmic-event))
+ (partition (music-type-predicate 'rhythmic-event)
elements))
(lambda (chord-elements other-elements)
(cond ((pair? chord-elements)
(new-line->lily-string))))
(define-display-method PropertyUnset (expr)
- (format #f "\\unset ~a~a~a"
+ (format #f "~a\\unset ~a~a~a"
+ (if (ly:music-property expr 'once #f) "\\once " "")
(if (eqv? (*current-context*) 'Bottom)
""
(format #f "~a . " (*current-context*)))
(define-display-method RevertProperty (expr)
(let* ((symbol (ly:music-property expr 'symbol))
(properties (ly:music-property expr 'grob-property-path
- (list (ly:music-property expr 'grob-property)))))
- (format #f "\\revert ~{~a~^.~}~a"
+ (list (ly:music-property expr
+ 'grob-property))))
+ (once (ly:music-property expr 'once #f)))
+ (format #f "~a\\revert ~{~a~^.~}~a"
+ (if once "\\once " "")
(if (eqv? (*current-context*) 'Bottom)
(cons symbol properties)
(cons* (*current-context*) symbol properties))
num den
(new-line->lily-string))
(format #f
- "\\time #'~a ~a/~a~a"
+ ;; This is silly but the latter will also work for #f
+ ;; and other
+ (if (key-list? structure)
+ "\\time ~{~a~^,~} ~a/~a~a"
+ "\\time #'~a ~a/~a~a")
structure num den
(new-line->lily-string)))))
(define-display-method ApplyOutputEvent (applyoutput)
(let ((proc (ly:music-property applyoutput 'procedure))
- (ctx (ly:music-property applyoutput 'context-type)))
- (format #f "\\applyOutput #'~a #~a"
+ (ctx (ly:music-property applyoutput 'context-type))
+ (grob (ly:music-property applyoutput 'symbol)))
+ (format #f "\\applyOutput ~a~@[.~a~] #~a"
ctx
+ (and (symbol? grob) grob)
(or (procedure-name proc)
(with-output-to-string
(lambda ()
elements ((music 'ContextSpeccedMusic
context-id "up"
context-type 'Staff
- element (music 'SimultaneousMusic elements (?ac-music)))
+ element ?ac-music)
+ (music 'ContextSpeccedMusic
+ context-id "up"
+ context-type 'Staff)
(music 'ContextSpeccedMusic
context-id "down"
context-type 'Staff))))