Use scalar instead of embedded_scm for context mod overrides.
[lilypond/mpolesky.git] / lily / performer-group.cc
blob1f9e9aee12f0117a3808cb9ef66d7e17f195afd0
1 /*
2 performer-group-performer.cc -- implement Performer_group
4 source file of the GNU LilyPond music typesetter
6 (c) 1996--2009 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 Jan Nieuwenhuizen <janneke@gnu.org>
8 */
10 #include "performer-group.hh"
12 #include "context.hh"
13 #include "audio-element.hh"
14 #include "warn.hh"
16 ADD_TRANSLATOR_GROUP (Performer_group,
17 /* doc */
18 "",
20 /* create */
21 "",
23 /* read */
24 "",
26 /* write */
30 void
31 Performer_group::announce_element (Audio_element_info info)
33 announce_infos_.push_back (info);
34 Translator_group *t
35 = context ()->get_parent_context ()->implementation ();
37 if (Performer_group *eg = dynamic_cast<Performer_group *> (t))
38 eg->announce_element (info);
41 void
42 Performer_group::acknowledge_audio_elements ()
44 for (vsize j = 0; j < announce_infos_.size (); j++)
46 Audio_element_info info = announce_infos_[j];
48 for (SCM p = get_simple_trans_list (); scm_is_pair (p); p = scm_cdr (p))
50 Translator *t = unsmob_translator (scm_car (p));
51 Performer *eng = dynamic_cast<Performer *> (t);
52 if (eng && eng != info.origin_trans_)
53 eng->acknowledge_audio_element (info);
58 void
59 performer_each (SCM list, Performer_method method)
61 for (SCM p = list; scm_is_pair (p); p = scm_cdr (p))
63 Performer *e = dynamic_cast<Performer *> (unsmob_translator (scm_car (p)));
64 if (e)
65 (e->*method) ();
69 void
70 Performer_group::do_announces ()
72 for (SCM s = context ()->children_contexts ();
73 scm_is_pair (s); s = scm_cdr (s))
75 Context *c = unsmob_context (scm_car (s));
76 Performer_group *group
77 = dynamic_cast<Performer_group *> (c->implementation ());
78 if (group)
79 group->do_announces ();
82 while (1)
84 performer_each (get_simple_trans_list (),
85 &Performer::create_audio_elements);
87 if (!announce_infos_.size ())
88 break;
90 acknowledge_audio_elements ();
91 announce_infos_.clear ();