2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 2012 Mike Solomon <mike@mikesolomon.org>
6 LilyPond is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 LilyPond is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
20 #include "rhythmic-music-iterator.hh"
23 #include "dispatcher.hh"
24 #include "duration.hh"
26 #include "international.hh"
30 Rhythmic_music_iterator::Rhythmic_music_iterator ()
35 Rhythmic_music_iterator::construct_children ()
37 Simple_music_iterator::construct_children ();
38 descend_to_bottom_context ();
42 Rhythmic_music_iterator::process (Moment m)
44 if (last_processed_mom_ < Moment (0))
47 descend_to_bottom_context ();
49 Context *c = get_outlet ();
50 Stream_event *ev = get_music ()->to_event (c);
51 SCM arts = ev->get_property ("articulations");
53 if (scm_is_pair (arts))
55 // There is no point in broadcasting articulations like
56 // harmonic events that nobody listens to. Those work
57 // exclusively as articulations.
58 SCM listened = SCM_EOL;
59 SCM unlistened = SCM_EOL;
60 for (; scm_is_pair (arts); arts = scm_cdr (arts))
62 SCM art = scm_car (arts);
64 if (c->event_source ()->is_listened_class
65 (unsmob_stream_event (art)->get_property ("class")))
66 listened = scm_cons (art, listened);
68 unlistened = scm_cons (art, unlistened);
70 ev->set_property ("articulations", scm_reverse_x (unlistened, SCM_EOL));
71 c->event_source ()->broadcast (ev);
72 arts = scm_reverse_x (listened, SCM_EOL);
73 for (; scm_is_pair (arts); arts = scm_cdr (arts))
74 c->event_source ()->broadcast (unsmob_stream_event (scm_car (arts)));
77 c->event_source ()->broadcast (ev);
81 Simple_music_iterator::process (m);
84 IMPLEMENT_CTOR_CALLBACK (Rhythmic_music_iterator);