- Note_head *note_p = new Note_head (get_property ("basicNoteHeadProperties"));
-
- Staff_symbol_referencer_interface si (note_p);
- si.set_interface ();
-
-
- Note_req * note_req_l = note_req_l_arr_[i];
-
- note_p->set_elt_property ("duration-log",
- gh_int2scm (note_req_l->duration_.durlog_i_ <? 2));
-
- if (note_req_l->duration_.dots_i_)
- {
- Dots * d = new Dots (get_property ("basicDotsProperties"));
-
- Staff_symbol_referencer_interface sd (d);
- sd.set_interface ();
-
- note_p->add_dots (d);
-
- if (note_req_l->duration_.dots_i_
- != gh_scm2int (d->get_elt_property ("dot-count")))
- d->set_elt_property ("dot-count", gh_int2scm (note_req_l->duration_.dots_i_));
-
- announce_element (Score_element_info (d,0));
- dot_p_arr_.push (d);
- }
- si.set_position(note_req_l->pitch_.steps ());
-
- Score_element_info itinf (note_p,note_req_l);
- announce_element (itinf);
- note_p_arr_.push (note_p);
+ Stream_event *ev = note_evs_[i];
+ Item *note = make_item ("NoteHead", ev->self_scm ());
+
+ Pitch *pit = unsmob<Pitch> (ev->get_property ("pitch"));
+
+#if 0 /* TODO: should have a mechanism to switch off these warnings. */
+
+ if (!pit)
+ ev->origin ()->warning (_ ("NoteEvent without pitch"));
+#endif
+
+ int pos;
+ if (pit == 0)
+ pos = 0;
+ else if (ly_is_procedure (layout_proc))
+ {
+ SCM pitch = ev->get_property ("pitch");
+ pos = scm_to_int (scm_call_1 (layout_proc, pitch));
+ }
+ else
+ pos = pit->steps ();
+
+ 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;
+ 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);
+ }