]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.20
authorfred <fred>
Sat, 21 Dec 1996 17:08:58 +0000 (17:08 +0000)
committerfred <fred>
Sat, 21 Dec 1996 17:08:58 +0000 (17:08 +0000)
18 files changed:
hdr/inputmusic.hh
hdr/melodicstaff.hh
hdr/paper.hh
hdr/rhythmstaff.hh
hdr/score.hh
hdr/simplestaff.hh
hdr/staff.hh
hdr/swalker.hh
hdr/timedescription.hh [new file with mode: 0644]
hdr/voice.hh
src/inputcommand.cc
src/inputmusic.cc
src/melodicstaff.cc
src/paper.cc
src/request.cc
src/rhythmstaff.cc
src/swalker.cc
src/voice.cc

index d3286135f8c2774073edbe86e70afdce0d21e14f..5b6da2968aa7538bceae3d7e56b4c095021fe3bc 100644 (file)
 #include "plist.hh"
 #include "proto.hh"
 #include "voice.hh"
+#include "moment.hh"
 
 struct Voice_list : public PointerList<Voice*> {
-    void translate_time(Real dt);
+    void translate_time(Moment dt);
 };
 
 /// ABC for input structures
 struct Input_music {
     virtual Voice_list convert()=0;
-    virtual Real length()=0;
-    virtual void translate_time(Real dt)=0;
+    virtual Moment length()=0;
+    virtual void translate_time(Moment dt)=0;
     virtual ~Input_music(){}
     virtual void print() const =0;
     // virtual void transpose(...) const =0;
@@ -47,9 +48,9 @@ struct Simple_music : Input_music {
     /****/
     virtual Simple_music*simple() { return this; }  
     void add(Voice_element*);
-    virtual Real length();
+    virtual Moment length();
     virtual Voice_list convert();
-    virtual void translate_time(Real dt);
+    virtual void translate_time(Moment dt);
     virtual void print() const;
     virtual Input_music *clone() const {
        return new Simple_music(*this);
@@ -74,8 +75,8 @@ struct Music_voice : Complex_music {
  
     
     /****************/
-    Real length();
-    virtual void translate_time(Real dt);
+    Moment length();
+    virtual void translate_time(Moment dt);
     virtual Voice_list convert();
     void add_elt(Voice_element*);
     virtual Input_music *clone() const {
@@ -97,9 +98,9 @@ struct Music_general_chord : Complex_music {
 
     /****************/
 
-    virtual Real length();
+    virtual Moment length();
     virtual Voice_list convert();
-    virtual void translate_time(Real dt);
+    virtual void translate_time(Moment dt);
     void add_elt(Voice_element*);
     virtual Input_music *clone() const {
        return new Music_general_chord(*this);
index 45785e4c020292c16b69b1f5865bd0e48c254d0c..db7dd88b8311bea4277519d242dc4e26281ce9a3 100644 (file)
@@ -19,7 +19,7 @@ struct Melodic_staff : public Simple_staff
     virtual void set_output(PScore *);
 
     virtual Item* get_TYPESET_item(Command*);
-    virtual Stem * get_stem(Stem_req *rq,Real);
+    virtual Stem * get_stem(Stem_req *rq,Moment);
     virtual Notehead * get_notehead(Note_req *rq, int bot);
     virtual Local_key_item* get_local_key_item();
 };
index b03d1f76210abbacf90e9c1c184a261c7820ecb8..34c6ce3e20268453c8a766cce085ad5810dd7cda 100644 (file)
@@ -1,6 +1,7 @@
 #include "proto.hh"
 #include "real.hh"
 #include "string.hh"
+#include "moment.hh"
 
 /// symbols, dimensions and constants
 struct Paperdef {
@@ -26,7 +27,7 @@ struct Paperdef {
     Real standard_height()const;
     Real note_width() const;
     void print() const;
-    Real duration_to_dist(Real);
+    Real duration_to_dist(Moment);
 };
 /** This struct takes care of all kinds of symbols, dimensions and
  constants. Most of them are related to the point-size of the fonts,
index 8591e3c1a0a53c14e3eff190844516bbf2503e48..978594dcd38230f868a0b1146fc5e1890ac03d32 100644 (file)
@@ -16,7 +16,7 @@ struct Rhythmic_staff : public Simple_staff
     /****************/
     
     virtual Item *get_TYPESET_item(Command*);    
-    virtual Stem *get_stem(Stem_req *rq,Real);
+    virtual Stem *get_stem(Stem_req *rq,Moment);
     virtual Notehead * get_notehead(Note_req *rq, int b);   
     virtual void set_output(PScore *);
 };
index fbcfde1fc06d63daf9d9bb2f1504ec8ba9372d0a..5363b475cb44d7c7a3114139bc82d32f044de8d8 100644 (file)
@@ -3,7 +3,7 @@
 #include "vray.hh"
 #include "proto.hh"
 #include "plist.hh"
-
+#include "moment.hh"
 
 /// the total music def of one movement
 struct Score {
@@ -25,12 +25,12 @@ struct Score {
 
 
     void OK() const;
-    PCursor<Score_column *> find_col(Real,bool);
+    PCursor<Score_column *> find_col(Moment,bool);
     void process();
     void output(String fn);
-    PCursor<Score_column*> create_cols(Real);
+    PCursor<Score_column*> create_cols(Moment);
     void print() const;
-    Real last() const;
+    Moment last() const;
     
 private:
     void do_pcols();    
index faf1002d53a01dc03874e2a0ad851ee95e35ddc0..d05179b1bab7ba21d9bfcfe90f1f2245b403e7dd 100644 (file)
@@ -24,7 +24,7 @@ struct Simple_column : Staff_column {
     svec<Rhythmic_req *> notes;
     svec<Slur_req *> slurs;
     Stem_req *stem_;
-    Real stem_requester_len;
+    Moment stem_requester_len;
     Beam_req *beam_;
     Simple_staff* staff_;
 
@@ -52,7 +52,7 @@ struct Simple_staff : Staff {
     Staff_column*create_col(Score_column*);
     
     virtual Item *get_TYPESET_item(Command*);
-    virtual Stem *get_stem(Stem_req *rq, Real)=0;
+    virtual Stem *get_stem(Stem_req *rq, Moment)=0;
     virtual Notehead *get_notehead(Note_req *rq, int b)=0;
     virtual Rest *get_rest(Rest_req *rq);
     virtual void set_output(PScore *);
index 9f1ba1f498e48e7273125848bf7a0fe0836e741b..5414fc3f8b3aa905d1733672f60388801d3c01e3 100644 (file)
@@ -21,7 +21,7 @@ struct Staff {
 
     /****************************************************************/
     void add(PointerList<Voice*> &s);
-    void process_commands(Real l);
+    void process_commands(Moment l);
 
     Staff(const Staff&src);
     void add_voice(Voice *v);
@@ -37,9 +37,9 @@ struct Staff {
 
     void OK() const;
     void print() const;
-    Real last() const;
+    Moment last() const;
     void clean_cols() ;
-    Staff_column * get_col(Real,bool);
+    Staff_column * get_col(Moment,bool);
 
     Staff();
 
index da132dd9d6275c51fb0e26548ea8c241275f78a4..0d66a55fb4c91e9b5e95ea0d9a7abca4f58cc1e2 100644 (file)
@@ -19,7 +19,7 @@ struct Staff_walker : public PCursor<Staff_column*> {
     /****************/
 
     int priority() const;              // Command
-    Real when() const;    
+    Moment when() const;    
     virtual ~Staff_walker();
     Staff_walker(Staff*, PScore*);
     void process() ;
diff --git a/hdr/timedescription.hh b/hdr/timedescription.hh
new file mode 100644 (file)
index 0000000..2cdbc8d
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+  moment.hh -- part of LilyPond
+
+  (c) 1996 Han-Wen Nienhuys
+*/
+
+#ifndef tdes_HH
+#define tdes_HH
+
+#include "real.hh"
+#include "moment.hh"
+
+struct Time_description {
+    Rational when;
+    /// current measure info
+    Rational whole_per_measure;
+
+    /// where am i 
+    Rational whole_in_measure;
+
+    /// how long is one beat?
+    Rational one_beat;
+
+    /// idem
+    int bars;
+    /****************/
+    void OK() const;
+    Time_description(Rational, const Time_description*);
+    void print() const;
+    void setpartial(Rational p);
+    Rational barleft();
+    void set_meter(int,int);
+};
+
+#endif // Time_description_HH
+
index c716c650dc45eb7e1df060296806a14ce6040fae..f63f905a0d68ae2977f4698411d6945f2d179c03 100644 (file)
@@ -3,15 +3,16 @@
 
 #include "proto.hh"
 #include "plist.hh"
+#include "moment.hh"
 
 /// class for  horizontal stuff.
 struct Voice {
     IPointerList<Voice_element *> elts;
-    Real start;
+    Moment start;
 
     /****************/
-    Real when(const Voice_element*)const;
-    Real last() const;
+    Moment when(const Voice_element*)const;
+    Moment last() const;
     Voice();
     Voice(Voice const&);
     void add(Voice_element*);
@@ -30,7 +31,7 @@ struct Voicegroup {
 
 /// one horizontal bit. 
 struct Voice_element {
-    Real duration;
+    Moment duration;
     const Voicegroup *group;
     const Voice *voice_;
     IPointerList<Request*> reqs;
index e38eb872179719da604e6b686f932d8cca2074a9..fda5ceefcf5b85d853e0b5393a737251c5c1463c 100644 (file)
@@ -6,9 +6,6 @@ Input_command::Input_command()
 {
 }
 
-Input_command::Input_command(Real )
-{
-}
 
 Input_command::operator Command()
 {
@@ -39,7 +36,7 @@ Input_command::operator Command()
 
 
 Input_command*
-get_partial_command(Real u)
+get_partial_command(Moment u)
 {
     Input_command*c = new Input_command;
     c->args.add("PARTIAL");
@@ -47,14 +44,6 @@ get_partial_command(Real u)
     return c;
 }
 
-Input_command*
-get_grouping_command(Real r,svec<int>a ) 
-{
-    Input_command*c = get_grouping_command(a);
-    c->args.insert(r,1);
-    return c;
-}
-
 Input_command*
 get_grouping_command(svec<int>a ) 
 {
@@ -109,7 +98,7 @@ get_bar_command()
 }
 
 Input_command *
-get_skip_command(int n, Real m)
+get_skip_command(int n, Moment m)
 {
     Input_command*c = new Input_command;
     
index db2e3c57d5b0e0bf8e8a5c8db3ca7d8f72b441d6..b007562d1c178c880f4d455d6ec0e0305d55346b 100644 (file)
@@ -8,13 +8,13 @@ Simple_music::add(Voice_element*v)
     voice_.add(v);
 }
 
-Real
+Moment
 Simple_music::length()
 {
     return voice_.last();
 }
 void
-Simple_music::translate_time(Real t)
+Simple_music::translate_time(Moment t)
 {
     voice_.start += t;
 }
@@ -93,10 +93,10 @@ Music_voice::add_elt(Voice_element*v)
     s->add(v);             
 }
 
-Real
+Moment
 Music_voice::length()
 {
-    Real l = 0.0;
+    Moment l = 0.0;
     
     for (PCursor<Input_music*> i(elts); i.ok(); i++)
        l += i->length();
@@ -108,10 +108,10 @@ Voice_list
 Music_voice::convert()
 {
     Voice_list l;
-    Real here = 0.0;
+    Moment here = 0.0;
     
     for (PCursor<Input_music*> i(elts); i.ok(); i++) {
-       Real len = i->length(); 
+       Moment len = i->length();       
        Voice_list k(i->convert());
        k.translate_time(here); 
        l.concatenate(k);
@@ -122,7 +122,7 @@ Music_voice::convert()
 }
 
 void
-Music_voice::translate_time(Real t)
+Music_voice::translate_time(Moment t)
 {
     elts.bottom()->translate_time(t);
 }
@@ -148,16 +148,16 @@ Music_general_chord::print() const
 }
 
 void
-Music_general_chord::translate_time(Real t)
+Music_general_chord::translate_time(Moment t)
 {
     for (PCursor<Input_music*> i(elts); i.ok(); i++) 
        i->translate_time(t);    
 }
 
-Real
+Moment
 Music_general_chord::length()
 {
-    Real l =0.0;
+    Moment l =0.0;
     
     for (PCursor<Input_music*> i(elts); i.ok(); i++) 
        l = l >? i->length();
@@ -179,7 +179,7 @@ Music_general_chord::convert()
 /****************/
 
 void
-Voice_list::translate_time(Real x)
+Voice_list::translate_time(Moment x)
 {
     for (PCursor<Voice*> i(*this); i.ok(); i++)
        i->start += x;    
index 493e67f05e8d75d3cffc5d17fdcaf0715c47d8d8..b20e3a6bf2375878d5a20cac4931f133da0556bc 100644 (file)
@@ -45,7 +45,7 @@ Melodic_staff::get_TYPESET_item(Command*com)
 }
 
 Stem *
-Melodic_staff::get_stem(Stem_req*rq, Real dur)
+Melodic_staff::get_stem(Stem_req*rq, Moment dur)
 {
     Stem * s = new Stem(NO_LINES-1, dur);
     s->flag = rq->stem_number;
index 2879d90c91fa267a3de568c08404a7af6153f5a5..82b858387680f6415dd9f521f23bf2289b40b854 100644 (file)
@@ -12,7 +12,7 @@ const Real PHI = (1+sqrt(5))/2;
 
 // see  Roelofs, p. 57
 Real
-Paperdef::duration_to_dist(Real d)
+Paperdef::duration_to_dist(Moment d)
 {
     return whole_width * pow(geometric_, log_2(d));
 }
index 7821ba240c19cb02bc9e1b52ad7b94a27dbaa34b..2645d5dc9075abd57c10909308f43e36ad1c782f 100644 (file)
@@ -71,7 +71,7 @@ Rest_req::print() const
 }
 
 
-Real
+Moment
 Rhythmic_req::duration() const {    
     return wholes( balltype,dots);
 }
index a446bd33ecbe70846e2660236b39d3dcbcf8ffdc..9142986abce6dd65af07115de91d12fd73da98bd 100644 (file)
@@ -43,7 +43,7 @@ Rhythmic_staff::get_notehead(Note_req *rq, int)
 }
 
 Stem *
-Rhythmic_staff::get_stem(Stem_req*rq, Real l)
+Rhythmic_staff::get_stem(Stem_req*rq, Moment l)
 {
     Stem * s = new Stem(0,l);
     s->flag = rq->stem_number;
index 98d58324c345b51f92b080be485ec74d8fa97da2..130543dd97ac4f9db456583269defb44b002be0a 100644 (file)
@@ -13,7 +13,7 @@ Staff_walker::Staff_walker(Staff * s, PScore*ps )
     break_status = BREAK_END - BREAK_PRE;
 }
 
-Real
+Moment
 Staff_walker::when() const
 {
     return (* (PCursor<Staff_column*> *) this)->when();
index 8a1c136d04b32389fef812191696ca85a5c559d0..2f2bbaec53b3d914c6057ff53be5e8a5bcebe1df 100644 (file)
@@ -30,10 +30,10 @@ Voice::print() const
 #endif
 }
 
-Real
+Moment
 Voice::last() const
 {
-    Real l =start;
+    Moment l =start;
     for (PCursor<Voice_element*> vec(elts); vec.ok(); vec++)
        l  += vec->duration;
     return l;