lilypond-user
[Top][All Lists]
Advanced

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

Re: macro for \once\override


From: Aaron Hill
Subject: Re: macro for \once\override
Date: Sat, 29 Aug 2020 10:14:36 -0700
User-agent: Roundcube Webmail/1.4.2

On 2020-08-29 6:44 am, David Kastrup wrote:
Hm. \with instead of = would even fit into the parser. But that leaves
tweaks in the lurch.

Not sure I am following.  Are you indicating that something like...

%%%%
  \once \override LaissezVibrerTie.details
    \with { ratio = #0.5 height-limit = #2 }
  b'4\laissezVibrer
%%%%

...could be made to work but not...

%%%%
  b'4
    -\tweak details \with { ratio = #0.5 height-limit = #2 }
    \laissezVibrer
%%%%

?


====

Another thought is whether nested use of \with makes sense.  Consider:

%%%%
\version "2.20.0"

overrideII =
#(define-music-function
  (prop mods)
  (key-list? ly:context-mod?)
  (define (assign? mod) (eq? 'assign (car mod)))
  (define (overrides prop mods)
    (append-map
      (lambda (mod)
        (let ((subprop (cadr mod))
              (value (caddr mod)))
          (if (ly:context-mod? value)
            (overrides (append prop (list subprop)) value)
            (list #{ \override #prop . #subprop = #value #}))))
      (filter assign? (ly:get-context-mods mods))))
  #{ #@(overrides prop mods) #})

\include "predefined-guitar-fretboards.ly"
\storePredefinedDiagram #default-fret-table \chordmode { c' }
                        #guitar-tuning
                        #"x;1-1-(;3-2;3-3;3-4;1-1-);"
<<
  \new ChordNames {
    \chordmode { c1 | c | c | d }
  }
  \new FretBoards {
    % Set global properties of fret diagram
    \overrideII FretBoard \with {
      size = #1.2
      fret-diagram-details = \with {
        finger-code = #'in-dot
        dot-color = #'white
      }
    }
    \chordmode {
      c
      \once \overrideII FretBoard \with {
        size = #1.0
        fret-diagram-details = \with {
          barre-type = #'straight
          dot-color = #'black
          finger-code = #'below-string
        }
      }
      c'
      \once \overrideII FretBoard.fret-diagram-details
        \with {
          barre-type = #'none
          number-type = #'arabic
          orientation = #'landscape
          mute-string = #"M"
          label-dir = #LEFT
          dot-color = #'black
        }
      c'
      \once \overrideII FretBoard.fret-diagram-details
        \with {
          finger-code = #'below-string
          dot-radius = #0.35
          dot-position = #0.5
          fret-count = #3
        }
      d
    }
  }
  \new Voice {
    c'1 | c' | c' | d'
  }

%%%%

Is this pushing things too far?


-- Aaron Hill



reply via email to

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