Nitpick: ly:spanner-bound grob name slur -> spanner.
[lilypond.git] / lily / relative-octave-check.cc
blobe2ed2e6e0491c25d1067071f780d37f7e257d06a
1 /*
2 relative-octave-check.cc -- implement Relative_octave_check
4 source file of the GNU LilyPond music typesetter
6 (c) 2005--2009 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
9 #include "input.hh"
10 #include "international.hh"
11 #include "music.hh"
13 class Relative_octave_check
15 public:
16 DECLARE_SCHEME_CALLBACK (relative_callback, (SCM, SCM));
19 MAKE_SCHEME_CALLBACK (Relative_octave_check, relative_callback, 2)
20 SCM
21 Relative_octave_check::relative_callback (SCM music, SCM last_pitch)
23 Pitch p = *unsmob_pitch (last_pitch);
24 Music *m = unsmob_music (music);
25 Pitch *check_p = unsmob_pitch (m->get_property ("pitch"));
27 int delta_oct = 0;
28 if (check_p)
30 Pitch no_octave (-1,
31 check_p->get_notename (),
32 check_p->get_alteration ());
34 Pitch result = no_octave.to_relative_octave (p);
36 if (result != *check_p)
38 string s = _ ("Failed octave check, got: ");
39 s += result.to_string ();
41 m->origin ()->warning (s);
43 delta_oct = check_p->get_octave () - result.get_octave ();
47 return Pitch (p.get_octave () + delta_oct,
48 p.get_notename (),
49 p.get_alteration ()).smobbed_copy ();