#include <cstdio>
using namespace std;
-#include "dot-column.hh"
+#include "rhythmic-head.hh"
+#include "output-def.hh"
+#include "music.hh"
#include "dots.hh"
-#include "duration.hh"
+#include "dot-column.hh"
+#include "staff-symbol-referencer.hh"
#include "item.hh"
-#include "output-def.hh"
-#include "pitch.hh"
-#include "rhythmic-head.hh"
#include "score-engraver.hh"
-#include "staff-symbol-referencer.hh"
-#include "stream-event.hh"
#include "warn.hh"
-
-#include "translator.icc"
+#include "duration.hh"
/**
make (guitar-like) tablature note
{
vector<Item*> notes_;
- vector<Stream_event*> note_events_;
- vector<Stream_event*> tabstring_events_;
+ vector<Item*> dots_;
+ vector<Music*> note_events_;
+ vector<Music*> tabstring_events_;
public:
TRANSLATOR_DECLARATIONS (Tab_note_heads_engraver);
protected:
- DECLARE_TRANSLATOR_LISTENER (note);
- DECLARE_TRANSLATOR_LISTENER (string_number);
+ virtual bool try_music (Music *event);
void process_music ();
void stop_translation_timestep ();
{
}
-IMPLEMENT_TRANSLATOR_LISTENER (Tab_note_heads_engraver, note);
-void
-Tab_note_heads_engraver::listen_note (Stream_event *ev)
+bool
+Tab_note_heads_engraver::try_music (Music *m)
{
- note_events_.push_back (ev);
-}
+ if (m->is_mus_type ("note-event"))
+ {
+ note_events_.push_back (m);
+ return true;
+ }
+ else if (m->is_mus_type ("string-number-event"))
+ {
+ tabstring_events_.push_back (m);
+ return true;
+ }
+ else if (m->is_mus_type ("busy-playing-event"))
+ return note_events_.size ();
-IMPLEMENT_TRANSLATOR_LISTENER (Tab_note_heads_engraver, string_number);
-void
-Tab_note_heads_engraver::listen_string_number (Stream_event *ev)
-{
- tabstring_events_.push_back (ev);
+ return false;
}
void
int number_of_strings = ((int) ly_length (stringTunings));
bool high_string_one = to_boolean (get_property ("highStringOne"));
- Stream_event *event = note_events_[i];
+ Music *event = note_events_[i];
Item *note = make_item ("TabNoteHead", event->self_scm ());
- Stream_event *tabstring_event = 0;
+ Music *tabstring_event = 0;
for (SCM s = event->get_property ("articulations");
!tabstring_event && scm_is_pair (s); s = scm_cdr (s))
{
- Stream_event *art = unsmob_stream_event (scm_car (s));
+ Music *art = unsmob_music (scm_car (s));
- if (art->in_event_class ("string-number-event"))
+ if (art->is_mus_type ("string-number-event"))
tabstring_event = art;
}
}
Duration dur = *unsmob_duration (event->get_property ("duration"));
+ note->set_property ("duration-log",
+ scm_from_int (dur.duration_log ()));
+
+ if (dur.dot_count ())
+ {
+ Item *d = make_item ("Dots", event->self_scm ());
+ Rhythmic_head::set_dots (note, d);
+
+ if (dur.dot_count ()
+ != scm_to_int (d->get_property ("dot-count")))
+ d->set_property ("dot-count", scm_from_int (dur.dot_count ()));
+
+ d->set_parent (note, Y_AXIS);
+
+ dots_.push_back (d);
+ }
SCM scm_pitch = event->get_property ("pitch");
SCM proc = get_property ("tablatureFormat");
Tab_note_heads_engraver::stop_translation_timestep ()
{
notes_.clear ();
+ dots_.clear ();
note_events_.clear ();
tabstring_events_.clear ();
}
-ADD_TRANSLATOR (Tab_note_heads_engraver,
- /* doc */ "Generate one or more tablature noteheads from event of type NoteEvent.",
- /* create */
- "TabNoteHead "
- ,
-
- /* accept */
- "note-event "
- "string-number-event ",
-
- /* read */
- "middleCPosition "
- "stringTunings "
- "minimumFret "
- "tablatureFormat "
- "highStringOne "
- "stringOneTopmost ",
+#include "translator.icc"
+ADD_TRANSLATOR (Tab_note_heads_engraver,
+ /* doc */ "Generate one or more tablature noteheads from Music of type NoteEvent.",
+ /* create */ "TabNoteHead Dots",
+ /* accept */ "note-event string-number-event busy-playing-event",
+ /* read */ "middleCPosition stringTunings minimumFret tablatureFormat highStringOne stringOneTopmost",
/* write */ "");