2 pitch.hh -- declare Pitch
4 source file of the GNU LilyPond music typesetter
6 (c) 1998--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
9 #ifndef MUSICAL_PITCH_HH
10 #define MUSICAL_PITCH_HH
12 #include "lily-proto.hh"
15 #include "std-vector.hh"
19 vector<int> step_semitones_;
22 DECLARE_SMOBS (Scale);
26 /** A "tonal" pitch. This is a pitch used in diatonal western music
27 (24 quartertones in an octave), as opposed to a frequency in Hz or a
28 integer number of semitones.
30 Pitch is lexicographically ordered by (octave, notename,
36 - add indeterminate octaves, so it can be used as a key in keySigature
50 void transpose (Pitch);
57 int get_octave () const;
58 int get_notename () const;
59 int get_alteration () const;
61 Pitch (int octave, int notename, int accidental);
64 Pitch transposed (Pitch) const;
65 Pitch to_relative_octave (Pitch) const;
67 static int compare (Pitch const &, Pitch const &);
70 int semitone_pitch () const;
71 int quartertone_pitch () const;
72 string to_string () const;
74 DECLARE_SCHEME_CALLBACK (less_p, (SCM a, SCM b));
75 DECLARE_SIMPLE_SMOBS (Pitch);
91 SCM ly_pitch_diff (SCM pitch, SCM root);
92 SCM ly_pitch_transpose (SCM p, SCM delta);
93 DECLARE_UNSMOB (Pitch, pitch);
95 INSTANTIATE_COMPARE (Pitch, Pitch::compare);
97 extern SCM pitch_less_proc;
98 Pitch pitch_interval (Pitch const &from, Pitch const &to);
99 extern Scale *default_global_scale;
101 #endif /* MUSICAL_PITCH_HH */