2 voice-elt.cc -- implement Voice_element
4 source file of the LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
13 #include "voice-element.hh"
14 #include "musical-request.hh"
15 #include "command-request.hh"
19 Voice_element::transpose(Melodic_req
const&d
)const
21 for (iter_top(req_p_list_
,i
); i
.ok(); i
++) {
27 Voice_element::print() const
30 mtor
<< "voice_element { dur :"<< duration_
<<"\n";
31 mtor
<< "principal: " << principal_req_l_
->name() << "\n";
32 for (iter_top(req_p_list_
,rc
); rc
.ok(); rc
++) {
41 Voice_element::add(Request
*r
)
43 if (! principal_req_l_
)
47 assert (!duration_
|| duration_
== r
->duration());
48 duration_
= r
->duration();
52 req_p_list_
.bottom().add(r
);
56 Voice_element::Voice_element()
63 Voice_element::Voice_element(Voice_element
const&src
)
68 for (iter_top(src
.req_p_list_
, i
); i
.ok(); i
++)
73 Voice_element::find_plet_start_b(char c
, Moment
& moment_r
)// b unused?
76 moment_r
+= duration_
;
77 for ( PCursor
<Request
*> i( req_p_list_
.top() ); i
.ok(); i
++ ) {
78 if (i
->beam() && i
->beam()->spantype
== Span_req::START
)
85 Voice_element::set_default_group(String s
)
87 for (iter_top(req_p_list_
, i
); i
.ok(); i
++)
88 if (i
->command() &&i
->command()->groupchange())
90 Group_change_req
*greq
= new Group_change_req
;
91 greq
->newgroup_str_
= s
;
96 Voice_element::set_plet_backwards(Moment
& now_moment_r
,
97 Moment until_moment
, int num_i
, int den_i
)
99 now_moment_r
+= duration_
;
100 if ( now_moment_r
> until_moment
)
102 for ( PCursor
<Request
*> i( req_p_list_
.top() ); i
.ok(); i
++ ) {
103 if (i
->beam() && i
->beam()->spantype
== Span_req::START
)
104 i
->beam()->nplet
= den_i
;
106 i
->rhythmic()->duration_
.plet_
.type_i_
= den_i
;
107 i
->rhythmic()->duration_
.plet_
.iso_i_
= num_i
;