-#include "event.hh"
-
-Moment
-Event::get_length () const
-{
- Duration *d = unsmob_duration (get_property ("duration"));
- if (!d)
- {
- Moment m ;
- return m;
- }
- return d->get_length ();
-}
-
-void
-Event::compress (Moment m)
-{
- Duration *d = unsmob_duration (get_property ("duration"));
- if (d)
- set_property ("duration", d ->compressed (m.main_part_).smobbed_copy ());
-}
-
-void
-Event::transpose (Pitch delta)
-{
- /*
- TODO: should change music representation such that
- _all_ pitch values are transposed automatically.
- */
-
- Pitch *p = unsmob_pitch (get_property ("pitch"));
- if (!p)
- return ;
-
- Pitch np = p->transposed (delta);
-
- if (abs (np.get_alteration ()) > DOUBLE_SHARP)
- {
- warning (_f ("Transposition by %s makes alteration larger than two",
- delta.to_string ()));
- }
-
- set_property ("pitch", np.smobbed_copy ());
-}
-
-Pitch
-Event::to_relative_octave (Pitch last)
-{
- Pitch *old_pit = unsmob_pitch (get_property ("pitch"));
- if (old_pit)
- {
- Pitch new_pit = *old_pit;
- new_pit = new_pit.to_relative_octave (last);
-
- SCM check = get_property ("absolute-octave");
- if (is_number (check) &&
- new_pit.get_octave () != ly_scm2int (check))
- {
- Pitch expected_pit (ly_scm2int (check),
- new_pit.get_notename (),
- new_pit.get_alteration ());
- origin ()->warning (_f ("octave check failed; expected %s, found: %s",
- expected_pit.to_string (),
- new_pit.to_string ()));
- new_pit = expected_pit;
- }
-
- set_property ("pitch", new_pit.smobbed_copy ());
-
- return new_pit;
- }
- return last;
-}
-
-Event::Event ()
- : Music ()
-{
-}
-
-ADD_MUSIC (Event);