]> git.donarmstrong.com Git - lilypond.git/blob - voice.cc
release: 0.0.3
[lilypond.git] / voice.cc
1 #include "debug.hh"
2 #include "voice.hh"
3
4 void
5 Voice_element::add(Request*r)
6 {
7     if (r->tag == Request::NOTE ||r->tag == Request::REST) {
8         assert (!duration);         
9         duration = r->duration();
10     }
11     reqs.bottom().add(r);
12 }
13
14 Voice::Voice()
15 {
16     start = 0.0;
17 }
18
19 void
20 Voice::add(Voice_element*v)
21 {
22     elts.bottom().add(v);
23 }
24
25 Voice_element::Voice_element()
26 {
27     voice = 0;
28     group = 0;
29     duration = 0.0;
30 }
31
32 void
33 Voice::print() const
34 {
35     mtor << "start: "<< start<<eol;
36     for (PCursor<Voice_element*> vec(elts); vec.ok(); vec++)
37         vec->print();
38 }
39 void
40 Voice_element::print() const
41 {
42     mtor << "voice_element { dur :"<< duration <<"\n";
43     for (PCursor<Request*> rc(reqs); rc.ok(); rc++) {
44         mtor << "reqtag: " << rc->tag<<eol;
45     }
46     mtor << "}\n";
47 }
48
49 Mtime
50 Voice::last() const
51 {
52     Mtime l =start;
53     for (PCursor<Voice_element*> vec(elts); vec.ok(); vec++)
54         l  += vec->duration;
55     return l;
56 }