]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.23
authorfred <fred>
Sat, 18 Jan 1997 13:17:27 +0000 (13:17 +0000)
committerfred <fred>
Sat, 18 Jan 1997 13:17:27 +0000 (13:17 +0000)
hdr/parseconstruct.hh
src/note.cc
src/timedescription.cc

index 8afb32d94bf1ae6854dea50f1ed7e1ac9c644a4e..6a22127a384035641ceea8ae14e0e7e39372208d 100644 (file)
@@ -1,13 +1,15 @@
 /*
   parseconstruct.hh -- part of LilyPond
 
-  (c) 1996 Han-Wen Nienhuys
+  (c) 1996,97 Han-Wen Nienhuys
 */
 
 #ifndef PARSECONSTRUCT_HH
 #define PARSECONSTRUCT_HH
 
 #include "proto.hh"
+
+Voice_element*get_mark_element(String);
 void set_default_duration(int *);
 void get_default_duration(int *);
 void set_default_octave(String);
index 4454e67727b7c054754d27dcb2cec9a91471b7ed..5c132038bcd529799aa437d7ab3932a7b3abbbc3 100644 (file)
@@ -236,3 +236,11 @@ get_text_req(int d , Text_def*def)
     return new Text_req(d, def);
 }
 
+Voice_element*
+get_mark_element(String s)
+{
+    Voice_element*v_p = new Voice_element;
+    v_p->add( new Mark_req(s));
+    
+    return v_p;
+}
index ce9b667aafdba0994d0de51bd16ec56dba970cd5..9ffb981c852e4970812c5294771a63bf174eb7ca 100644 (file)
@@ -3,7 +3,8 @@
 String
 Time_description::str()const
 {
-    String s( "Time_description { at ");
+    String s( "Time_description { ");
+    s+=String( " cadenza: ") + cadenza_b_ + " at ";
     s+=when;
     s+="\nmeter " + String(whole_per_measure/one_beat) +":" +(1/one_beat);
     s+= "\nposition "+String( bars) + ":"+ whole_in_measure +"\n}\n";
@@ -19,19 +20,34 @@ void
 Time_description::OK() const
 {
 #ifdef NDEBUG
-    assert(whole_in_measure < whole_per_measure && 0 <= whole_in_measure);
+    if (!cadenza_b_)
+       assert(whole_in_measure < whole_per_measure);
+    assert(0 <= whole_in_measure);
     assert(one_beat);
 #endif
 }
 
+void
+Time_description::set_cadenza(bool b)
+{
+    if (cadenza_b_ && !b) {
+       if (whole_in_measure) {
+           bars ++;
+           whole_in_measure = 0;
+       }
+    }
+    cadenza_b_ = b ;
+}
+
 Time_description::Time_description(Moment dt, Time_description const *prev)
 {
     if (prev) {
        assert(dt >= 0);
        *this = *prev;
-       when += + dt;
+       when +=  dt;
        whole_in_measure += dt;
-       while ( whole_in_measure >= whole_per_measure ) {
+       
+       while ( !cadenza_b_ && whole_in_measure >= whole_per_measure ) {
            whole_in_measure -= whole_per_measure;
            bars ++;
        }
@@ -41,7 +57,8 @@ Time_description::Time_description(Moment dt, Time_description const *prev)
        one_beat = 0.25;
        when = 0.0;
        bars = 0;
-    }  
+       cadenza_b_ = false;
+    }
 }
 
 void
@@ -50,21 +67,24 @@ Time_description::set_meter(int l, int o)
     assert(o);
     one_beat = 1/Moment(o);
     whole_per_measure = Moment(l) * one_beat;
+    if(whole_in_measure)
+       error_t("Meterchange should be at start of measure", when);
 }
 
 void
 Time_description::setpartial(Moment p)
 {
     if (when)
-       error_t ("Partial measure only allowed at beginning.", when);
+       error_t ("Partial measure only allowed at beginning.", *this);
     if (p<0||p > whole_per_measure)
-       error_t ("Partial measure has incorrect size", when);
+       error_t ("Partial measure has incorrect size", *this);
     whole_in_measure = whole_per_measure - p;
 }
 
 Moment
 Time_description::barleft()
 {
+    assert(!cadenza_b_);
     return whole_per_measure-whole_in_measure;
 }