-
- if (Pitch * p = unsmob_pitch (val))
- {
- Pitch transposed = p->transposed (delta);
- scm_set_cdr_x (entry, transposed.smobbed_copy ());
-
- if (abs (transposed.get_alteration ()) > DOUBLE_SHARP)
- {
- warning (_f ("Transposition by %s makes alteration larger than double",
- delta.to_string ()));
- }
- }
+ SCM new_val = val;
+
+ if (Pitch *p = unsmob_pitch (val))
+ {
+ Pitch transposed = p->transposed (delta);
+ if (transposed.get_alteration ().abs () > Rational (1, 1))
+ {
+ string delta_str;
+ if (delta.get_alteration ().abs () > Rational (1, 1))
+ delta_str = (delta.normalized ().to_string ()
+ + " " + _ ("(normalized pitch)"));
+ else
+ delta_str = delta.to_string ();
+
+ warning (_f ("Transposing %s by %s makes alteration larger than double",
+ p->to_string (),
+ delta_str));
+ transposed = transposed.normalized ();
+ }
+
+ if (prop == ly_symbol2scm ("tonic"))
+ transposed = Pitch (-1, transposed.get_notename (),
+ transposed.get_alteration ());
+
+ new_val = transposed.smobbed_copy ();
+ }
+ else if (prop == ly_symbol2scm ("element"))
+ {
+ if (Music *m = unsmob_music (val))
+ m->transpose (delta);
+ }
+ else if (prop == ly_symbol2scm ("elements")
+ || prop == ly_symbol2scm ("articulations"))
+ transpose_music_list (val, delta);
+ else if (prop == ly_symbol2scm ("pitch-alist")
+ && scm_is_pair (val))
+ new_val = ly_transpose_key_alist (val, delta.smobbed_copy ());
+
+ if (val != new_val)
+ scm_set_cdr_x (entry, new_val);