]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/musical-pitch.hh
643cf046784f3762435b29a1d01f3189fda8acfe
[lilypond.git] / lily / include / musical-pitch.hh
1 /*   
2   musical-pitch.hh -- declare Musical_pitch
3   
4   source file of the GNU LilyPond music typesetter
5   
6   (c) 1998 Han-Wen Nienhuys <hanwen@cs.ruu.nl>
7   
8  */
9
10 #ifndef MUSICAL_PITCH_HH
11 #define MUSICAL_PITCH_HH
12 #include "lily-proto.hh"
13
14 /** The pitch as it figures in diatonal western music (12 semitones in
15    an octave).
16
17    It is not Music because, it has to duration associated
18 */
19 struct Musical_pitch {
20   /// 0 is c, 6 is b
21   int notename_i_;
22   /// 0 is central c
23   int octave_i_;
24
25     /// 0 natural, 1 sharp, etc
26   int accidental_i_;
27   void init () ;
28   Musical_pitch to_relative_octave (Musical_pitch);
29   void transpose (Musical_pitch);
30   static int compare (Musical_pitch const&,Musical_pitch const&);
31   /// return large part of interval from central c
32   int steps() const;
33   /// return pitch from central c (in halfnotes)
34   int semitone_pitch() const; 
35   Musical_pitch ();
36   void up_to (int);
37   void down_to (int);
38   String str () const;
39   void print () const;
40 };
41
42 #include "compare.hh"
43 INSTANTIATE_COMPARE(Musical_pitch, Musical_pitch::compare);
44
45 #endif /* MUSICAL_PITCH_HH */
46