X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Frhythmic-music-iterator.cc;h=cff4353f40d235cc81ea1d3ed2f7b76739b5f2a7;hb=331e0656b3ba91200c50c672741977b65a5842af;hp=b547653cd73a6e2751c4c43fd52a682921a83ffb;hpb=868a063d831ce4bf065ce1ec0226f4831bf3c3fc;p=lilypond.git diff --git a/lily/rhythmic-music-iterator.cc b/lily/rhythmic-music-iterator.cc index b547653cd7..cff4353f40 100644 --- a/lily/rhythmic-music-iterator.cc +++ b/lily/rhythmic-music-iterator.cc @@ -1,7 +1,7 @@ /* This file is part of LilyPond, the GNU music typesetter. - Copyright (C) 2012 Mike Solomon + Copyright (C) 2012 Mike Solomon LilyPond is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -28,9 +28,14 @@ #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 @@ -41,19 +46,35 @@ Rhythmic_music_iterator::process (Moment m) 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); - c->event_source ()->broadcast (ev); - for (; scm_is_pair (arts); arts = scm_cdr (arts)) - c->event_source ()->broadcast (unsmob_stream_event (scm_car (arts))); - } + { + // 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)) + { + SCM art = scm_car (arts); + + if (c->event_source ()->is_listened_class + (unsmob (art)->get_property ("class"))) + listened = scm_cons (art, listened); + else + unlistened = scm_cons (art, 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 (scm_car (arts))); + } else - c->event_source ()->broadcast (ev); + c->event_source ()->broadcast (ev); ev->unprotect (); }