]> git.donarmstrong.com Git - lilypond.git/blob - lily/relative-octave-check.cc
* configure.in: Test for and accept lmodern if EC fonts not found.
[lilypond.git] / lily / relative-octave-check.cc
1 #include "relative-octave-check.hh"
2
3 #include "input.hh"
4 #include "pitch.hh"
5
6 /*
7   yeah, so this should be in a separate file.
8   I'm lazy.
9  */
10 Pitch
11 Relative_octave_check::to_relative_octave (Pitch p)
12 {
13   Pitch * check_p = unsmob_pitch (get_property ("pitch"));
14
15   int delta_oct = 0;
16   if (check_p)
17     {
18       Pitch no_octave (-1,
19                        check_p->get_notename (),
20                        check_p->get_alteration ());
21
22       Pitch result = no_octave.to_relative_octave (p);
23
24       if (result != *check_p)
25         {
26           String s = _("Failed octave check, got: ");
27           s += result.to_string ();
28           
29           origin ()->warning (s);
30           
31           delta_oct = check_p->get_octave () - result.get_octave ();
32         }
33     }
34   
35   return  Pitch (p.get_octave () + delta_oct,
36                  p.get_notename (), p.get_alteration ());
37 }
38
39 ADD_MUSIC (Relative_octave_check);