X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fevent.cc;h=ed0a826c697c235ddf4567fcf0f79099ec59e8fd;hb=62e36043035ba8e0a9c1137077ff45d794a7003e;hp=944aa5417f9e756ea3ce9c8bdc0fe1167ddc8deb;hpb=1036b837e5c947284f1b64029b912793edab3dad;p=lilypond.git diff --git a/lily/event.cc b/lily/event.cc index 944aa5417f..ed0a826c69 100644 --- a/lily/event.cc +++ b/lily/event.cc @@ -33,13 +33,18 @@ Event::compress (Moment m) void Event::transpose (Pitch delta) { + /* + TODO: should change music representation such that + _all_ pitch values are transposed automatically. + */ + Pitch *p = unsmob_pitch (get_mus_property ("pitch")); if (!p) return ; Pitch np = p->transposed (delta); - if (abs (np.get_alteration ()) > 2) + if (abs (np.get_alteration ()) > DOUBLE_SHARP) { warning (_f ("Transposition by %s makes alteration larger than two", delta.to_string ())); @@ -56,6 +61,22 @@ Event::to_relative_octave (Pitch last) { Pitch new_pit = *old_pit; new_pit = new_pit.to_relative_octave (last); + + SCM check = get_mus_property ("absolute-octave"); + if (gh_number_p (check) && + new_pit.get_octave () != gh_scm2int (check)) + { + String s =_("Failed octave check, got: "); + s += new_pit.to_string (); + new_pit = Pitch (gh_scm2int (check), + new_pit.get_notename (), + new_pit.get_alteration ()); + + s += " expected "; + s += new_pit.to_string (); + origin ()->warning (s); + } + set_mus_property ("pitch", new_pit.smobbed_copy ()); return new_pit; @@ -69,7 +90,7 @@ Event::Event () } ADD_MUSIC(Event); -LY_DEFINE(music_duration_length, "music-duration-length", 1, 0,0, +LY_DEFINE(ly_music_duration_length, "ly:music-duration-length", 1, 0,0, (SCM mus), "Extract the duration field from @var{mus}, and return the length.") { @@ -91,7 +112,7 @@ LY_DEFINE(music_duration_length, "music-duration-length", 1, 0,0, } -LY_DEFINE(music_duration_compress, "ly:music-duration-compress", 2, 0,0, +LY_DEFINE(ly_music_duration_compress, "ly:music-duration-compress", 2, 0,0, (SCM mus, SCM factor), "Extract the duration field from @var{mus}, and compress it.") { @@ -115,7 +136,7 @@ LY_DEFINE(music_duration_compress, "ly:music-duration-compress", 2, 0,0, TODO: this should use ly:pitch. */ -LY_DEFINE(transpose_key_alist, "ly:transpose-key-alist", +LY_DEFINE(ly_transpose_key_alist, "ly:transpose-key-alist", 2, 0,0, (SCM l, SCM pitch), "Make a new key alist of @var{l} transposed by pitch @var{pitch}") { @@ -158,7 +179,7 @@ Key_change_ev::transpose (Pitch p) { SCM pa = get_mus_property ("pitch-alist"); - set_mus_property ("pitch-alist", transpose_key_alist (pa, p.smobbed_copy())); + set_mus_property ("pitch-alist", ly_transpose_key_alist (pa, p.smobbed_copy())); Pitch tonic = *unsmob_pitch (get_mus_property ("tonic")); set_mus_property ("tonic", tonic.smobbed_copy ());