From c4594606bd4ff95753d58c28209ba3776d81f902 Mon Sep 17 00:00:00 2001 From: fred Date: Sat, 21 Dec 1996 17:08:58 +0000 Subject: [PATCH] lilypond-0.0.20 --- hdr/inputmusic.hh | 19 ++++++++++--------- hdr/melodicstaff.hh | 2 +- hdr/paper.hh | 3 ++- hdr/rhythmstaff.hh | 2 +- hdr/score.hh | 8 ++++---- hdr/simplestaff.hh | 4 ++-- hdr/staff.hh | 6 +++--- hdr/swalker.hh | 2 +- hdr/timedescription.hh | 36 ++++++++++++++++++++++++++++++++++++ hdr/voice.hh | 9 +++++---- src/inputcommand.cc | 15 ++------------- src/inputmusic.cc | 22 +++++++++++----------- src/melodicstaff.cc | 2 +- src/paper.cc | 2 +- src/request.cc | 2 +- src/rhythmstaff.cc | 2 +- src/swalker.cc | 2 +- src/voice.cc | 4 ++-- 18 files changed, 85 insertions(+), 57 deletions(-) create mode 100644 hdr/timedescription.hh diff --git a/hdr/inputmusic.hh b/hdr/inputmusic.hh index d3286135f8..5b6da2968a 100644 --- a/hdr/inputmusic.hh +++ b/hdr/inputmusic.hh @@ -10,16 +10,17 @@ #include "plist.hh" #include "proto.hh" #include "voice.hh" +#include "moment.hh" struct Voice_list : public PointerList { - 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); diff --git a/hdr/melodicstaff.hh b/hdr/melodicstaff.hh index 45785e4c02..db7dd88b83 100644 --- a/hdr/melodicstaff.hh +++ b/hdr/melodicstaff.hh @@ -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(); }; diff --git a/hdr/paper.hh b/hdr/paper.hh index b03d1f7621..34c6ce3e20 100644 --- a/hdr/paper.hh +++ b/hdr/paper.hh @@ -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, diff --git a/hdr/rhythmstaff.hh b/hdr/rhythmstaff.hh index 8591e3c1a0..978594dcd3 100644 --- a/hdr/rhythmstaff.hh +++ b/hdr/rhythmstaff.hh @@ -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 *); }; diff --git a/hdr/score.hh b/hdr/score.hh index fbcfde1fc0..5363b475cb 100644 --- a/hdr/score.hh +++ b/hdr/score.hh @@ -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 find_col(Real,bool); + PCursor find_col(Moment,bool); void process(); void output(String fn); - PCursor create_cols(Real); + PCursor create_cols(Moment); void print() const; - Real last() const; + Moment last() const; private: void do_pcols(); diff --git a/hdr/simplestaff.hh b/hdr/simplestaff.hh index faf1002d53..d05179b1ba 100644 --- a/hdr/simplestaff.hh +++ b/hdr/simplestaff.hh @@ -24,7 +24,7 @@ struct Simple_column : Staff_column { svec notes; svec 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 *); diff --git a/hdr/staff.hh b/hdr/staff.hh index 9f1ba1f498..5414fc3f8b 100644 --- a/hdr/staff.hh +++ b/hdr/staff.hh @@ -21,7 +21,7 @@ struct Staff { /****************************************************************/ void add(PointerList &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(); diff --git a/hdr/swalker.hh b/hdr/swalker.hh index da132dd9d6..0d66a55fb4 100644 --- a/hdr/swalker.hh +++ b/hdr/swalker.hh @@ -19,7 +19,7 @@ struct Staff_walker : public PCursor { /****************/ 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 index 0000000000..2cdbc8de23 --- /dev/null +++ b/hdr/timedescription.hh @@ -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 + diff --git a/hdr/voice.hh b/hdr/voice.hh index c716c650dc..f63f905a0d 100644 --- a/hdr/voice.hh +++ b/hdr/voice.hh @@ -3,15 +3,16 @@ #include "proto.hh" #include "plist.hh" +#include "moment.hh" /// class for horizontal stuff. struct Voice { IPointerList 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 reqs; diff --git a/src/inputcommand.cc b/src/inputcommand.cc index e38eb87217..fda5ceefcf 100644 --- a/src/inputcommand.cc +++ b/src/inputcommand.cc @@ -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,sveca ) -{ - Input_command*c = get_grouping_command(a); - c->args.insert(r,1); - return c; -} - Input_command* get_grouping_command(sveca ) { @@ -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; diff --git a/src/inputmusic.cc b/src/inputmusic.cc index db2e3c57d5..b007562d1c 100644 --- a/src/inputmusic.cc +++ b/src/inputmusic.cc @@ -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 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 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 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 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 i(*this); i.ok(); i++) i->start += x; diff --git a/src/melodicstaff.cc b/src/melodicstaff.cc index 493e67f05e..b20e3a6bf2 100644 --- a/src/melodicstaff.cc +++ b/src/melodicstaff.cc @@ -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; diff --git a/src/paper.cc b/src/paper.cc index 2879d90c91..82b8583876 100644 --- a/src/paper.cc +++ b/src/paper.cc @@ -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)); } diff --git a/src/request.cc b/src/request.cc index 7821ba240c..2645d5dc90 100644 --- a/src/request.cc +++ b/src/request.cc @@ -71,7 +71,7 @@ Rest_req::print() const } -Real +Moment Rhythmic_req::duration() const { return wholes( balltype,dots); } diff --git a/src/rhythmstaff.cc b/src/rhythmstaff.cc index a446bd33ec..9142986abc 100644 --- a/src/rhythmstaff.cc +++ b/src/rhythmstaff.cc @@ -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; diff --git a/src/swalker.cc b/src/swalker.cc index 98d58324c3..130543dd97 100644 --- a/src/swalker.cc +++ b/src/swalker.cc @@ -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 *) this)->when(); diff --git a/src/voice.cc b/src/voice.cc index 8a1c136d04..2f2bbaec53 100644 --- a/src/voice.cc +++ b/src/voice.cc @@ -30,10 +30,10 @@ Voice::print() const #endif } -Real +Moment Voice::last() const { - Real l =start; + Moment l =start; for (PCursor vec(elts); vec.ok(); vec++) l += vec->duration; return l; -- 2.39.5