10.04.2013 Views

in Snippets - LilyPond

in Snippets - LilyPond

in Snippets - LilyPond

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Contexts and engravers 373<br />

0))<br />

(set! (ambitus-start-key-sig ambitus)<br />

(ly:context-property (ly:translator-context translator)<br />

'keySignature)))))<br />

#(def<strong>in</strong>e-method (update-ambitus-notes (ambitus ) note-grob)<br />

"Update the upper and lower ambitus pithes of @var{ambitus}, us<strong>in</strong>g<br />

@var{note-grob}."<br />

;; Get the event that caused the note-grob creation<br />

;; and check that it is a note-event.<br />

(let ((note-event (ly:grob-property note-grob 'cause)))<br />

(if (ly:<strong>in</strong>-event-class? note-event 'note-event)<br />

;; get the pitch from the note event<br />

(let ((pitch (ly:event-property note-event 'pitch)))<br />

;; if this pitch is lower than the current ambitus lower<br />

;; note pitch (or it has not been <strong>in</strong>itialized yet),<br />

;; then this pitch is the new ambitus lower pitch,<br />

;; and conversely for upper pitch.<br />

(for-each (lambda (direction pitch-compare)<br />

(if (or (not (ambitus-note-pitch (ambitus-note ambitus direction)))<br />

(pitch-compare pitch<br />

(ambitus-note-pitch (ambitus-note ambitus dire<br />

(beg<strong>in</strong><br />

(set! (ambitus-note-pitch (ambitus-note ambitus direction))<br />

pitch)<br />

(set! (ambitus-note-cause (ambitus-note ambitus direction))<br />

note-event))))<br />

(list DOWN UP)<br />

(list ly:pitch

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!