2 #include "input-music.hh"
4 #include "musicalrequest.hh"
5 #include "voice-element.hh"
8 Input_music::check_plet(Voice_element
* velt_l
)
10 for (iter_top(velt_l
->reqs
,i
); i
.ok(); i
++)
12 Moment start_moment
= 0;
13 if ( !find_plet_start_bo( i
->plet()->type_c_
, start_moment
) ) {
14 error( "begin of plet not found", i
->defined_ch_c_l_
);
18 set_plet_backwards( moment
, start_moment
, i
->plet()->dur_i_
, i
->plet()->type_i_
);
25 Simple_music::add(Voice_element
*v
)
31 Simple_music::length()const
36 Simple_music::translate_time(Moment t
)
42 Simple_music::convert()const
45 l
.bottom().add(new Voice(voice_
));
51 Simple_music::print() const
53 mtor
<< "Simple_music {";
58 Simple_music::find_plet_start_bo(char c
, Moment
& moment_r
)
60 return voice_
.find_plet_start_bo(c
, moment_r
);
63 Simple_music::set_plet_backwards(Moment
& now_moment_r
, Moment until_moment
, int num_i
, int den_i
)
65 voice_
.set_plet_backwards(now_moment_r
, until_moment
, num_i
, den_i
);
71 Complex_music::add(Input_music
*v
)
77 Complex_music::print() const
79 for (iter_top(elts
,i
); i
.ok(); i
++)
84 Complex_music::concatenate(Complex_music
*h
)
86 for (iter_top(h
->elts
,i
); i
.ok(); i
++)
90 Complex_music::Complex_music()
94 Complex_music::Complex_music(Complex_music
const&s
)
96 for (iter_top(s
.elts
,i
); i
.ok(); i
++)
100 Complex_music::set_default_group(String g
)
102 for (iter_top(elts
,i
); i
.ok(); i
++)
103 i
->set_default_group(g
);
106 Complex_music::find_plet_start_bo(char c
, Moment
& moment_r
)
108 for (iter_bot(elts
,i
); i
.ok(); i
--) {
109 if ( i
->find_plet_start_bo(c
, moment_r
) )
115 Complex_music::set_plet_backwards(Moment
& now_moment_r
, Moment until_moment
, int num_i
, int den_i
)
117 for (iter_bot(elts
,i
); i
.ok(); i
--) {
118 i
->set_plet_backwards(now_moment_r
, until_moment
, num_i
, den_i
);
121 /* *************************************************************** */
124 Music_voice::print() const
126 mtor
<< "Music_voice {";
127 Complex_music::print();
132 Music_voice::add_elt(Voice_element
*v
)
134 PCursor
<Input_music
*> c(elts
.bottom());
135 if (!c
.ok() || !c
->simple()) {
136 Simple_music
*vs
= new Simple_music
;
142 Simple_music
*s
= c
->simple();
149 Music_voice::length()const
153 for (iter_top(elts
,i
); i
.ok(); i
++)
160 Music_voice::convert()const
165 for (iter_top(elts
,i
); i
.ok(); i
++) {
166 Moment len
= i
->length();
167 Voice_list
k(i
->convert());
168 k
.translate_time(here
);
176 Music_voice::translate_time(Moment t
)
178 elts
.bottom()->translate_time(t
);
183 /* *************** */
186 Music_general_chord::add_elt(Voice_element
*v
)
188 Simple_music
*vs
= new Simple_music
;
190 elts
.bottom().add(vs
);
196 Music_general_chord::print() const
198 mtor
<< "Music_general_chord {";
199 Complex_music::print();
204 Music_general_chord::translate_time(Moment t
)
206 for (iter_top(elts
,i
); i
.ok(); i
++)
207 i
->translate_time(t
);
211 Music_general_chord::length()const
215 for (iter_top(elts
,i
); i
.ok(); i
++)
216 l
= l
>? i
->length();
221 Music_general_chord::convert()const
224 for (iter_top(elts
,i
); i
.ok(); i
++) {
225 Voice_list
k(i
->convert());
231 /* *************** */
234 Multi_voice_chord::set_default_group(String g
)
237 for (iter_top(elts
, i
); i
.ok(); i
++) {
238 i
->set_default_group(g
+ String(j
));
244 /* *************** */
247 Voice_list::translate_time(Moment x
)
249 for (iter_top(*this,i
); i
.ok(); i
++)