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 374<br />

;; accord<strong>in</strong>g to the associated pitch<br />

(set! (ly:grob-property (ambitus-note-head (ambitus-note ambitus dire<br />

'cause)<br />

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

(set! (ly:grob-property (ambitus-note-head (ambitus-note ambitus dire<br />

'staff-position)<br />

(+ (ambitus-start-c0 ambitus)<br />

(ly:pitch-steps pitch)))<br />

;; determ<strong>in</strong>e if an accidental shall be pr<strong>in</strong>ted for this note,<br />

;; accord<strong>in</strong>g to the key signature<br />

(let* ((handle (or (assoc (cons (ly:pitch-octave pitch)<br />

(ly:pitch-notename pitch))<br />

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

(assoc (ly:pitch-notename pitch)<br />

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

(sig-alter (if handle (cdr handle) 0)))<br />

(cond ((= (ly:pitch-alteration pitch) sig-alter)<br />

;; the note alteration is <strong>in</strong> the key signature<br />

;; => it does not have to be pr<strong>in</strong>ted<br />

(ly:grob-suicide!<br />

(ambitus-note-accidental (ambitus-note ambitus direction)))<br />

(set! (ly:grob-object (ambitus-note-head (ambitus-note ambit<br />

'accidental-grob)<br />

'()))<br />

(else<br />

;; otherwise, the accidental shall be pr<strong>in</strong>ted<br />

(set! (ly:grob-property (ambitus-note-accidental<br />

(ambitus-note ambitus direction))<br />

'alteration)<br />

(ly:pitch-alteration pitch)))))<br />

;; add the AccidentalPlacement grob to the<br />

;; conditional items of the AmbitusNoteHead<br />

(ly:separation-item::add-conditional-item<br />

(ambitus-note-head (ambitus-note ambitus direction))<br />

accidental-placement)<br />

;; add the AmbitusAccidental to the list of the<br />

;; AccidentalPlacement grob accidentals<br />

(ly:accidental-placement::add-accidental<br />

accidental-placement<br />

(ambitus-note-accidental (ambitus-note ambitus direction)))<br />

;; add the AmbitusNoteHead grob to the AmbitusL<strong>in</strong>e grob<br />

(ly:po<strong>in</strong>ter-group-<strong>in</strong>terface::add-grob<br />

(ambitus-l<strong>in</strong>e ambitus)<br />

'note-heads<br />

(ambitus-note-head (ambitus-note ambitus direction)))))<br />

(list DOWN UP))<br />

;; add the AccidentalPlacement grob to the ma<strong>in</strong> Ambitus grob<br />

(ly:axis-group-<strong>in</strong>terface::add-element (ambitus-group ambitus) accidental-placement)<br />

;; no notes ==> suicide the grobs<br />

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

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

(ly:grob-suicide! (ambitus-note-accidental (ambitus-note ambitus direct

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

Saved successfully!

Ooh no, something went wrong!