]> git.donarmstrong.com Git - lilypond.git/blob - input/test/ambitus-mixed.ly
* input/test/ambitus-mixed.ly (texidoc): new file.
[lilypond.git] / input / test / ambitus-mixed.ly
1
2 \header {
3 texidoc = "Ambituses can be switched off or translated by using
4 applyoutput.
5
6 If you want to mix per-voice and per-staff ambiti, then you have to
7 define you have to declare a new context type derived from the
8 @code{Voice} context or @code{Staff} context.  The derived context
9 must consist of the @code{Ambitus_engraver} and it must be accepted by
10 a proper parent context, in the below example the @code{Staff} context
11 or @code{Score} context, respectively.  The original context and the
12 derived context can then be used in parallel in the same score. (this is not demonstrated in this file).
13 "
14 }
15
16 \version "1.9.6"
17
18 #(define (kill-ambitus grob grob-context apply-context)
19   (if (memq 'ambitus-interface (ly:get-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:get-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 }