]> git.donarmstrong.com Git - lilypond.git/blobdiff - voice.cc
release: 0.0.7
[lilypond.git] / voice.cc
index ae9342b487e1bbe48b5db86345dc19b536ea9a51..379cbae23a073fd23fb22e2cea4caaa0cdc2f1a5 100644 (file)
--- a/voice.cc
+++ b/voice.cc
@@ -1,14 +1,10 @@
 #include "debug.hh"
 #include "voice.hh"
 
-void
-Voice_element::add(Request*r)
+Voice::Voice(Voice const&src)
 {
-    if (r->rhythmic()) {
-       assert (!duration);         
-       duration = r->duration();
-    }
-    reqs.bottom().add(r);
+    PL_copy(elts, src.elts);
+    start = src.start;
 }
 
 Voice::Voice()
@@ -22,13 +18,6 @@ Voice::add(Voice_element*v)
     elts.bottom().add(v);
 }
 
-Voice_element::Voice_element()
-{
-    voice = 0;
-    group = 0;
-    duration = 0.0;
-}
-
 void
 Voice::print() const
 {
@@ -39,6 +28,16 @@ Voice::print() const
        vec->print();
 #endif
 }
+
+Real
+Voice::last() const
+{
+    Real l =start;
+    for (PCursor<Voice_element*> vec(elts); vec.ok(); vec++)
+       l  += vec->duration;
+    return l;
+}
+/****************************************************************/
 void
 Voice_element::print() const
 {
@@ -50,12 +49,29 @@ Voice_element::print() const
     mtor << "}\n";
 #endif
 }
+void
+Voice_element::add(Request*r)
+{
+    if (r->rhythmic()) {
+       assert (!duration);         
+       duration = r->duration();
+    }
+    reqs.bottom().add(r);
+}
 
-Real
-Voice::last() const
+
+Voice_element::Voice_element()
 {
-    Real l =start;
-    for (PCursor<Voice_element*> vec(elts); vec.ok(); vec++)
-       l  += vec->duration;
-    return l;
+    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());
 }