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
);
36 void normalize_octave ();
37 void normalize_alteration ();
41 int get_octave () const;
42 int get_notename () const;
43 Rational
get_alteration () const;
45 Pitch (int octave
, int notename
, Rational accidental
);
46 Pitch (int octave
, int notename
);
49 Pitch
transposed (Pitch
) const;
50 Pitch
to_relative_octave (Pitch
) const;
52 static int compare (Pitch
const &, Pitch
const &);
55 Rational
tone_pitch () const;
56 int rounded_semitone_pitch () const;
57 int rounded_quartertone_pitch () const;
58 Pitch
negated () const;
59 string
to_string () const;
61 DECLARE_SCHEME_CALLBACK (less_p
, (SCM a
, SCM b
));
62 DECLARE_SIMPLE_SMOBS (Pitch
);
78 extern Rational DOUBLE_FLAT_ALTERATION
;
79 extern Rational THREE_Q_FLAT_ALTERATION
;
80 extern Rational FLAT_ALTERATION
;
81 extern Rational SEMI_FLAT_ALTERATION
;
82 extern Rational NATURAL_ALTERATION
;
83 extern Rational SEMI_SHARP_ALTERATION
;
84 extern Rational SHARP_ALTERATION
;
85 extern Rational THREE_Q_SHARP_ALTERATION
;
86 extern Rational DOUBLE_SHARP_ALTERATION
;
88 SCM
ly_pitch_diff (SCM pitch
, SCM root
);
89 SCM
ly_pitch_transpose (SCM p
, SCM delta
);
90 DECLARE_UNSMOB (Pitch
, pitch
);
92 INSTANTIATE_COMPARE (Pitch
, Pitch::compare
);
94 extern SCM pitch_less_proc
;
95 Pitch
pitch_interval (Pitch
const &from
, Pitch
const &to
);
97 #endif /* MUSICAL_PITCH_HH */