]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/musical-pitch.hh
release: 1.0.1
[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.uu.nl>
7   
8  */
9
10 #ifndef MUSICAL_PITCH_HH
11 #define MUSICAL_PITCH_HH
12
13 #include "lily-proto.hh"
14 #include "input.hh"
15
16 /** The pitch as it figures in diatonal western music (12 semitones in
17    an octave).
18
19    It is not Music because, it has to duration associated
20 */
21 struct Musical_pitch : public Input
22 {
23   Musical_pitch ();
24
25   /// 0 is c, 6 is b
26   int notename_i_;
27   /// 0 is central c
28   int octave_i_;
29   /// 0 natural, 1 sharp, etc
30   int accidental_i_;
31
32   void init () ;
33   Musical_pitch to_relative_octave (Musical_pitch);
34   void transpose (Musical_pitch);
35   static int compare (Musical_pitch const&,Musical_pitch const&);
36   /// return large part of interval from central c
37   int steps() const;
38   /// return pitch from central c (in halfnotes)
39   int semitone_pitch() const; 
40   void up_to (int);
41   void down_to (int);
42   String str () const;
43   void print () const;
44 };
45
46 #include "compare.hh"
47 INSTANTIATE_COMPARE(Musical_pitch, Musical_pitch::compare);
48
49 #endif /* MUSICAL_PITCH_HH */
50