- 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 ();
- }
-
- 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"))
- 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);
+ if (Pitch *p = unsmob<Pitch> (val))
+ {
+ Pitch transposed = p->transposed (delta);
+
+ if (scm_is_eq (prop, ly_symbol2scm ("tonic")))
+ transposed = Pitch (-1, transposed.get_notename (),
+ transposed.get_alteration ());
+
+ new_val = transposed.smobbed_copy ();
+ }
+ else if (scm_is_eq (prop, ly_symbol2scm ("element")))
+ {
+ if (Prob *m = unsmob<Prob> (val))
+ m->transpose (delta);
+ }
+ else if (scm_is_eq (prop, ly_symbol2scm ("elements"))
+ || scm_is_eq (prop, ly_symbol2scm ("articulations")))
+ transpose_music_list (val, delta);
+ else if (scm_is_eq (prop, ly_symbol2scm ("pitch-alist"))
+ && scm_is_pair (val))
+ new_val = ly_transpose_key_alist (val, delta.smobbed_copy ());
+
+ if (!scm_is_eq (val, new_val))
+ scm_set_cdr_x (entry, new_val);