lilypond-0.0.4
[lilypond.git] / voice.cc
blobac6d33166d6058b2638a5a94b99d6c1a5237ed50
1 #include "debug.hh"
2 #include "voice.hh"
4 void
5 Voice_element::add(Request*r)
7 if (r->tag == Request::NOTE ||r->tag == Request::REST) {
8 assert (!duration);
9 duration = r->duration();
11 reqs.bottom().add(r);
14 Voice::Voice()
16 start = 0.0;
19 void
20 Voice::add(Voice_element*v)
22 elts.bottom().add(v);
25 Voice_element::Voice_element()
27 voice = 0;
28 group = 0;
29 duration = 0.0;
32 void
33 Voice::print() const
35 mtor << "start: "<< start<<eol;
36 for (PCursor<Voice_element*> vec(elts); vec.ok(); vec++)
37 vec->print();
39 void
40 Voice_element::print() const
42 mtor << "voice_element { dur :"<< duration <<"\n";
43 for (PCursor<Request*> rc(reqs); rc.ok(); rc++) {
44 mtor << "reqtag: " << rc->tag<<eol;
46 mtor << "}\n";
49 Mtime
50 Voice::last() const
52 Mtime l =start;
53 for (PCursor<Voice_element*> vec(elts); vec.ok(); vec++)
54 l += vec->duration;
55 return l;