Fix InstrumentSwitch grob definition.
[lilypond.git] / lily / relative-octave-music.cc
blobcd8aead2d0d3fa4b0d41ac6847096a38d7867db6
1 /*
2 relative-music.cc -- implement Relative_octave_music
4 source file of the GNU LilyPond music typesetter
6 (c) 1998--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
9 #include "music.hh"
10 #include "warn.hh"
11 #include "program-option.hh"
13 class Relative_octave_music
15 public:
16 DECLARE_SCHEME_CALLBACK (relative_callback, (SCM, SCM));
17 DECLARE_SCHEME_CALLBACK (no_relative_callback, (SCM, SCM));
20 MAKE_SCHEME_CALLBACK (Relative_octave_music, no_relative_callback, 2)
21 SCM
22 Relative_octave_music::no_relative_callback (SCM music, SCM pitch)
24 (void)music;
25 return pitch;
28 MAKE_SCHEME_CALLBACK (Relative_octave_music, relative_callback, 2)
29 SCM
30 Relative_octave_music::relative_callback (SCM music, SCM pitch)
32 Music *me = unsmob_music (music);
33 if (lily_1_8_relative)
35 lily_1_8_compatibility_used = true;
36 /* last-pitch should be junked some time, when
37 we ditch 1.8 compat too.
39 When you do, B should start where A left off.
41 \relative { A \relative { ...} B } */
42 SCM last_pitch = me->get_property ("last-pitch");
43 Pitch *ptr = unsmob_pitch (last_pitch);
44 return (ptr) ? last_pitch : pitch;
46 else
47 return pitch;