lilypond-0.0.5
[lilypond.git] / voice.cc
blobae9342b487e1bbe48b5db86345dc19b536ea9a51
1 #include "debug.hh"
2 #include "voice.hh"
4 void
5 Voice_element::add(Request*r)
7 if (r->rhythmic()) {
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 #ifndef NPRINT
37 mtor << "start: "<< start<<eol;
38 for (PCursor<Voice_element*> vec(elts); vec.ok(); vec++)
39 vec->print();
40 #endif
42 void
43 Voice_element::print() const
45 #ifndef NPRINT
46 mtor << "voice_element { dur :"<< duration <<"\n";
47 for (PCursor<Request*> rc(reqs); rc.ok(); rc++) {
48 rc->print();
50 mtor << "}\n";
51 #endif
54 Real
55 Voice::last() const
57 Real l =start;
58 for (PCursor<Voice_element*> vec(elts); vec.ok(); vec++)
59 l += vec->duration;
60 return l;