Fixes Issue 1504, allowing feather beam line breaking.
[lilypond/patrick.git] / lily / performer-group.cc
blob70a3f844843271de1ce73d519aee34f04c9d1739
1 /*
2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 1996--2011 Han-Wen Nienhuys <hanwen@xs4all.nl>
5 Jan Nieuwenhuizen <janneke@gnu.org>
7 LilyPond is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
12 LilyPond is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
21 #include "performer-group.hh"
23 #include "context.hh"
24 #include "audio-element.hh"
25 #include "warn.hh"
27 ADD_TRANSLATOR_GROUP (Performer_group,
28 /* doc */
29 "",
31 /* create */
32 "",
34 /* read */
35 "",
37 /* write */
41 void
42 Performer_group::announce_element (Audio_element_info info)
44 announce_infos_.push_back (info);
45 Translator_group *t
46 = context ()->get_parent_context ()->implementation ();
48 if (Performer_group *eg = dynamic_cast<Performer_group *> (t))
49 eg->announce_element (info);
52 void
53 Performer_group::acknowledge_audio_elements ()
55 for (vsize j = 0; j < announce_infos_.size (); j++)
57 Audio_element_info info = announce_infos_[j];
59 for (SCM p = get_simple_trans_list (); scm_is_pair (p); p = scm_cdr (p))
61 Translator *t = unsmob_translator (scm_car (p));
62 Performer *eng = dynamic_cast<Performer *> (t);
63 if (eng && eng != info.origin_trans_)
64 eng->acknowledge_audio_element (info);
69 void
70 performer_each (SCM list, Performer_method method)
72 for (SCM p = list; scm_is_pair (p); p = scm_cdr (p))
74 Performer *e = dynamic_cast<Performer *> (unsmob_translator (scm_car (p)));
75 if (e)
76 (e->*method) ();
80 void
81 Performer_group::do_announces ()
83 for (SCM s = context ()->children_contexts ();
84 scm_is_pair (s); s = scm_cdr (s))
86 Context *c = unsmob_context (scm_car (s));
87 Performer_group *group
88 = dynamic_cast<Performer_group *> (c->implementation ());
89 if (group)
90 group->do_announces ();
93 while (1)
95 performer_each (get_simple_trans_list (),
96 &Performer::create_audio_elements);
98 if (!announce_infos_.size ())
99 break;
101 acknowledge_audio_elements ();
102 announce_infos_.clear ();