[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Display the name of the staff of a note/rest/chord/skip-event
From: |
Thomas Morley |
Subject: |
Re: Display the name of the staff of a note/rest/chord/skip-event |
Date: |
Sun, 1 Dec 2019 10:56:18 +0100 |
Am Sa., 30. Nov. 2019 um 19:43 Uhr schrieb Paolo Prete <address@hidden>:
>
> Hello,
>
> given a note/rest/chord/skip-event is there a way to display the name of its
> staff? I need to check if it belongs to staff "UP" or "DOWN" of a piano-staff.
> What if I use map-some-music() function?
>
> %%%%%%%%%%%%%%%%
>
> (map-some-music (lambda (evt)
> (let ((name (ly:music-property evt 'name)))
> (cond
> ((or (eq? name 'NoteEvent )(eq? name 'EventChord) (eq? name
> 'RestEvent ) (eq? name 'SkipEvent ))
>
> %%%%%%% (display ?????) %%%%%%%%%
>
> evt)
> (else #f)))) ; => #f = continue, go deeper
> music)
>
> %%%%%%%%%%%%%%%%
>
> Thanks.
There are not many methods to access context and grob at the same time.
\applyOutput is one of them
printStaffID =
\applyOutput
Staff.NoteHead
#(lambda (grob ctx c) (pretty-print (ly:context-id c) ))
musI = { c1 \printStaffID d }
\new Staff = "foo" \musI
musII = { c1 \change Staff = "up" \printStaffID d }
\new PianoStaff <<
\new Staff = "up" s1*2
\new Staff = "down" \musII
>>
HTH,
Harm
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: Display the name of the staff of a note/rest/chord/skip-event,
Thomas Morley <=