- int pos = pit ? pit->steps () : 0;
- SCM c0 = get_property ("centralCPosition");
- if (gh_number_p (c0))
- pos += gh_scm2int (c0);
+ if (scm_is_number (c0))
+ pos += scm_to_int(c0);
+
+ note->set_property ("staff-position", scm_from_int (pos));
+
+ /*
+ Shape note heads change on step of the scale.
+ */
+ SCM shape_vector = get_property ("shapeNoteStyles");
+ if (scm_is_vector (shape_vector))
+ {
+ SCM scm_tonic = get_property ("tonic");
+ Pitch tonic (0, 0, 0);
+ if (unsmob_pitch (scm_tonic))
+ tonic = *unsmob_pitch (scm_tonic);
+
+ unsigned int delta = (pit->get_notename () - tonic.get_notename () + 7) % 7;
+
+ SCM style = SCM_EOL;
+ if (scm_c_vector_length (shape_vector) > delta
+ && scm_is_symbol (scm_vector_ref (shape_vector, scm_from_int (delta))))
+ style = scm_vector_ref (shape_vector, scm_from_int (delta));
+ if (scm_is_symbol (style))
+ note->set_property ("style", style);
+ }