2 voiceelt.cc -- implement Voice_element
4 source file of the LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
11 #include "voice-element.hh"
12 #include "musicalrequest.hh"
13 #include "commandrequest.hh"
17 Voice_element::print() const
20 mtor
<< "voice_element { dur :"<< duration
<<"\n";
21 for (iter_top(reqs
,rc
); rc
.ok(); rc
++) {
29 Voice_element::add(Request
*r
)
32 assert (!duration
|| duration
== r
->duration());
33 duration
= r
->duration();
41 Voice_element::Voice_element()
48 Voice_element::Voice_element(Voice_element
const&src
)
50 defined_ch_c_l_
= src
.defined_ch_c_l_
;
53 for (iter_top(src
.reqs
, i
); i
.ok(); i
++)
58 Voice_element::find_plet_start_bo(char c
, Moment
& moment_r
)
62 for ( PCursor
<Request
*> req_l_pcur( reqs
.top() ); req_l_pcur
.ok(); req_l_pcur
++ ) {
63 if (req_l_pcur
->beam() && req_l_pcur
->beam()->spantype
== Span_req::START
)
70 Voice_element::set_default_group(String s
)
72 for (iter_top(reqs
, i
); i
.ok(); i
++)
75 Group_change_req
*greq
= new Group_change_req
;
76 greq
->newgroup_str_
= s
;
81 Voice_element::set_plet_backwards(Moment
& now_moment_r
,
82 Moment until_moment
, int num_i
, int den_i
)
84 now_moment_r
+= duration
;
85 if ( now_moment_r
> until_moment
)
87 for ( PCursor
<Request
*> req_l_pcur( reqs
.top() ); req_l_pcur
.ok(); req_l_pcur
++ ) {
88 if (req_l_pcur
->beam() && req_l_pcur
->beam()->spantype
== Span_req::START
)
89 req_l_pcur
->beam()->nplet
= den_i
;
90 if (req_l_pcur
->rhythmic())
91 req_l_pcur
->rhythmic()->plet_factor
= Moment(num_i
, den_i
);
92 if (req_l_pcur
->stem())
93 req_l_pcur
->stem()->plet_factor
= Moment(num_i
, den_i
);