2 event.cc -- implement Event
4 source file of the GNU LilyPond music typesetter
6 (c) 1996--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
12 MAKE_SCHEME_CALLBACK(Event,length_callback,1);
14 Event::length_callback (SCM m)
16 Music* me = unsmob_music (m);
17 Duration *d = unsmob_duration (me->get_property ("duration"));
22 mom = d->get_length ();
24 return mom.smobbed_copy();
29 Event::to_relative_octave (Pitch last)
31 Pitch *old_pit = unsmob_pitch (get_property ("pitch"));
34 Pitch new_pit = *old_pit;
35 new_pit = new_pit.to_relative_octave (last);
37 SCM check = get_property ("absolute-octave");
38 if (scm_is_number (check) &&
39 new_pit.get_octave () != scm_to_int (check))
41 Pitch expected_pit (scm_to_int (check),
42 new_pit.get_notename (),
43 new_pit.get_alteration ());
44 origin ()->warning (_f ("octave check failed; expected %s, found: %s",
45 expected_pit.to_string (),
46 new_pit.to_string ()));
47 new_pit = expected_pit;
50 set_property ("pitch", new_pit.smobbed_copy ());
60 if (!ly_c_procedure_p (length_callback_))
62 length_callback_ = length_callback_proc;
68 Key_change_ev::Key_change_ev (SCM x)
73 Key_change_ev::transpose (Pitch p)
75 SCM pa = get_property ("pitch-alist");
76 set_property ("pitch-alist", ly_transpose_key_alist (pa, p.smobbed_copy ()));
81 ADD_MUSIC (Key_change_ev);