2 #include "input-music.hh"
4 #include "musical-request.hh"
5 #include "command-request.hh"
6 #include "voice-element.hh"
9 Simple_music::transpose(Melodic_req
const &d
)const
15 Simple_music::add(Voice_element
*v
)
21 Simple_music::length()const
26 Simple_music::translate_time(Moment t
)
32 Simple_music::convert()const
35 Voice
* v_p
= new Voice(voice_
);
36 PCursor
<Voice_element
*> i
= v_p
->elts_
.bottom();
38 if (!i
.ok() || i
->duration_
) {
39 v_p
->add ( new Voice_element
);
40 i
=v_p
->elts_
.bottom();
43 // need-to-have, otherwise memory will be filled up with regs.
44 i
->add(new Terminate_voice_req
);
51 Simple_music::print() const
54 mtor
<< "Simple_music {";
63 Complex_music::transpose(Melodic_req
const& d
) const
65 for (iter_top(elts
,i
); i
.ok(); i
++)
69 Complex_music::add(Input_music
*v
)
75 Complex_music::print() const
77 for (iter_top(elts
,i
); i
.ok(); i
++)
82 Complex_music::concatenate(Complex_music
*h
)
84 for (iter_top(h
->elts
,i
); i
.ok(); i
++)
88 Complex_music::Complex_music()
92 Complex_music::Complex_music(Complex_music
const&s
)
94 for (iter_top(s
.elts
,i
); i
.ok(); i
++)
98 Complex_music::set_default_group(String g
)
100 for (iter_top(elts
,i
); i
.ok(); i
++)
101 i
->set_default_group(g
);
103 /* *************************************************************** */
106 Music_voice::print() const
108 mtor
<< "Music_voice {";
109 Complex_music::print();
114 Music_voice::add_elt(Voice_element
*v
)
116 PCursor
<Input_music
*> c(elts
.bottom());
117 if (!c
.ok() || !c
->simple()) {
118 Simple_music
*vs
= new Simple_music
;
124 Simple_music
*s
= c
->simple();
129 Music_voice::length()const
133 for (iter_top(elts
,i
); i
.ok(); i
++)
140 Music_voice::convert()const
145 for (iter_top(elts
,i
); i
.ok(); i
++) {
146 Moment len
= i
->length();
147 Voice_list
k(i
->convert());
148 k
.translate_time(here
);
156 Music_voice::translate_time(Moment t
)
158 elts
.bottom()->translate_time(t
);
163 /* *************** */
166 Music_general_chord::add_elt(Voice_element
*v
)
168 Simple_music
*vs
= new Simple_music
;
170 elts
.bottom().add(vs
);
174 Music_general_chord::print() const
176 mtor
<< "Music_general_chord {";
177 Complex_music::print();
182 Music_general_chord::translate_time(Moment t
)
184 for (iter_top(elts
,i
); i
.ok(); i
++)
185 i
->translate_time(t
);
189 Music_general_chord::length()const
193 for (iter_top(elts
,i
); i
.ok(); i
++)
194 l
= l
>? i
->length();
199 Music_general_chord::convert()const
202 for (iter_top(elts
,i
); i
.ok(); i
++) {
203 Voice_list
k(i
->convert());
209 /* *************** */
212 Multi_voice_chord::set_default_group(String g
)
215 for (iter_top(elts
, i
); i
.ok(); i
++) {
216 i
->set_default_group(g
+ String(j
));
222 /* *************** */
225 Voice_list::translate_time(Moment x
)
227 for (iter_top(*this,i
); i
.ok(); i
++)