lilypond-devel
[Top][All Lists]
Advanced

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

Re: Auto_change_iterator no longer creates staff contexts itself. They a


From: thomasmorley65
Subject: Re: Auto_change_iterator no longer creates staff contexts itself. They are created in scheme. (issue 249970043 by address@hidden)
Date: Sun, 28 Jun 2015 11:17:57 +0000

On 2015/06/28 00:17:58, Dan Eble wrote:
On 2015/06/27 19:45:12, thomasmorley651 wrote:
> bassStaffProperties and trebleStaffProperties are not really
documented,
though
> I'd call it more a documentation issue.
...
> I vote for keeping them, although I think it's a very cumbersome
method to
> specify which clefs the PianoStaff should use.

If one follows the NR's suggestion to instantiate staves explicitly,
your
example is transformed into something more lilypondish (below).
Removing these
properties will make it easier for me to consolidate some code for
\autochange
and \partcombine.

Let me clearify, I don't insist in keeping those properties, though I'd
like to keep the possibility to simply write \autochange { ... } _and_
to have the possibility to set the clefs in both staves.
The NR shows an example for \autochange { ... } and I think the
treble/bassStaffProperties were meant to set the clefs.

Following Davids suggestion, why not:

%% begin snippet

\version "2.19.22"

%% with patch applied

%% optional context-modifications working only, if contexts are not
instantiated
%% explicitly
autochange =
#(define-music-function (cm-1 cm-2 music)
  ((ly:context-mod? #{ \with { \clef treble} #})
   (ly:context-mod? #{ \with { \clef bass } #})
   ly:music?)
  (_i "Make voices that switch between staves automatically")
  (let ;; keep the contexts alive for the full duration
       ((skip (make-skip-music (make-duration-of-length
                                     (ly:music-length music)))))
    #{
      <<
        \context Staff = "up" $cm-1
          <<
          #(make-autochange-music music)
          \new Voice { #skip }
          >>
        \context Staff = "down" $cm-2
          \new Voice { #skip }
      >>
    #}))

%% TESTS

music = {
  g4 a b c'
  d'4 r a g
}

\autochange \music
\autochange \with { \clef alto } \music
\autochange \with { \clef alto } \with { \clef tenor }\music

%% end snippet

No need for treble/bassStaffProperties anymore

https://codereview.appspot.com/249970043/



reply via email to

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