\instrumentSwitch adds the name twice in contexts with multiple voices

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

\instrumentSwitch adds the name twice in contexts with multiple voices

Chris J. M.
\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

_______________________________________________
bug-lilypond mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-lilypond

instrument-switch-expanded.ly (936 bytes) Download Attachment
instrument-switch-minimal.ly (218 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

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

Thomas Morley-2
Am Di., 15. Okt. 2019 um 04:36 Uhr schrieb Chris J. M. <[hidden email]>:
>
> \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
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-lilypond