]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.13
authorfred <fred>
Mon, 2 Dec 1996 00:20:03 +0000 (00:20 +0000)
committerfred <fred>
Mon, 2 Dec 1996 00:20:03 +0000 (00:20 +0000)
hdr/melodicstaff.hh
maartje.ly
src/staff.cc

index d97bfb17f8b1bf9fc36d5c83a583dc82270b0401..c908f1dcb0344d250387d4486636cc9c7c6b75d6 100644 (file)
@@ -15,6 +15,7 @@ struct Melodic_staff : public Simple_staff
     
     /****************/
 
+    virtual Rest *get_rest(Rest_req *rq);
     virtual void set_output(PScore *);
     virtual Melodic_staff*clone()const;
     virtual Item* get_TYPESET_item(Command*);
index fcb64323ee0fa42fae0c6a227b2ecb592b3dbb29..c1dd45a68924e18f2c9fc685898c273b3b5d0dee 100644 (file)
@@ -1,35 +1,48 @@
 ritme = rhythmstaff {
-       voice { $ c2 c2
+       $
+       c8 c2 c2
        %[c8( )'a8 c8 c8]
        c2 c2
        
        [fis16 'dis16( fis16 'dis16 ][fis16) 'dis16 fis16 'dis16]
-       c2 r32 r32 r16 r8 r4 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 $ }
+       c2 r32 r32 r16 r8 r4 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 $
 }
 
 melody=
 melodicstaff {
-       voice { $ c () `bes $ start 0.5 }       
-       voice { $
-       %[fis16 'dis16 fis16 'dis16 fis16 'dis16 fis16 'dis16]
-       c2
-       'fis ()'gisis $ }
+       $
+       c8
+       r1
+       'cis2.. r8
+       r4 r8 r16 r32 r32 
 
+       \duration {4}  \chord {
+               \voice { c () `bes c}
+               \voice {'fis ()'gisis fis }
+               \voice { d () d dis }
+               \voice {  a  () bes eis }
+               \voice { fis () g gis }
+       }
+       c4
 
-       voice {  $ d () d $ start 0.5 }
-       voice {  $ a  () bes $ start 0.5 }
-       voice {  $ fis () g $ start 0.5 }
-       
-
-  voice { $
-       ''c2.. r8 r4 r8 r16 r32 r32
-       [d8 e8 'f8 g8] [d8 e8 f8 g8]
-       ''fis1
+       [d8 e8 'f8 g8]  d8 e8 f8 g8
+       ''fis2
        a8 b8 'c8 'd8 ''c8 ```c8 c4 c4  c4 c4
-       \duration 16  `b16 `a16 `g16 `f16 \duration 4
-       c `b `a `g `f `e `d `c ``b ``a ``g ``f ``e ``d ``c$
-       start 1.0 }
+       \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 2:0
+       key $ fis cis gis $
+       skip 2:0
+       key $ $
+       skip 5:0
+       clef bass
+}
 }
