]> git.donarmstrong.com Git - lilypond.git/blob - lily/key.cc
release: 0.0.49
[lilypond.git] / lily / key.cc
1 #include "key.hh"
2
3 const int OCTAVES=14;           // ugh..
4 const int ZEROOCTAVE=7;
5
6 Octave_key::Octave_key()
7 {
8     accidental_i_arr_.set_size(7);
9     for (int i= 0; i < 7 ; i++)
10         accidental_i_arr_[i] = 0;
11 }
12
13 Key::Key()
14 {
15     multi_octave_b_ = false;
16     octaves.set_size(OCTAVES);
17 }
18
19 Octave_key&
20 Key::oct(int i)
21 {
22     return octaves[i+ZEROOCTAVE];    
23 }
24
25 Octave_key
26 Key::oct(int i)const
27 {
28     return octaves[i+ZEROOCTAVE];    
29 }
30
31 void
32 Octave_key::set(int i, int a)
33 {
34     assert(a > -3 && a < 3);
35     accidental_i_arr_[i]=a;    
36 }
37
38 void
39 Key::set(int o, int n , int a)
40 {
41     octaves[o + ZEROOCTAVE].set(n,a);
42 }
43
44 void
45 Key::set (int n, int a)
46 {
47     for (int i= 0; i < OCTAVES ; i++)
48         octaves[i].set(n,a);
49 }