#include "simple-music-iterator.hh"
/*
- Iterator for atomic music objects: events are generated at the
- beginning and at the end of the music.
+ Iterator for rhythmic music events that are not enclosed by EventChord
*/
class Rhythmic_music_iterator : public Simple_music_iterator
{
protected:
DECLARE_CLASSNAME (Rhythmic_music_iterator);
- //Moment last_processed_mom_;
public:
DECLARE_SCHEME_CALLBACK (constructor, ());
Rhythmic_music_iterator ();
+ Rhythmic_music_iterator (Rhythmic_music_iterator const &);
+
+protected:
virtual void process (Moment);
- //virtual bool ok ()const;
- //virtual Moment pending_moment ()const;
+ virtual void construct_children ();
};
#endif /* RHYTHMIC_MUSIC_ITERATOR_HH */
#include "warn.hh"
Rhythmic_music_iterator::Rhythmic_music_iterator ()
- : Simple_music_iterator ()
{
- last_processed_mom_ = -1;
+}
+
+void
+Rhythmic_music_iterator::construct_children ()
+{
+ Simple_music_iterator::construct_children ();
+ descend_to_bottom_context ();
}
void
descend_to_bottom_context ();
+ Context *c = get_outlet ();
Stream_event *ev = get_music ()->to_event ();
SCM arts = ev->get_property ("articulations");
- Context *c = get_outlet ();
if (scm_is_pair (arts))
{
- ev->set_property ("articulations", SCM_EOL);
+ // There is no point in broadcasting articulations like
+ // harmonic events that nobody listens to. Those work
+ // exclusively as articulations.
+ SCM listened = SCM_EOL;
+ SCM unlistened = SCM_EOL;
+ for (; scm_is_pair (arts); arts = scm_cdr (arts))
+ {
+ if (scm_is_true
+ (scm_call_2
+ (ly_lily_module_constant ("any"),
+ ly_lily_module_constant ("ly:is-listened-event-class"),
+ scm_call_1
+ (ly_lily_module_constant ("ly:make-event-class"),
+ unsmob_stream_event (scm_car (arts))
+ ->get_property ("class")))))
+ listened = scm_cons (scm_car (arts), listened);
+ else
+ unlistened = scm_cons (scm_car (arts), unlistened);
+ }
+ ev->set_property ("articulations", scm_reverse_x (unlistened, SCM_EOL));
c->event_source ()->broadcast (ev);
+ arts = scm_reverse_x (listened, SCM_EOL);
for (; scm_is_pair (arts); arts = scm_cdr (arts))
c->event_source ()->broadcast (unsmob_stream_event (scm_car (arts)));
}
(ClusterNoteEvent
. ((description . "A note that is part of a cluster.")
;; not a note-event, to ensure that Note_heads_engraver doesn't eat it.
+ (iterator-ctor . ,ly:rhythmic-music-iterator::constructor)
(types . (general-music cluster-note-event melodic-event
rhythmic-event event))
))
(LyricEvent
. ((description . "A lyric syllable. Must be entered in lyrics mode,
i.e., @code{\\lyrics @{ twinkle4 twinkle4 @} }.")
+ (iterator-ctor . ,ly:rhythmic-music-iterator::constructor)
(types . (general-music rhythmic-event lyric-event event))
))
print anything.
Syntax: @code{s4} for a skip equivalent to a quarter rest.")
+ (iterator-ctor . ,ly:rhythmic-music-iterator::constructor)
(types . (general-music event rhythmic-event skip-event))
))