2 #include "input-music.hh"
4 #include "musical-request.hh"
5 #include "command-request.hh"
6 #include "voice-element.hh"
9 Input_music::check_plet(Voice_element* velt_l)
11 for (iter_top(velt_l->reqs,i); i.ok(); i++)
13 Moment start_moment = 0;
14 if ( !find_plet_start_b( i->plet()->type_c_, start_moment ) ) {
15 error( "begin of plet not found", i->defined_ch_C_ );
19 set_plet_backwards( moment, start_moment, i->plet()->dur_i_, i->plet()->type_i_ );
26 Simple_music::transpose(Melodic_req const &d)const
32 Simple_music::add(Voice_element*v)
38 Simple_music::length()const
43 Simple_music::translate_time(Moment t)
49 Simple_music::convert()const
52 Voice * v_p = new Voice(voice_);
53 PCursor<Voice_element*> i= v_p->elts.bottom();
54 // need-to-have, otherwise memory will be filled up with regs.
55 if (!i.ok() || i->duration_) {
56 v_p->add ( new Voice_element);
59 i->add(new Terminate_voice_req);
66 Simple_music::print() const
69 mtor << "Simple_music {";
75 Simple_music::find_plet_start_b(char c, Moment& moment_r)
77 return voice_.find_plet_start_b(c, moment_r);
80 Simple_music::set_plet_backwards(Moment& now_moment_r, Moment until_moment,
83 voice_.set_plet_backwards(now_moment_r, until_moment, num_i, den_i);
89 Complex_music::transpose(Melodic_req const& d) const
91 for (iter_top(elts,i); i.ok(); i++)
95 Complex_music::add(Input_music*v)
101 Complex_music::print() const
103 for (iter_top(elts,i); i.ok(); i++)
108 Complex_music::concatenate(Complex_music*h)
110 for (iter_top(h->elts,i); i.ok(); i++)
114 Complex_music::Complex_music()
118 Complex_music::Complex_music(Complex_music const&s)
120 for (iter_top(s.elts,i); i.ok(); i++)
124 Complex_music::set_default_group(String g)
126 for (iter_top(elts,i); i.ok(); i++)
127 i->set_default_group(g);
130 Complex_music::find_plet_start_b(char c, Moment& moment_r)
132 for (iter_bot(elts,i); i.ok(); i--) {
133 if ( i->find_plet_start_b(c, moment_r) )
139 Complex_music::set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i)
141 for (iter_bot(elts,i); i.ok(); i--) {
142 i->set_plet_backwards(now_moment_r, until_moment, num_i, den_i);
145 /* *************************************************************** */
148 Music_voice::print() const
150 mtor << "Music_voice {";
151 Complex_music::print();
156 Music_voice::add_elt(Voice_element*v)
158 PCursor<Input_music*> c(elts.bottom());
159 if (!c.ok() || !c->simple()) {
160 Simple_music*vs = new Simple_music;
166 Simple_music *s = c->simple();
173 Music_voice::length()const
177 for (iter_top(elts,i); i.ok(); i++)
184 Music_voice::convert()const
189 for (iter_top(elts,i); i.ok(); i++) {
190 Moment len = i->length();
191 Voice_list k(i->convert());
192 k.translate_time(here);
200 Music_voice::translate_time(Moment t)
202 elts.bottom()->translate_time(t);
207 /* *************** */
210 Music_general_chord::add_elt(Voice_element*v)
212 Simple_music*vs = new Simple_music;
214 elts.bottom().add(vs);
220 Music_general_chord::print() const
222 mtor << "Music_general_chord {";
223 Complex_music::print();
228 Music_general_chord::translate_time(Moment t)
230 for (iter_top(elts,i); i.ok(); i++)
231 i->translate_time(t);
235 Music_general_chord::length()const
239 for (iter_top(elts,i); i.ok(); i++)
240 l = l >? i->length();
245 Music_general_chord::convert()const
248 for (iter_top(elts,i); i.ok(); i++) {
249 Voice_list k(i->convert());
255 /* *************** */
258 Multi_voice_chord::set_default_group(String g)
261 for (iter_top(elts, i); i.ok(); i++) {
262 i->set_default_group(g + String(j));
268 /* *************** */
271 Voice_list::translate_time(Moment x)
273 for (iter_top(*this,i); i.ok(); i++)