* lily/include/lily-guile.hh: many new ly_ functions. Thanks to
[lilypond.git] / lily / performer-group-performer.cc
blobacbe2744e71657bf3452ed734ceb160bc1c57707
1 /*
2 performer-group-performer.cc -- implement Performer_group_performer
4 source file of the GNU LilyPond music typesetter
6 (c) 1996--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 Jan Nieuwenhuizen <janneke@gnu.org>
8 */
10 #include "performer-group-performer.hh"
11 #include "context.hh"
12 #include "audio-element.hh"
13 #include "warn.hh"
16 ENTER_DESCRIPTION (Performer_group_performer,
17 /* descr */ "",
18 /* creats*/ "",
19 /* accepts */ "",
20 /* acks */ "",
21 /* reads */ "",
22 /* write */ "");
26 void
27 Performer_group_performer::announce_element (Audio_element_info info)
29 announce_infos_.push (info);
30 Translator *t
31 = unsmob_translator (daddy_context_->daddy_context_->implementation_);
33 if (Performer_group_performer * eg = dynamic_cast<Performer_group_performer*> (t))
34 eg->announce_element (info);
37 void
38 Performer_group_performer::acknowledge_audio_elements ()
40 for (int j =0; j < announce_infos_.size (); j++)
42 Audio_element_info info = announce_infos_[j];
44 for (SCM p = get_simple_trans_list (); ly_pair_p (p); p = ly_cdr (p))
46 Translator * t = unsmob_translator (ly_car (p));
47 Performer * eng = dynamic_cast<Performer*> (t);
48 if (eng && eng!= info.origin_trans_)
49 eng->acknowledge_audio_element (info);
54 void
55 Performer_group_performer::do_announces ()
57 while (1)
59 create_audio_elements ();
60 performer_each (get_simple_trans_list (),
61 &Performer::create_audio_elements);
63 if (!announce_infos_.size ())
64 break ;
66 acknowledge_audio_elements ();
67 announce_infos_.clear ();
71 Performer_group_performer::Performer_group_performer ()
76 void
77 performer_each (SCM list, Performer_method method)
79 for (SCM p = list; ly_pair_p (p); p = ly_cdr (p))
81 Performer * e = dynamic_cast<Performer*>(unsmob_translator (ly_car (p)));
82 if (e)
83 (e->*method) ();