lilypond-0.1.57
[lilypond.git] / lily / key.cc
blob56a6278cfa118bf7655d777727b6fa3ac2750317
1 /*
2 key.cc -- implement Key, Octave_key
4 source file of the GNU LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
8 TODO
9 transposition.
12 #include "key.hh"
13 #include "debug.hh"
15 const int OCTAVES=14; // ugh..
16 const int ZEROOCTAVE=7;
19 void
20 Octave_key::print () const
22 for (int i= 0; i < 7 ; i++)
23 DOUT << "note " << i << " acc: " << accidental_i_arr_[i] << "\n";
28 Octave_key::Octave_key()
30 accidental_i_arr_.set_size (7);
31 clear ();
34 void
35 Octave_key::clear ()
37 for (int i= 0; i < 7 ; i++)
38 accidental_i_arr_[i] = 0;
41 Key::Key()
43 multi_octave_b_ = false;
44 octaves.set_size (OCTAVES);
47 Octave_key&
48 Key::oct (int i)
50 return octaves[i+ZEROOCTAVE];
54 void
55 Octave_key::set (int i, int a)
57 assert (a > -3 && a < 3);
58 accidental_i_arr_[i]=a;
61 void
62 Key::set (int o, int n , int a)
64 octaves[o + ZEROOCTAVE].set (n,a);
67 void
68 Key::set (int n, int a)
70 for (int i= 0; i < OCTAVES ; i++)
71 octaves[i].set (n,a);
73 void
74 Key::clear ()
76 for (int i= 0; i < OCTAVES ; i++)
77 octaves[i].clear ();
79 void
80 Key::print () const
82 for (int i= 0; i < OCTAVES ; i++)
84 DOUT << "octave " << i - ZEROOCTAVE << " Octave_key { ";
85 octaves[i].print ();
86 DOUT << "}\n";