2 #include "inputmusic.hh"
4 #include "musicalrequest.hh"
7 Input_music::check_plet(Voice_element
* velt_l
)
9 for (iter_top(velt_l
->reqs
,i
); i
.ok(); i
++)
11 Moment start_moment
= 0;
12 if ( !find_plet_start_bo( i
->plet()->type_c_
, start_moment
) ) {
13 error( "begin of plet not found", i
->defined_ch_c_l_
);
17 set_plet_backwards( moment
, start_moment
, i
->plet()->dur_i_
, i
->plet()->type_i_
);
24 Simple_music::add(Voice_element
*v
)
30 Simple_music::length()const
35 Simple_music::translate_time(Moment t
)
41 Simple_music::convert()const
44 l
.bottom().add(new Voice(voice_
));
50 Simple_music::print() const
52 mtor
<< "Simple_music {";
57 Simple_music::find_plet_start_bo(char c
, Moment
& moment_r
)
59 return voice_
.find_plet_start_bo(c
, moment_r
);
62 Simple_music::set_plet_backwards(Moment
& now_moment_r
, Moment until_moment
, int num_i
, int den_i
)
64 voice_
.set_plet_backwards(now_moment_r
, until_moment
, num_i
, den_i
);
70 Complex_music::add(Input_music
*v
)
76 Complex_music::print() const
78 for (iter_top(elts
,i
); i
.ok(); i
++)
83 Complex_music::concatenate(Complex_music
*h
)
85 for (iter_top(h
->elts
,i
); i
.ok(); i
++)
89 Complex_music::Complex_music()
93 Complex_music::Complex_music(Complex_music
const&s
)
95 for (iter_top(s
.elts
,i
); i
.ok(); i
++)
99 Complex_music::set_default_group(String g
)
101 for (iter_top(elts
,i
); i
.ok(); i
++)
102 i
->set_default_group(g
);
105 Complex_music::find_plet_start_bo(char c
, Moment
& moment_r
)
107 for (iter_bot(elts
,i
); i
.ok(); i
--) {
108 if ( i
->find_plet_start_bo(c
, moment_r
) )
114 Complex_music::set_plet_backwards(Moment
& now_moment_r
, Moment until_moment
, int num_i
, int den_i
)
116 for (iter_bot(elts
,i
); i
.ok(); i
--) {
117 i
->set_plet_backwards(now_moment_r
, until_moment
, num_i
, den_i
);
120 /* *************************************************************** */
123 Music_voice::print() const
125 mtor
<< "Music_voice {";
126 Complex_music::print();
131 Music_voice::add_elt(Voice_element
*v
)
133 PCursor
<Input_music
*> c(elts
.bottom());
134 if (!c
.ok() || !c
->simple()) {
135 Simple_music
*vs
= new Simple_music
;
141 Simple_music
*s
= c
->simple();
148 Music_voice::length()const
152 for (iter_top(elts
,i
); i
.ok(); i
++)
159 Music_voice::convert()const
164 for (iter_top(elts
,i
); i
.ok(); i
++) {
165 Moment len
= i
->length();
166 Voice_list
k(i
->convert());
167 k
.translate_time(here
);
175 Music_voice::translate_time(Moment t
)
177 elts
.bottom()->translate_time(t
);
182 /* *************** */
185 Music_general_chord::add_elt(Voice_element
*v
)
187 Simple_music
*vs
= new Simple_music
;
189 elts
.bottom().add(vs
);
195 Music_general_chord::print() const
197 mtor
<< "Music_general_chord {";
198 Complex_music::print();
203 Music_general_chord::translate_time(Moment t
)
205 for (iter_top(elts
,i
); i
.ok(); i
++)
206 i
->translate_time(t
);
210 Music_general_chord::length()const
214 for (iter_top(elts
,i
); i
.ok(); i
++)
215 l
= l
>? i
->length();
220 Music_general_chord::convert()const
223 for (iter_top(elts
,i
); i
.ok(); i
++) {
224 Voice_list
k(i
->convert());
230 /* *************** */
233 Multi_voice_chord::set_default_group(String g
)
236 for (iter_top(elts
, i
); i
.ok(); i
++) {
237 i
->set_default_group(g
+ String(j
));
243 /* *************** */
246 Voice_list::translate_time(Moment x
)
248 for (iter_top(*this,i
); i
.ok(); i
++)