2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 1998--2010 Han-Wen Nienhuys <hanwen@xs4all.nl>
6 LilyPond is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 LilyPond is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
23 #include "lily-proto.hh"
25 #include "rational.hh"
29 A "tonal" pitch. This is a pitch used in diatonal western music
30 (24 quartertones in an octave), as opposed to a frequency in Hz or a
31 integer number of semitones.
33 Pitch is lexicographically ordered by (octave, notename, alteration).
44 void transpose (Pitch);
47 void normalize_octave ();
48 void normalize_alteration ();
52 int get_octave () const;
53 int get_notename () const;
54 Rational get_alteration () const;
56 Pitch (int octave, int notename, Rational accidental);
57 Pitch (int octave, int notename);
60 Pitch transposed (Pitch) const;
61 Pitch to_relative_octave (Pitch) const;
63 Pitch normalized () const;
65 static int compare (Pitch const &, Pitch const &);
68 Rational tone_pitch () const;
69 int rounded_semitone_pitch () const;
70 int rounded_quartertone_pitch () const;
71 Pitch negated () const;
72 string to_string () const;
74 DECLARE_SCHEME_CALLBACK (less_p, (SCM a, SCM b));
75 DECLARE_SIMPLE_SMOBS (Pitch);
91 extern Rational DOUBLE_FLAT_ALTERATION;
92 extern Rational THREE_Q_FLAT_ALTERATION;
93 extern Rational FLAT_ALTERATION;
94 extern Rational SEMI_FLAT_ALTERATION;
95 extern Rational NATURAL_ALTERATION;
96 extern Rational SEMI_SHARP_ALTERATION;
97 extern Rational SHARP_ALTERATION;
98 extern Rational THREE_Q_SHARP_ALTERATION;
99 extern Rational DOUBLE_SHARP_ALTERATION;
101 SCM ly_pitch_diff (SCM pitch, SCM root);
102 SCM ly_pitch_transpose (SCM p, SCM delta);
103 DECLARE_UNSMOB (Pitch, pitch);
105 INSTANTIATE_COMPARE (Pitch, Pitch::compare);
107 extern SCM pitch_less_proc;
108 Pitch pitch_interval (Pitch const &from, Pitch const &to);
110 #endif /* PITCH_HH */