]> git.donarmstrong.com Git - lilypond.git/blob - input/test/ambitus-mixed.ly
*** empty log message ***
[lilypond.git] / input / test / ambitus-mixed.ly
1
2 \header {
3 texidoc = "The showing of ambituses can be switched off or they can be
4 shifted horizontally by using @code{applyoutput}.
5
6 If you want to mix per-voice and per-staff ambituses, then you have to
7 define new context type derived from the @code{Voice} or @code{Staff} 
8 context.  The derived context must contain the @code{Ambitus_engraver} 
9 and it must be accepted by a proper parent context, which are respectively
10 the @code{Staff} context or @code{Score} context in the example below. 
11 The original context and the derived context can then be used in parallel 
12 in the same score (not demonstrated in this file).
13 "
14 }
15
16 \version "2.1.28"
17
18 #(define (kill-ambitus grob grob-context apply-context)
19   (if (memq 'ambitus-interface (ly:grob-property grob 'interfaces))
20    (ly:grob-suicide grob)
21   ))
22
23 #(define ((shift-ambitus x) grob grob-context apply-context)
24   (if (memq 'ambitus-interface (ly:grob-property grob 'interfaces))
25    (ly:grob-translate-axis! grob x X)
26   ))
27
28
29
30 voiceA = \notes \relative c'' {
31   c4 a d e f2
32 }
33 voiceB = \notes \relative c' {
34   es4 f g as b2 
35 }
36 \score {
37   \context ChoirStaff <<
38     \new Staff <<
39         {
40            \applyoutput  #(shift-ambitus 1.0)
41             \voiceA
42            } \\
43        {
44            \voiceB
45        }
46     >>
47     \new Staff <<
48        {  \applyoutput #kill-ambitus \voiceA } \\
49        {  \applyoutput #kill-ambitus \voiceB }
50     >>
51   >>
52   \paper {
53     raggedright = ##t
54
55     \translator {
56         \VoiceContext
57       \consists Ambitus_engraver
58     }
59     }
60 }