X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scm%2Fly-syntax-constructors.scm;h=2d243ab8abf1ae3daf1f8419b8eb0b86704dd89a;hb=47db9a3883d726ca53e2133a3b2298f78dd6a32e;hp=68bfb1f9f163361ada22655459bd303ea0f96395;hpb=5b2267a97cfb085c4492e2954c0b9eec36fc11f8;p=lilypond.git diff --git a/scm/ly-syntax-constructors.scm b/scm/ly-syntax-constructors.scm index 68bfb1f9f1..2d243ab8ab 100644 --- a/scm/ly-syntax-constructors.scm +++ b/scm/ly-syntax-constructors.scm @@ -1,6 +1,6 @@ ;;;; This file is part of LilyPond, the GNU music typesetter. ;;;; -;;;; Copyright (C) 2006--2014 Erik Sandberg +;;;; Copyright (C) 2006--2015 Erik Sandberg ;;;; ;;;; LilyPond is free software: you can redistribute it and/or modify ;;;; it under the terms of the GNU General Public License as published by @@ -207,11 +207,10 @@ into a @code{MultiMeasureTextEvent}." 'context-type ctx 'origin location))) -(define (get-first-context-id! type mus) - "Find the name of a ContextSpeccedMusic with given type, possibly naming it" +(define (get-first-context-id! mus) + "Find the name of a ContextSpeccedMusic, possibly naming it" (let ((id (ly:music-property mus 'context-id))) - (if (and (eq? (ly:music-property mus 'name) 'ContextSpeccedMusic) - (eq? (ly:music-property mus 'context-type) type)) + (if (eq? (ly:music-property mus 'name) 'ContextSpeccedMusic) (if (and (string? id) (not (string-null? id))) id @@ -232,7 +231,7 @@ into a @code{MultiMeasureTextEvent}." (define-ly-syntax-simple (lyric-event text duration) (make-lyric-event text duration)) -(define (lyric-combine-music sync music loc) +(define (lyric-combine-music sync sync-type music loc) ;; CompletizeExtenderEvent is added following the last lyric in MUSIC ;; to signal to the Extender_engraver that any pending extender should ;; be completed if the lyrics end before the associated voice. @@ -241,35 +240,29 @@ into a @code{MultiMeasureTextEvent}." (make-music 'LyricCombineMusic 'element music 'associated-context sync + 'associated-context-type sync-type 'origin loc)) -(define-ly-syntax (lyric-combine parser location voice music) - (lyric-combine-music voice music location)) +(define-ly-syntax (lyric-combine parser location voice typ music) + (lyric-combine-music voice typ music location)) (define-ly-syntax (add-lyrics parser location music addlyrics-list) - (let* ((existing-voice-name (get-first-context-id! 'Voice music)) + (let* ((existing-voice-name (get-first-context-id! music)) (voice-name (if (string? existing-voice-name) existing-voice-name (get-next-unique-voice-name))) (voice (if (string? existing-voice-name) music - (if (eq? (ly:music-property music 'name) 'ContextSpeccedMusic) - (begin - (set! (ly:music-property music 'element) - (make-music 'ContextSpeccedMusic - 'element (ly:music-property music 'element) - 'context-type 'Voice - 'context-id voice-name - 'origin (ly:music-property music 'origin))) - music) - (make-music 'ContextSpeccedMusic - 'element music - 'context-type 'Voice - 'context-id voice-name - 'origin (ly:music-property music 'origin))))) + (make-music 'ContextSpeccedMusic + 'element music + 'context-type 'Voice + 'context-id voice-name + 'origin (ly:music-property music 'origin)))) + (voice-type (ly:music-property voice 'context-type)) (lyricstos (map (lambda (mus) (let* ((loc (ly:music-property mus 'origin)) - (lyr (lyric-combine-music voice-name mus loc))) + (lyr (lyric-combine-music + voice-name voice-type mus loc))) (make-music 'ContextSpeccedMusic 'create-new #t 'context-type 'Lyrics