Am Di., 15. Okt. 2019 um 04:36 Uhr schrieb Chris J. M. <ch...@euchre.us>:
>
> \version "2.18.2"
>  \addInstrumentDefinition #"timpani"
>   #`((instrumentCueName . ,(make-bold-markup "timp.")))
> << { s1 } { \instrumentSwitch "timpani" d1 } >>
>
> It outputs the word “timp.” twice.  It should only say it once.  The attached 
> expanded example includes using the empty voice with the s1 for controlling 
> time & key signatures (which would be useful in multi-part scores).
>
> — Chris

Hi Chris,

thanks for your report.
\instrumentSwitch naturely affects the whole Staff, but multiple
Voices shouldn't cause multiple output of instrumentCueName.
So I'd agree, it's buggy.

Not sure, if it's the correct fix, the following seems to work:

instrumentSwitch =
#(define-music-function
   (name) (string?)
   (_i "Switch instrument to @var{name}, which must be predefined with
@code{\\addInstrumentDefinition}.")
   (let* ((handle (assoc name instrument-definitions))
          (instrument-def (if handle (cdr handle) '())))

     (if (not handle)
         (ly:input-warning (*location*) "No such instrument: ~a" name))
     (
      ;; context-spec-music
      ;; changed to:
      descend-to-context
      (make-music 'SimultaneousMusic
                  'elements
                  (map (lambda (kv)
                         (make-property-set
                          (car kv)
                          (cdr kv)))
                       instrument-def))
      'Staff)))


Cheers,
  Harm

_______________________________________________
bug-lilypond mailing list
bug-lilypond@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-lilypond

Reply via email to