lilypond-0.0.32
[lilypond.git] / src / voice.cc
blob3dd4becf218270afe77904ce964fc22499ee4cb6
1 /*
2 voice.cc -- implement Voice
4 source file of the LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
9 #include "debug.hh"
10 #include "voice.hh"
11 #include "musicalrequest.hh"
12 #include "commandrequest.hh"
14 void
15 Voice::set_default_group(String s)
17 elts.top()->set_default_group(s);
20 Voice::Voice(Voice const&src)
22 for (iter_top(src.elts, i); i.ok(); i++)
23 add(new Voice_element(**i));
25 start = src.start;
28 Voice::Voice()
30 start = 0.0;
33 void
34 Voice::add(Voice_element*v)
36 v->voice_l_ = this;
37 elts.bottom().add(v);
40 void
41 Voice::print() const
43 #ifndef NPRINT
44 mtor << "start: "<< start<<eol;
45 for (iter_top(elts,i); i.ok(); i++)
46 i->print();
47 #endif
50 Moment
51 Voice::last() const
53 Moment l =0;
54 if (elts.size())
55 l = start;
57 for (iter_top(elts,i); i.ok(); i++)
58 l += i->duration;
59 return l;