From: fred Date: Thu, 7 Nov 1996 20:19:31 +0000 (+0000) Subject: lilypond-0.0.9 X-Git-Tag: release/1.5.59~6876 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=df4ea844cfcf5287ff18a685d9df1d0c4effc728;p=lilypond.git lilypond-0.0.9 --- diff --git a/src/voice.cc b/src/voice.cc new file mode 100644 index 0000000000..14883e1499 --- /dev/null +++ b/src/voice.cc @@ -0,0 +1,78 @@ +#include "debug.hh" +#include "voice.hh" + +Voice::Voice(Voice const&src) +{ + PL_copy(elts, src.elts); + start = src.start; +} + +Voice::Voice() +{ + start = 0.0; +} + +void +Voice::add(Voice_element*v) +{ + elts.bottom().add(v); +} + +void +Voice::print() const +{ + #ifndef NPRINT + + mtor << "start: "<< start< vec(elts); vec.ok(); vec++) + vec->print(); +#endif +} + +Real +Voice::last() const +{ + Real l =start; + for (PCursor vec(elts); vec.ok(); vec++) + l += vec->duration; + return l; +} +/****************************************************************/ +void +Voice_element::print() const +{ +#ifndef NPRINT + mtor << "voice_element { dur :"<< duration <<"\n"; + for (PCursor rc(reqs); rc.ok(); rc++) { + rc->print(); + } + mtor << "}\n"; +#endif +} +void +Voice_element::add(Request*r) +{ + if (r->rhythmic()) { + assert (!duration); + duration = r->duration(); + } + r->elt = this; + reqs.bottom().add(r); +} + + +Voice_element::Voice_element() +{ + voice = 0; + group = 0; + duration = 0.0; +} + +Voice_element::Voice_element(Voice_element const&src) +{ + duration=src.duration; + voice=src.voice; + PointerList__copy(Request*, reqs, src.reqs, clone()); + group=src.group; + assert(!granted_items.size() && !granted_spanners.size()); +}