2 pitch.hh -- declare Pitch
4 source file of the GNU LilyPond music typesetter
6 (c) 1998--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
9 #ifndef MUSICAL_PITCH_HH
10 #define MUSICAL_PITCH_HH
12 #include "lily-proto.hh"
14 #include "rational.hh"
17 /** A "tonal" pitch. This is a pitch used in diatonal western music
18 (24 quartertones in an octave), as opposed to a frequency in Hz or a
19 integer number of semitones.
21 Pitch is lexicographically ordered by (octave, notename,
33 void transpose (Pitch);
39 int get_octave () const;
40 int get_notename () const;
41 Rational get_alteration () const;
43 Pitch (int octave, int notename, Rational accidental);
44 Pitch (int octave, int notename);
47 Pitch transposed (Pitch) const;
48 Pitch to_relative_octave (Pitch) const;
50 static int compare (Pitch const &, Pitch const &);
53 Rational tone_pitch () const;
54 int rounded_semitone_pitch () const;
55 int rounded_quartertone_pitch () const;
56 Pitch negated () const;
57 string to_string () const;
59 DECLARE_SCHEME_CALLBACK (less_p, (SCM a, SCM b));
60 DECLARE_SIMPLE_SMOBS (Pitch);
76 extern Rational DOUBLE_FLAT_ALTERATION;
77 extern Rational THREE_Q_FLAT_ALTERATION;
78 extern Rational FLAT_ALTERATION;
79 extern Rational SEMI_FLAT_ALTERATION;
80 extern Rational NATURAL_ALTERATION;
81 extern Rational SEMI_SHARP_ALTERATION;
82 extern Rational SHARP_ALTERATION;
83 extern Rational THREE_Q_SHARP_ALTERATION;
84 extern Rational DOUBLE_SHARP_ALTERATION;
86 SCM ly_pitch_diff (SCM pitch, SCM root);
87 SCM ly_pitch_transpose (SCM p, SCM delta);
88 DECLARE_UNSMOB (Pitch, pitch);
90 INSTANTIATE_COMPARE (Pitch, Pitch::compare);
92 extern SCM pitch_less_proc;
93 Pitch pitch_interval (Pitch const &from, Pitch const &to);
95 #endif /* MUSICAL_PITCH_HH */