#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;
/****/
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);
/****************/
- 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 {
/****************/
- 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);
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();
};
#include "proto.hh"
#include "real.hh"
#include "string.hh"
+#include "moment.hh"
/// symbols, dimensions and constants
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,
/****************/
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 *);
};
#include "vray.hh"
#include "proto.hh"
#include "plist.hh"
-
+#include "moment.hh"
/// the total music def of one movement
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();
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_;
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 *);
/****************************************************************/
void add(PointerList<Voice*> &s);
- void process_commands(Real l);
+ void process_commands(Moment l);
Staff(const Staff&src);
void add_voice(Voice *v);
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();
/****************/
int priority() const; // Command
- Real when() const;
+ Moment when() const;
virtual ~Staff_walker();
Staff_walker(Staff*, PScore*);
void process() ;
--- /dev/null
+/*
+ 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
+
#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*);
/// one horizontal bit.
struct Voice_element {
- Real duration;
+ Moment duration;
const Voicegroup *group;
const Voice *voice_;
IPointerList<Request*> reqs;
{
}
-Input_command::Input_command(Real )
-{
-}
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");
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 )
{
}
Input_command *
-get_skip_command(int n, Real m)
+get_skip_command(int n, Moment m)
{
Input_command*c = new Input_command;
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;
}
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();
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);
}
void
-Music_voice::translate_time(Real t)
+Music_voice::translate_time(Moment t)
{
elts.bottom()->translate_time(t);
}
}
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();
/****************/
void
-Voice_list::translate_time(Real x)
+Voice_list::translate_time(Moment x)
{
for (PCursor<Voice*> i(*this); i.ok(); i++)
i->start += x;
}
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;
// 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));
}
}
-Real
+Moment
Rhythmic_req::duration() const {
return wholes( balltype,dots);
}
}
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;
break_status = BREAK_END - BREAK_PRE;
}
-Real
+Moment
Staff_walker::when() const
{
return (* (PCursor<Staff_column*> *) this)->when();
#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;