[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
measurePosition within a music function?
From: |
Marc Hohl |
Subject: |
measurePosition within a music function? |
Date: |
Fri, 05 Mar 2010 13:05:11 +0100 |
User-agent: |
Thunderbird 2.0.0.23 (X11/20090817) |
Hello,
I have a music function which simply outputs the durations of every note:
\version "2.13.13"
#(define (test-apply m)
(if (eq? 'NoteEvent (ly:music-property Voice 'name))
(let ((dur (ly:music-property m 'duration)))
(display "\nduration: ")(display dur)(display "\n--\n"))
)
m)
test-func=#(define-music-function (parser location music) (ly:music?)
(music-map test-apply music))
melody={ c4. d8 e8*2 f2 }
\test-func { \melody }
This works fine, but I wanted to evaluate the position of the current note
within the current bar. I found the measurePosition property, but to use
ly:context-property context 'measurePosition
in my function, I need the appropriate context. How can I achieve that?
(I think it must be something very simple, but digging in the sources and
the manuals, I didn't get a hint. the lsr provides a solution with
\applyOutput, but this doesn't work here).
Thanks,
Marc
- measurePosition within a music function?,
Marc Hohl <=