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.

Staff notation 111<br />

}<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

Add<strong>in</strong>g <strong>in</strong>dicators to staves which get split after a break<br />

This snippet def<strong>in</strong>es the \splitStaffBarL<strong>in</strong>e command, which adds arrows <strong>in</strong> north-east and<br />

south-east directions at a bar l<strong>in</strong>e, to denote that several voices shar<strong>in</strong>g a staff will each cont<strong>in</strong>ue<br />

on a staff of their own <strong>in</strong> the next system.<br />

#(def<strong>in</strong>e-markup-command (arrow-at-angle layout props angle-deg length fill)<br />

(number? number? boolean?)<br />

(let* (<br />

;; PI-OVER-180 and degrees->radians are taken from flag-styles.scm<br />

(PI-OVER-180 (/ (atan 1 1) 45))<br />

(degrees->radians (lambda (degrees) (* degrees PI-OVER-180)))<br />

(angle-rad (degrees->radians angle-deg))<br />

(target-x (* length (cos angle-rad)))<br />

(target-y (* length (s<strong>in</strong> angle-rad))))<br />

(<strong>in</strong>terpret-markup layout props<br />

(markup<br />

#:translate (cons (/ target-x 2) (/ target-y 2))<br />

#:rotate angle-deg<br />

#:translate (cons (/ length -2) 0)<br />

#:concat (#:draw-l<strong>in</strong>e (cons length 0)<br />

#:arrow-head X RIGHT fill)))))<br />

splitStaffBarL<strong>in</strong>eMarkup = \markup \with-dimensions #'(0 . 0) #'(0 . 0) {<br />

\comb<strong>in</strong>e<br />

\arrow-at-angle #45 #(sqrt 8) ##f<br />

\arrow-at-angle #-45 #(sqrt 8) ##f<br />

}<br />

splitStaffBarL<strong>in</strong>e = {<br />

\once \override Staff.BarL<strong>in</strong>e #'stencil =<br />

#(lambda (grob)<br />

(ly:stencil-comb<strong>in</strong>e-at-edge<br />

(ly:bar-l<strong>in</strong>e::pr<strong>in</strong>t grob)<br />

X RIGHT<br />

(grob-<strong>in</strong>terpret-markup grob splitStaffBarL<strong>in</strong>eMarkup)<br />

0))<br />

\break<br />

}

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

Saved successfully!

Ooh no, something went wrong!