- Item * note_p = new Item (get_property ("TabNoteHead"));
-
- Music * req = note_req_l_arr_[i];
-
- Music * tabstring_req = tabstring_req_arr_[i];
-
- size_t lenp;
- char* tab_string_as_str = gh_scm2newstr(tabstring_req->get_mus_property ("text"), &lenp);
- int tab_string = atoi(tab_string_as_str);
-
- Duration dur = *unsmob_duration (req->get_mus_property ("duration"));
-
- note_p->set_grob_property ("duration-log", gh_int2scm (dur.duration_log ()));
+ SCM stringTunings = get_property ("stringTunings");
+ int number_of_strings = ((int) ly_length (stringTunings));
+ bool high_string_one = to_boolean (get_property ("highStringOne"));
+
+ Music *event = note_events_[i];
+ Item *note = make_item ("TabNoteHead", event->self_scm ());
+
+ Music *tabstring_event = 0;
+
+ for (SCM s = event->get_property ("articulations");
+ !tabstring_event && scm_is_pair (s); s = scm_cdr (s))
+ {
+ Music *art = unsmob_music (scm_car (s));
+
+ if (art->is_mus_type ("string-number-event"))
+ tabstring_event = art;
+ }
+
+ if (!tabstring_event && j < tabstring_events_.size ())
+ {
+ tabstring_event = tabstring_events_[j];
+ if (j +1 < tabstring_events_.size ())
+ j++;
+ }
+
+ int tab_string;
+ bool string_found;
+ if (tabstring_event)
+ {
+ tab_string = scm_to_int (tabstring_event->get_property ("string-number"));
+ string_found = true;
+ }
+ else
+ {
+ tab_string = high_string_one ? 1 : number_of_strings;
+ string_found = false;
+ }
+
+ Duration dur = *unsmob_duration (event->get_property ("duration"));
+ note->set_property ("duration-log",
+ scm_from_int (dur.duration_log ()));