bug-lilypond
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: \instrumentSwitch adds the name twice in contexts with multiple voic


From: Thomas Morley
Subject: Re: \instrumentSwitch adds the name twice in contexts with multiple voices
Date: Thu, 17 Oct 2019 11:13:23 +0200

Am Di., 15. Okt. 2019 um 04:36 Uhr schrieb Chris J. M. <address@hidden>:
>
> \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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]