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 ()));
{
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;
}
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.")
{
}
-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.")
{
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}")
{
{
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 ());