]> git.donarmstrong.com Git - lilypond.git/blob - lily/key.cc
release: 0.1.53
[lilypond.git] / lily / key.cc
1 /*
2   key.cc -- implement Key, Octave_key
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7
8   TODO
9   transposition.
10 */
11
12 #include "key.hh"
13
14 const int OCTAVES=14;           // ugh..
15 const int ZEROOCTAVE=7;
16
17 Octave_key::Octave_key()
18 {
19   accidental_i_arr_.set_size (7);
20   for (int i= 0; i < 7 ; i++)
21         accidental_i_arr_[i] = 0;
22 }
23
24 Key::Key()
25 {
26   multi_octave_b_ = false;
27   octaves.set_size (OCTAVES);
28 }
29
30 Octave_key&
31 Key::oct (int i)
32 {
33   return octaves[i+ZEROOCTAVE];    
34 }
35
36
37 void
38 Octave_key::set (int i, int a)
39 {
40   assert (a > -3 && a < 3);
41   accidental_i_arr_[i]=a;
42 }
43
44 void
45 Key::set (int o, int n , int a)
46 {
47   octaves[o + ZEROOCTAVE].set (n,a);
48 }
49
50 void
51 Key::set (int n, int a)
52 {
53   for (int i= 0; i < OCTAVES ; i++)
54         octaves[i].set (n,a);
55 }