+
 score {
        paper {
                geometric 1.4
@@ -39,10 +52,10 @@ score {
        staff { melody }
 %      staff { melody }
        commands {
+               partial 0.125 skip 0:0.125
+
                meter 4 4
-               key $ fis cis gis $
-               skip 2:0
-               key $ $
+               skip 2:0                
                meter 2 4
                skip 19:0
        }
index 4b3322fcef00f4d8244d8e3a485f2d0d657e3f80..9b65539de543ebac7caba75c343feaed35fba6ca 100644 (file)
@@ -1,21 +1,57 @@
 #include "staff.hh"
+#include "score.hh"
+#include "voice.hh"
 #include "swalker.hh"
+#include "getcommand.hh"
 #include "stcol.hh"
 #include "sccol.hh"
+#include "inputcommands.hh"
+#include "staffcommands.hh"
 #include "debug.hh"
 
 Staff::Staff(Staff const&src)
 {
     PL_copy(voices,src.voices);
-    PL_copy(commands,src.commands);
+    staff_commands_ = src.staff_commands_;
     assert(!cols.size());      // cols is a runtime field.
-
+    input_commands_ = src.input_commands_;
+    
     score_ = src.score_;
     pscore_ = src.pscore_;
 }
 
+void
+Staff::add(svec<Command*> &s)
+{
+    input_commands_.add(get_reset_command());
+    input_commands_.concat(s);
+}
+void
+Staff::add(PointerList<Voice*> &l)
+{
+    for (PCursor<Voice*> i(l); i.ok(); i++)
+       voices.bottom().add(i);
+}
+void
+Staff::process_input_commands(svec<Command*> &s, Real l)
+{
+    Input_commands commands;
+    for (int i = 0 ; i< s.sz(); i++)
+       commands.add(new Command(*s[i]));
+    for (int i = 0 ; i< input_commands_.sz(); i++)
+       commands.add(input_commands_[i]);
+    commands.truncate(l);
+    commands.print();
+    
+    staff_commands_ = commands.parse();
+    staff_commands_->clean(l);
+    commands.print();    
+    print();
+}
+
 Paperdef*
-Staff::paper() const{
+Staff::paper() const
+{
     return score_->paper_;
 }
 
@@ -60,7 +96,8 @@ Staff::get_col(Real w, bool mus)
 //  ;  assert((i-1).ok())
     // todo!
     
-    // making a fix at 2:30 am, with several beers drunk. 
+    // making a fix at 2:30 am, with several beers drunk.
+    // but it works :-)
     if ((i-1).ok()&& (i-1)->when() == newst->when()) {
        i--;
     }
@@ -82,10 +119,8 @@ Staff::add_voice(Voice *v)
     */
 void
 Staff::setup_staffcols()
-{
-    
+{    
     for (PCursor<Voice*> vc(voices); vc.ok(); vc++) {
-
        Real now = vc->start;
        for (PCursor<Voice_element *> ve(vc->elts); ve.ok(); ve++) {
 
@@ -95,38 +130,12 @@ Staff::setup_staffcols()
        }       
     }
 
-    for (PCursor<Command*> cc(commands); cc.ok(); cc++) {
+    for (PCursor<Command*> cc(*staff_commands_); cc.ok(); cc++) {
        Staff_column *sc=get_col(cc->when,false);
        sc->s_commands.add(cc);
     }
 }
 
-/// merge commands from score
-void
-Staff::add_commands(PointerList<Command*> const &cl)
-{
-    PCursor<Command*> score_c(cl);
-    PCursor<Command*> cc(commands);
-    
-    while (score_c.ok()) {
-       while (cc.ok() && cc->when <= score_c->when)
-           cc++;
-       
-       Command*nc = new Command (*(* score_c));
-       if (cc.ok()) {
-           // cc->when > score_c->when
-           cc.insert( nc );
-       } else {
-           commands.bottom().add( nc);
-           cc = commands.bottom();
-       }
-       score_c++;
-    }
-
-    // now integrate break commands with other commands.
-    // maybe do this in derived functions.
-}
-
 void
 Staff::process()
 {
@@ -140,7 +149,6 @@ Staff::OK() const
 {
 #ifndef NDEBUG
     cols.OK();
-    commands.OK();
     voices.OK();
     assert(score_);    
 #endif    
@@ -164,15 +172,19 @@ Staff::print() const
 #ifndef NPRINT
     mtor << "Staff {\n";
     for (PCursor<Voice*> vc(voices); vc.ok(); vc++) {
-       vc->print();
-       
+       vc->print();    
     }
+    if (staff_commands_)
+       staff_commands_->print();
+    for (int i =0; i <input_commands_.sz(); i++)
+       input_commands_[i]->print();
     mtor <<"}\n";
 #endif
 }
 
 Staff::Staff()
 {
+    staff_commands_ = 0;
     score_ =0;
     pscore_=0;    
 }