]> git.donarmstrong.com Git - lilypond.git/blob - lily/grace-performer-group.cc
65d4cdef7f0095709f6295c9cbc861d902c42205
[lilypond.git] / lily / grace-performer-group.cc
1 /*   
2   grace-performer-group.cc -- implement Grace_performer_group
3   
4   source file of the GNU LilyPond music playter
5   
6   (c) 1999 Jan Nieuwenhuizen <janneke@gnu.org>
7   
8  */
9 #include "grace-performer-group.hh"
10 #include "lily-guile.hh"
11 #include "ly-symbols.hh"
12 #include "audio-element.hh"
13
14 ADD_THIS_TRANSLATOR (Grace_performer_group);
15
16 void
17 Grace_performer_group::start ()
18 {
19 }
20 /*
21   We're really finished with this context. Get rid of everything.
22  */
23 void
24 Grace_performer_group::finish ()
25 {
26   calling_self_b_ = true;
27   removal_processing ();        // ugr. We'd want to have this done by our parents.g
28   for (int i=0; i < announce_to_top_.size (); i++)
29     {
30       Performer::announce_element (announce_to_top_[i]);
31     }
32
33   for (int i=0; i < play_us_.size (); i++)
34     {
35       Performer::play_element (play_us_[i]);
36     }
37   play_us_.clear ();
38   calling_self_b_ = false;
39 }
40
41 void
42 Grace_performer_group::do_removal_processing ()
43 {
44   Performer_group_performer::do_removal_processing ();
45 }
46
47 void
48 Grace_performer_group::announce_element (Audio_element_info inf)
49 {
50   announce_info_arr_.push (inf);
51   // do not propagate to top
52   announce_to_top_.push (inf);
53
54   //inf.elem_l_->set_elt_property (grace_scm_sym, SCM_BOOL_T);
55 }
56
57 void
58 Grace_performer_group::play_element (Audio_element*e)
59 {
60   play_us_.push (e);
61 }
62
63
64 Grace_performer_group::Grace_performer_group()
65 {
66   calling_self_b_ = false;
67 }
68
69 void
70 Grace_performer_group::process ()
71 {
72   calling_self_b_  = true;
73   process_requests ();
74   do_announces();
75   pre_move_processing();
76   check_removal();
77   calling_self_b_ = false;
78 }
79
80
81 void
82 Grace_performer_group::each (Method_pointer method)
83 {
84   if (calling_self_b_)
85     Performer_group_performer::each (method);
86 }
87
88
89 void
90 Grace_performer_group::each (Const_method_pointer method) const
91 {
92  if (calling_self_b_)
93     Performer_group_performer::each (method);
94 }
95
96 /*
97   don't let the commands trickle up.
98  */
99 bool
100 Grace_performer_group::do_try_music (Music *m)
101 {
102   bool hebbes_b =false;
103
104   Link_array<Translator> nongroups (nongroup_l_arr ());
105   
106   for (int i =0; !hebbes_b && i < nongroups.size() ; i++)
107     hebbes_b =nongroups[i]->try_music (m);
108
109   return hebbes_b;
110 }