Neil Puttock schrieb:
On 27 September 2010 20:02, Marc Hohl <m...@hohlart.de> wrote:
harmonicTestOne = #(define-music-function (parser location music)
(ly:music?)
(let* ((test 2)
(result (/ test 2)))
#{
\override TabNoteHead #'transparent = ##t
#}
(make-harmonic music)
(display "\nDummy output to check the let-block: ")(display result)
#{
\revert TabNoteHead #'transparent
#}))
Hi Neil,
This swallows the music, since the (make-harmonic music) part isn't
last in the list: it returns the \revert only.
why are solutions ever so simple? Argh, I must have seen that.
Thanks for your patience.
harmonicTestTwo = #(define-music-function (parser location music)
(ly:music?)
(let* ((test 4)
(result (/ test 2)))
#{
\override TabNoteHead #'transparent = ##t
#(begin
(display "\nDummy output to check the let-block: ")
(display result)
(make-harmonic $music))
\revert TabNoteHead #'transparent
#}))
Here the \override and \revert are both included, since the #{ #}
block creates a sequential music section. Unfortunately, the
(make-harmonic music) part never gets processed by the parser: as a
scheme object, it's ignored unless treated like an identifier via
`ly:export'. It can't be part of the `begin' in this case.
Ok, this is/was beyond my actual scheme (and lilypond's internals)
knowledge.
harmonicTestTwo =
#(define-music-function (parser location music) (ly:music?)
(let* ((test 4)
(result (/ test 2)))
#{
\override TabNoteHead #'transparent = ##t
#(begin
(display "\nDummy output to check the let-block: ")
(display $result))
#(ly:export (make-harmonic $music))
\revert TabNoteHead #'transparent
#}))
harmonicTestThree = #(define-music-function (parser location music)
(ly:music?)
(let* ((test 6)
(result (/ test 2)))
#{
\override TabNoteHead #'transparent = ##t
#}
(begin
(display "\nDummy output to check the let-block: ")
(display result)
(make-harmonic music))))
You're on the right track here: now you're actually returning the
correct music, but it's also junking the \override, since it's not
part of the returned music. If you wrap it in make-sequential-music,
both actions will take place in sequence:
The same goes for this example - it sounds totally logical the
way you explain it, but I never had found this myself.
harmonicTestThree =
#(define-music-function (parser location music) (ly:music?)
(let* ((test 6)
(result (/ test 2)))
(make-sequential-music
(list
#{
\override TabNoteHead #'transparent = ##t
#}
(begin
(display "\nDummy output to check the let-block: ")
(display result)
(make-harmonic music))))))
I suggest you stay in scheme for this kind of music function rather
than switching into lily code (which can't be auto-indented properly).
I added the \revert to the list, and it works like a charm!
Thanks for your detailed explanations!
Marc
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user