]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.23
authorfred <fred>
Sun, 24 Mar 2002 19:28:19 +0000 (19:28 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:28:19 +0000 (19:28 +0000)
input/maartje.ly [new file with mode: 0644]
src/inputscore.cc
src/staff.cc

diff --git a/input/maartje.ly b/input/maartje.ly
new file mode 100644 (file)
index 0000000..8941182
--- /dev/null
@@ -0,0 +1,74 @@
+ritme = staff {rhythmic
+       music {$
+       c8
+       |[a8() a8. a8 a16 a16 a16] c4.
+               
+       %[c8( )'a8() c8 c8]% BUG!
+       |c2 c2
+       
+       |[fis16 'dis16( fis16 'dis16 ][fis16) 'dis16 fis16 'dis16]
+       | r32 r32 r16 r8 r4 r2
+       |[c8. c16] [c16 c8.] [c16 c16 c8] [c16 c8 c16]
+
+        c2 c2 c2 c2 c2 c2 c2 c2 c2 c2
+
+       $}
+}
+
+melody=
+staff { melodic
+       music{$
+       c8
+       |r4 r4 r4 r4
+       |'cis2..        r8
+       | r4 r8 r16 r32 r32 
+
+       \duration {4}
+       {
+               \music { c () `bes [c8 c8] }
+               \music { 'fis ()'gisis fis8 fis8 }
+               \music { d () d dis8 dis8 }
+               \music {  a  () bes eis8 eis8 }
+               \music { fis () g gis8 gis8 }
+       }
+       { c4 'c4 }
+
+       [d8 e8 'f8 g8]  d8 e8 f8 g8
+       |''fis2
+       | a8 b8 'c8 'd8 |''c8 ```c8 c4 |c4  c4 |c4
+       \duration{ 16 } `b `a `g `f \duration{ 4}
+       
+
+       |c `b `a `g `f `e `d `c ``b ``a ``g ``f ``e ``d ``c
+       $}
+
+       commands {
+               skip 3:0
+               key $ fis cis gis $
+               skip 2:0
+               key 
+               skip 5:0
+               clef bass
+       }
+}
+
+score {
+       paper {
+               geometric 1.4
+               unitspace 3.0 cm
+       }
+       staff { ritme }
+       staff { melody }
+       commands {
+               meter 4* 4
+               partial 8
+               skip 1:2
+               bar ":|:"
+               skip 2:0
+               meter 2* 4
+               skip 19:0
+       }
+}
+
+
+
index cdc348c725fd3f5f9d78a5509293f06285290bd6..28e1f71599ad8d8be71f50640ca1566e3c6cd517 100644 (file)
@@ -4,6 +4,7 @@
 #include "inputstaff.hh"
 #include "score.hh"
 #include "paper.hh"
+#include "staff.hh"
 
 void
 Input_score::add(Array<Input_command*> &s)
@@ -25,17 +26,27 @@ Input_score::set(Paperdef*p)
     delete paper_;
     paper_ = p;
 }
+Input_score::Input_score(Input_score const&)
+{
+    assert(false);
+}
 
 Score*
 Input_score::parse()
 {
     Paperdef* paper_p=new Paperdef(*paper_);
     Score *s_p = new Score(paper_p);
-    
+    s_p->define_spot_str_ = define_spot_str_;
+    Array<Staff*> parsed_staffs;
     for (iter_top(staffs_,i); i.ok(); i++) {
-       Staff* staf_p=i->parse(commands_, s_p);
+       Staff* staf_p=i->parse(s_p);
+       parsed_staffs.add(staf_p);
        s_p->add(staf_p);
     }
+    int j = 0;
+    for (iter_top(staffs_,i); i.ok(); i++,j++) {
+       parsed_staffs[j]->do_commands(commands_, i->commands_);
+    }
     return s_p;
 }
 
@@ -54,9 +65,11 @@ Input_score::Input_score()
 void
 Input_score::print()const
 {
+    #ifndef NPRINT
     mtor << "Input_score {\n";
     for (iter_top(staffs_,i); i.ok(); i++) {
        i->print();
     }
     mtor << "}\n";
+#endif
 }
index ef54dbe466b9ac4c7b1f83113672be9770f3cba6..c6a65e016e3ea33523b530579685139102a84aae 100644 (file)
@@ -6,6 +6,22 @@
 #include "sccol.hh"
 #include "staffcommands.hh"
 #include "debug.hh"
+#include "inputcommands.hh"
+#include "inputcommand.hh"
+#include "request.hh"
+
+void
+Staff::do_commands(PointerList<Input_command*> score_wide,
+                  PointerList<Input_command*> staff_wide)
+{
+    Input_commands commands;
+    for (iter_top(score_wide,i); i.ok(); i++) 
+       commands.add(**i, score_l_->markers_assoc_);
+    for (iter_top(staff_wide,i); i.ok(); i++) 
+       commands.add(**i,score_l_->markers_assoc_);
+
+    commands.parse(this);
+}
 
 void
 Staff::add(PointerList<Voice*> &l)
@@ -19,7 +35,9 @@ Staff::truncate_cols(Moment l)
 {
     iter_bot(cols, i);
     for (; i->when() > l; i=cols.bottom()) {
-       i.del();
+       Staff_column * col_p = i.get();
+       assert(col_p->when() > l);
+       delete col_p;
     }
 }
 
@@ -35,7 +53,7 @@ Staff::clean_cols()
     iter_top(cols,i);
     for(; i.ok(); ){
        if (!i->score_column_l_->used())
-           i.del();
+           delete i.get();
        else
            i++;
     }
@@ -80,8 +98,22 @@ Staff::get_col(Moment w, bool mus)
     return newst;
 }
 
-
-
+void
+Staff::get_marks(Array<String>&s_arr, Array<Moment>&m_arr)
+{
+     for (iter_top(voices,i); i.ok(); i++) {
+       Moment now = i->start;
+       for (iter_top(i->elts,j); j.ok(); j++) {
+           for (iter_top(j->reqs, k); k.ok(); k++) {
+               if (k->mark()) { // ugh. 4 levels
+                   s_arr.add(k->mark()->mark_str_);
+                   m_arr.add(now);
+               }
+           }
+           now += j->duration;     
+       }
+     }
+}
 /*
     put all stuff grouped vertically in the Staff_cols
     */
@@ -90,11 +122,11 @@ Staff::setup_staffcols()
 {    
     for (iter_top(voices,i); i.ok(); i++) {
        Moment now = i->start;
-       for (iter_top(i->elts,ve); ve.ok(); ve++) {
+       for (iter_top(i->elts,j); j.ok(); j++) {
 
-           Staff_column *sc=get_col(now,true);
-           sc->add(ve);
-           now += ve->duration;            
+           Staff_column *s_l=get_col(now,true);
+           s_l->add(j);
+           now += j->duration;     
        }       
     }
     set_time_descriptions();