]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/snippets/adding-indicators-to-staves-which-get-split-after-a-break.ly
LSR updates from tarball
[lilypond.git] / Documentation / snippets / adding-indicators-to-staves-which-get-split-after-a-break.ly
1 %% DO NOT EDIT this file manually; it is automatically
2 %% generated from LSR http://lsr.dsi.unimi.it
3 %% Make any changes in LSR itself, or in Documentation/snippets/new/ ,
4 %% and then run scripts/auxiliar/makelsr.py
5 %%
6 %% This file is in the public domain.
7 \version "2.14.2"
8
9 \header {
10   lsrtags = "staff-notation, vocal-music, symbols-and-glyphs"
11
12 %% Translation of GIT committish: 1cda7b7b8219cb97399b8e7b56c1115aaf82c002
13   texidocfr = "
14 Dans cet extrait est définie la commande @code{\\splitStaffBarLine} qui
15 ajoute une double flèche après la dernière barre de mesure d'une portée,
16 indiquant par là que ses différentes voix disposeront de leur propre
17 portée à la ligne suivante.
18
19 "
20   doctitlefr = "Ajout d'indicateurs à une portée dédoublée après un saut de ligne"
21
22   texidoc = "
23 This snippet defines the @code{\\splitStaffBarLine} command, which adds
24 arrows in north-east and south-east directions at a bar line, to denote
25 that several voices sharing a staff will each continue on a staff of
26 their own in the next system.
27
28 "
29   doctitle = "Adding indicators to staves which get split after a break"
30 } % begin verbatim
31
32 #(define-markup-command (arrow-at-angle layout props angle-deg length fill)
33    (number? number? boolean?)
34    (let* (
35           ;; PI-OVER-180 and degrees->radians are taken from flag-styles.scm
36           (PI-OVER-180 (/ (atan 1 1) 45))
37           (degrees->radians (lambda (degrees) (* degrees PI-OVER-180)))
38           (angle-rad (degrees->radians angle-deg))
39           (target-x (* length (cos angle-rad)))
40           (target-y (* length (sin angle-rad))))
41      (interpret-markup layout props
42                        (markup
43                         #:translate (cons (/ target-x 2) (/ target-y 2))
44                         #:rotate angle-deg
45                         #:translate (cons (/ length -2) 0)
46                         #:concat (#:draw-line (cons length 0)
47                                               #:arrow-head X RIGHT fill)))))
48
49 splitStaffBarLineMarkup = \markup \with-dimensions #'(0 . 0) #'(0 . 0) {
50   \combine
51     \arrow-at-angle #45 #(sqrt 8) ##f
52     \arrow-at-angle #-45 #(sqrt 8) ##f
53 }
54
55 splitStaffBarLine = {
56   \once \override Staff.BarLine #'stencil =
57     #(lambda (grob)
58        (ly:stencil-combine-at-edge
59         (ly:bar-line::print grob)
60         X RIGHT
61         (grob-interpret-markup grob splitStaffBarLineMarkup)
62         0))
63   \break
64 }
65
66 \paper {
67   ragged-right = ##t
68   short-indent = 5\mm
69 }
70
71 \score {
72   <<
73     \new ChoirStaff <<
74       \new Staff \with { instrumentName = #"High I + II" } {
75         <<
76           \repeat unfold 4 f''1
77           \\
78           \repeat unfold 4 d''1
79         >>
80         \splitStaffBarLine
81       }
82       \new Staff \with { instrumentName = #"Low" } {
83         <<
84           \repeat unfold 4 b'1
85           \\
86           \repeat unfold 4 g'1
87         >>
88       }
89
90       \new Staff \with { shortInstrumentName = #"H I" } {
91         R1*4
92         \repeat unfold 2 { r4 f''2 r4 } \repeat unfold 2 e''1
93       }
94       \new Staff \with { shortInstrumentName = #"H II" } {
95         R1*4
96         \repeat unfold 4 b'2 \repeat unfold 2 c''1
97       }
98       \new Staff \with { shortInstrumentName = #"L" } {
99         R1*4
100         <<
101           \repeat unfold 4 g'1
102           \\
103           \repeat unfold 4 c'1
104         >>
105       }
106     >>
107   >>
108   \layout {
109     \context {
110       \Staff \RemoveEmptyStaves
111       \override VerticalAxisGroup #'remove-first = ##t
112     }
113   }
114 }
115