+++ /dev/null
-/*
- commandrequest.cc -- implement Nonmusical reqs
-
- source file of the LilyPond music typesetter
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-
-#include "commandrequest.hh"
-#include "debug.hh"
-#include "musicalrequest.hh"
-
-
-void
-Cadenza_req::do_print()const
-{
- mtor << on_b_;
-}
-
-Cadenza_req::Cadenza_req(bool b)
-{
- on_b_ =b;
-}
-/* *************** */
-
-
-int
-Bar_req::compare(const Bar_req &c1)const
-{
- return type_str_ == c1.type_str_;
-}
-
-void
-Bar_req::do_print() const
-{
- mtor << type_str_;
-}
-
-Bar_req::Bar_req(String s)
-{
- type_str_ = s;
-}
-
-Partial_measure_req::Partial_measure_req(Moment m)
-{
- duration_ =m;
-}
-/* *************** */
-Meter_change_req::Meter_change_req()
-{
- beats_i_ = 0;
- one_beat_i_ =0;
-}
-void
-Meter_change_req::set(int b,int o)
-{
- beats_i_=b;
- one_beat_i_=o;
-}
-
-void
-Timing_req::do_print()const{}
-
-void
-Command_req::do_print()const{}
-/* *************** */
-void
-Barcheck_req::do_print() const{}
-
-/* *************** */
-void
-Clef_change_req::do_print() const
-{
- mtor << clef_str_ ;
-}
-
-Clef_change_req::Clef_change_req(String s)
-{
- clef_str_ = s;
-}
-/* *************** */
-void
-Group_feature_req::do_print() const
-{
- mtor << "stemdir " << stemdir_i_;
-}
-
-Group_feature_req::Group_feature_req()
-{
- stemdir_i_ = 0;
-}
-
-void
-Group_change_req::do_print()const
-{
- mtor << "id : " << newgroup_str_;
-}
-/* *************** */
-void
-Terminate_voice_req::do_print()const
-{
-}
-
-/* *************** */
-void
-Partial_measure_req::do_print() const
-{
- mtor << duration_;
-}
-
-void
-Meter_change_req::do_print() const
-{
- mtor << beats_i_ << "*" << one_beat_i_;
-}
-
-/* *************** */
-
-void
-Measure_grouping_req::do_print() const
-{
- for (int i=0; i < elt_length_arr_.size(); i++) {
- mtor << beat_i_arr_[i] <<"*" << elt_length_arr_[i]<<" ";
- }
-}
-/* *************** */
-void
-Key_change_req::do_print() const
-{
- for (int i=0; i < melodic_p_arr_.size(); i++) {
- melodic_p_arr_[i]->print();
- }
-}
-
-Key_change_req::Key_change_req()
-{
-}
-Key_change_req::Key_change_req(Key_change_req const&c)
-{
- for (int i=0; i < c.melodic_p_arr_.size(); i++) {
- melodic_p_arr_.push( c.melodic_p_arr_[i]->clone()->melodic() );
- }
-}
-
-Key_change_req::~Key_change_req()
-{
- for (int i=0; i < melodic_p_arr_.size(); i++)
- delete melodic_p_arr_[i];
-}
+++ /dev/null
-/*
- musicalrequests.hh -- declare Musical requests
-
- source file of the LilyPond music typesetter
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-
-
-#ifndef MUSICALREQUESTS_HH
-#define MUSICALREQUESTS_HH
-
-#include "request.hh"
-
-
-/**
- A request which is coupled to a #Voice_element# with nonzero duration.
- Base class only
- */
-struct Musical_req : virtual Request {
- virtual Skip_req* skip() { return 0; }
- virtual Dynamic_req* dynamic() { return 0; }
- virtual Absolute_dynamic_req * absdynamic() { return 0; }
- virtual Subtle_req * subtle() { return 0; }
- REQUESTMETHODS(Musical_req, musical);
-};
-
-
-struct Skip_req : Musical_req {
- Moment duration_;
-
- virtual Moment duration() const;
- REQUESTMETHODS(Skip_req, skip);
-};
-/** a request with a duration.
- This request is used only a base class.
- */
-struct Rhythmic_req : virtual Musical_req {
- int balltype;
- int dots;
- Moment plet_factor;
- /* *************** */
- static int compare(const Rhythmic_req &, const Rhythmic_req &);
- virtual Moment duration() const;
- Rhythmic_req();
- Rhythmic_req(int,int);
- REQUESTMETHODS(Rhythmic_req, rhythmic);
-};
-
-struct Spacing_req :virtual Request {
- Moment next;
- Real distance;
- Real strength;
- /* *************** */
- Spacing_req();
- REQUESTMETHODS(Spacing_req, spacing);
-};
-
-struct Blank_req : Spacing_req, Rhythmic_req {
- REQUESTMETHODS(Spacing_req, spacing);
-
-};
-
-/// Put a text above or below (?) this staff.
-struct Text_req : virtual Musical_req {
- /// preferred position (above/below)
- int dir_i_;
- /// the characteristics of the text
- Text_def *tdef_p_;
- /* *************** */
- Text_req(int d, Text_def*);
- ~Text_req();
- Text_req(Text_req const&);
- static int compare(const Text_req&,const Text_req&);
- REQUESTMETHODS(Text_req,text);
-};
-
-/** Put a text in lyric_staff
- @see Lyric_staff
- */
-struct Lyric_req : public Rhythmic_req, Text_req {
- Lyric_req(Text_def* t_p);
- REQUESTMETHODS(Lyric_req, lreq_l);
-};
-
-/// request which has some kind of pitch
-struct Melodic_req :virtual Musical_req
-{
- /// 0 is c, 6 is b
- int notename_i_;
- /// 0 is central c
- int octave_i_;
-
- /// 0 natural, 1 sharp, etc
- int accidental_i_;
-
- /// force/supress printing of accidental.
- bool forceacc_b_;
-
- /// return height from central c (in halflines)
- int height()const;
- /// return pitch from central c (in halfnotes)
- int pitch()const;
- Melodic_req();
-
- REQUESTMETHODS(Melodic_req,melodic);
-};
-
-/// Put a note of specified type, height, and with accidental on the staff.
-struct Note_req : Rhythmic_req, virtual Melodic_req {
-
-
- Rhythmic_req* rhythmic() { return Rhythmic_req::rhythmic(); }
- REQUESTMETHODS(Note_req, note);
- };
-
-/**
-Put a rest on the staff. Why a request? It might be a good idea to not typeset the rest, if the paper is too crowded.
-*/
-class Rest_req : public Rhythmic_req {
-public:
- REQUESTMETHODS(Rest_req,rest);
-};
-
-/**
- attach a stem to the noteball.
- Rhythmic_req parent needed to determine if it will fit inside a beam.
- */
-struct Stem_req : Rhythmic_req {
- /// preferred direction for the stem
- int dir_i_;
- Stem_req(int s, int dots);
- REQUESTMETHODS(Stem_req,stem);
-};
-
-/**
- Requests to start or stop something.
- This type of request typically results in the creation of a #Spanner#
-*/
-struct Span_req : Musical_req {
- /// should the spanner start or stop, or is it unwanted?
- enum {
- NOSPAN, START, STOP
- } spantype ;
- static int compare(const Span_req &r1, const Span_req &r2);
- REQUESTMETHODS(Span_req,span);
-
- Span_req();
-
-};
-
-/// request for backward plet generation
-struct Plet_req : Request {
- char type_c_;
- int dur_i_;
- int type_i_;
- Plet_req();
-
- REQUESTMETHODS(Plet_req,plet);
-};
-/**
-*/
-
-/** Start / stop a beam at this note. if #nplet# is set, the staff will try to put an
-appropriate number over the beam
- */
-struct Beam_req : Span_req {
- int nplet;
-
- /* *************** */
- REQUESTMETHODS(Beam_req,beam);
-
- Beam_req();
-};
-
-/// a slur
-struct Slur_req : Span_req {
- REQUESTMETHODS(Slur_req,slur);
-
-};
-
-
-/** Put a script above or below this ``note''. eg upbow, downbow. Why
- a request? These symbols may conflict with slurs and brackets, so
- this also a request */
-struct Script_req : Musical_req {
- int dir_i_;
- Script_def *scriptdef_p_;
-
- /* *************** */
- static int compare(const Script_req &, const Script_req &);
- Script_req(int d, Script_def*);
- REQUESTMETHODS(Script_req,script);
- ~Script_req();
- Script_req(Script_req const&);
-};
-
-/** A helper in the hierarchy. Each dynamic is bound to one note ( a
- crescendo spanning multiple notes is thought to be made of two
- "dynamics": a start and a stop). Dynamic changes can occur in a
- smaller time than the length of its note, therefore fore each
- Dynamic request carries a time, measured from the start of its
- note.
- */
-struct Subtle_req : virtual Musical_req {
- Moment subtime_;
- REQUESTMETHODS(Subtle_req, subtle);
-};
-
-struct Dynamic_req : Subtle_req {
- /// for absolute dynamics
- enum Loudness {
- FFF, FF, F, MF, MP, P, PP, PPP
- };
- static String loudness_str(Loudness);
- REQUESTMETHODS(Dynamic_req, dynamic);
-};
-
-struct Absolute_dynamic_req : Dynamic_req {
- Loudness loudness_;
- Absolute_dynamic_req();
- REQUESTMETHODS(Absolute_dynamic_req, absdynamic);
-};
-
-#endif // MUSICALREQUESTS_HH
+++ /dev/null
-#ifndef COLS_HH
-#define COLS_HH
-
-#include "glob.hh"
-#include "boxes.hh"
-#include "plist.hh"
-#include "item.hh"
-
-
-/**
- stuff grouped vertically.
- This is a class to address items vertically. It contains the data for:
- \begin{itemize}
- \item
- unbroken score
- \item
- broken score
- \item
- the linespacing problem
- \end{itemize}
- */
-
-struct PCol {
- PointerList<const Item*> its;
- PointerList<const Spanner*> stoppers, starters;
-
-
-
- /** prebreak is put before end of line.
- if broken here, then (*this) column is discarded, and prebreak
- is put at end of line, owned by Col
- */
- PCol *prebreak_p_;
-
- /// postbreak at beginning of the new line
- PCol *postbreak_p_;
-
- /** if this column is pre or postbreak, then this field points to
- the parent. */
- PCol *daddy_l_;
-
- /// if lines are broken then this column is in #line#
- const Line_of_score *line_l_;
-
- /// if lines are broken then this column x-coord #hpos#
- Real hpos;
-
- PScore * pscore_l_;
-
- /* *************** */
- /// which one (left =0)
- int rank() const;
-
- /// does this column have items
- bool used_b() const;
-
- void add(Item *i);
-
- /// Can this be broken? true eg. for bars.
- bool breakable_b()const;
-
- Interval width() const;
- ~PCol();
- PCol(PCol * parent);
-
- /**
- which col comes first?.
- signed compare on columns.
-
- @return < 0 if c1 < c2.
- */static int compare(const PCol &c1, const PCol &c2);
-
-
- void OK() const;
- void set_breakable();
- void print()const;
-private:
- PCol(PCol const&){}
-};
-
-
-#include "compare.hh"
-instantiate_compare(PCol &, PCol::compare);
-
-
-#endif
+++ /dev/null
-// the breaking problem for a score.
-
-#ifndef PSCORE_HH
-#define PSCORE_HH
-
-#include "colhpos.hh"
-#include "varray.hh"
-#include "pcol.hh"
-#include "pstaff.hh"
-
-
-/** all stuff which goes onto paper. notes, signs, symbols in a score can be grouped in two ways:
- horizontally (staffwise), and vertically (columns). #PScore#
- contains the items, the columns and the staffs.
- */
-
-struct PScore {
- Paper_def *paper_l_;
-
- /// the columns, ordered left to right
- IPointerList<PCol *> cols;
-
- /// the idealspacings, no particular order
- IPointerList<Idealspacing*> suz;
-
- /// the staffs ordered top to bottom
- IPointerList<PStaff*> staffs;
-
- /// all symbols in score. No particular order.
- IPointerList<Item*> its;
-
- /// if broken, the different lines
- IPointerList<Line_of_score*> lines;
-
- /// crescs etc; no particular order
- IPointerList<Spanner *> spanners;
-
- /// broken spanners
- IPointerList<Spanner*> broken_spans;
-
- /* *************** */
- /* CONSTRUCTION */
-
- PScore(Paper_def*);
- /// add a line to the broken stuff. Positions given in #config#
- void set_breaking(Array<Col_hpositions>);
-
- void add(PStaff *);
-
-
- /** add an item.
- add the item in specified containers. If breakstatus is set
- properly, add it to the {pre,post}break of the pcol.
- */
- void typeset_item(Item *item_p, PCol *pcol_l,PStaff*pstaf_l,int breakstatus=1);
-
- /// add a Spanner
- void typeset_spanner(Spanner*, PStaff*);
-
- /// add to bottom of pcols
- void add(PCol*);
- void add_broken(Spanner*);
-
- /* INSPECTION */
- Array<Item*> select_items(PStaff*, PCol*);
-
- /**
- @return argument as a cursor of the list
- */
- PCursor<PCol *> find_col(const PCol *)const;
-
- /* MAIN ROUTINES */
- void process();
-
- /// last deed of this struct
- void output(Tex_stream &ts);
-
- /* UTILITY ROUTINES */
-
- /// get the spacing between c1 and c2, create one if necessary.
- Idealspacing* get_spacing(PCol *c1, PCol *c2);
-
- /// connect c1 and c2
- void do_connect(PCol *c1, PCol *c2, Real distance_f, Real strength_f);
-
- /// connect c1 and c2 and any children of c1 and c2
- void connect(PCol* c1, PCol *c2, Real distance_f,Real strength_f= 1.0);
-
- /* STANDARD ROUTINES */
- void OK()const;
- void print() const;
-private:
- /// before calc_breaking
- void preprocess();
-
- /// calculate where the lines are to be broken, and use results
- void calc_breaking();
-
- /// after calc_breaking
- void postprocess();
-
- /// delete unused columns
- void clean_cols();
-};
-
-#endif
+++ /dev/null
-#ifndef PSTAFF_HH
-#define PSTAFF_HH
-
-#include "proto.hh"
-#include "plist.hh"
-#include "item.hh"
-#include "symbol.hh"
-
-/// items grouped horizontally
-struct PStaff {
- PScore * pscore_l_;
-
-
- PointerList<const Spanner*> spans;
- PointerList<Item*> its;
-
- /* *************** */
- void add(Item*i);
- PStaff(PScore*);
-
-private:
- PStaff(PStaff const&);
-};
-
-#endif
+++ /dev/null
-#include "pcol.hh"
-#include "pscore.hh"
-#include "pstaff.hh"
-#include "debug.hh"
-
-Interval
-PCol::width() const
-{
- Interval w;
-
- for (iter_top(its,i); i.ok(); i++)
- w.unite(i->width());
- if (w.empty())
- w.unite(Interval(0,0));
- return w;
-}
-
-int
-PCol::rank() const
-{
- if(!pscore_l_)
- return -1;
- PCursor<PCol*> me=pscore_l_->find_col( (PCol*)this);
- if (!me.ok())
- return -1;
- PCursor<PCol*> bot(pscore_l_->cols.top());
- return me - bot;
-}
-
-void
-PCol::print() const
-{
-#ifndef NPRINT
- mtor << "PCol {";
-
- if (rank() >= 0)
- mtor << "rank: " << rank() << '\n';
-
- mtor << "# symbols: " << its.size() ;
- if (breakable_b()){
- mtor << "\npre,post: ";
- prebreak_p_->print();
- postbreak_p_->print();
- } else if (daddy_l_) {
- mtor<<'\n' << ((this == daddy_l_->prebreak_p_) ?
- "prebreak" : "postbreak");
- mtor << '\n';
- }
- mtor << "extent: " << width().str() << "\n";
- mtor << "}\n";
-#endif
-}
-
-int
-PCol::compare(const PCol &c1, const PCol &c2)
-{
- PScore*ps_l = c1.pscore_l_;
- PCursor<PCol*> ac(ps_l->find_col(&c1));
- PCursor<PCol*> bc(ps_l->find_col(&c2));
- assert(ac.ok() && bc.ok());
- return ac - bc;
-}
-
-void
-PCol::OK() const
-{
-#ifndef NDEBUG
- if (prebreak_p_ || postbreak_p_ ) {
- assert(prebreak_p_&&postbreak_p_);
- assert(prebreak_p_->daddy_l_ == this);
- assert(postbreak_p_->daddy_l_ == this);
- }
-#endif
-}
-
-void
-PCol::set_breakable()
-{
- if (breakable_b())
- return;
-
- prebreak_p_ = new PCol(this);
- postbreak_p_ = new PCol(this);
- prebreak_p_->pscore_l_ = pscore_l_;
- postbreak_p_->pscore_l_ = pscore_l_;
-}
-
-bool
-PCol::breakable_b() const
-{
- return prebreak_p_||postbreak_p_;
-}
-
-PCol::PCol(PCol *parent)
-{
- daddy_l_ = parent;
- prebreak_p_=0;
- postbreak_p_=0;
- line_l_=0;
- hpos = -1.0;
- pscore_l_ = 0;
-}
-
-PCol::~PCol()
-{
- delete prebreak_p_;
- delete postbreak_p_;
-}
-
-void
-PCol::add( Item *i)
-{
- its.bottom().add(i);
- i->pcol_l_ = this;
-}
-
-bool
-PCol::used_b()const
-{
- return breakable_b() || its.size();
-}
+++ /dev/null
-#include "idealspacing.hh"
-#include "debug.hh"
-#include "lookup.hh"
-#include "spanner.hh"
-#include "paper-def.hh"
-#include "molecule.hh"
-#include "dimen.hh"
-#include "scoreline.hh"
-#include "pscore.hh"
-#include "tex-stream.hh"
-#include "item.hh"
-#include "break.hh"
-
-Idealspacing*
-PScore::get_spacing(PCol*l, PCol*r)
-{
- assert(l!=r);
-
- Idealspacing*i_p =new Idealspacing(l,r);
- suz.bottom().add(i_p);
-
- return i_p;
-}
-
-
-void
-PScore::clean_cols()
-{
- for (iter_top(cols,c); c.ok(); )
- if (!c->used_b()) {
- delete c.remove_p();
- } else
- c++;
-}
-
-
-void
-PScore::add(PStaff *s)
-{
- assert(s->pscore_l_ == this);
- staffs.bottom().add(s);
-}
-
-
-void
-PScore::do_connect(PCol *c1, PCol *c2, Real d, Real h)
-{
- if (!c1 || !c2 )
- return;
- Idealspacing*s_l=get_spacing(c1,c2);
-
-
- s_l->hooke = h;
- s_l->space =d;
-}
-
-void
-PScore::connect(PCol* c1, PCol *c2, Real d, Real h)
-{
- do_connect(c1,c2,d,h);
- do_connect(c1->postbreak_p_, c2,d,h);
- do_connect(c1, c2->prebreak_p_,d,h);
- do_connect(c1->postbreak_p_, c2->prebreak_p_,d,h);
-}
-
-void
-PScore::typeset_item(Item *i, PCol *c, PStaff *s, int breakstat)
-{
- assert(c && i && s);
-
- if (breakstat == 0) {
- typeset_item(i, c->prebreak_p_, s);
- return;
- }
-
- if (breakstat == 2) {
- typeset_item(i, c->postbreak_p_, s);
- return;
- }
-
-
- its.bottom().add(i);
- s->add(i);
- c->add(i);
-
- /* first do this, because i->width() may follow the 0-pointer */
- i->add_processing();
-}
-
-void
-PScore::typeset_spanner(Spanner*span_p, PStaff*ps)
-{
- span_p->pstaff_l_ = ps;
- spanners.bottom().add(span_p);
- ps->spans.bottom().add(span_p);
-
- // do not init start/stop fields. These are for broken spans only.
- span_p->add_processing();
-}
-
-
-void
-PScore::add(PCol *p)
-{
- p->pscore_l_ = this;
- if (p->breakable_b()){
- p->prebreak_p_->pscore_l_ = this;
- p->postbreak_p_->pscore_l_ = this;
- }
- cols.bottom().add(p);
-}
-
-PScore::PScore( Paper_def*p)
-{
- paper_l_ = p;
-}
-
-void
-PScore::output(Tex_stream &ts)
-{
- int l=1;
-
- ts << "\n "<< paper_l_->lookup_l()->texsetting << "%(Tex id)\n";
- for (iter_top(lines,lic); lic.ok(); lic++) {
- ts << "% line of score no. " << l++ <<"\n";
- ts << lic->TeXstring();
- if ((lic+1).ok())
- ts << "\\interscoreline\n";
- }
-}
-
-
-Array<Item*>
-PScore::select_items(PStaff*ps, PCol*pc)
-{
- Array<Item*> ret;
- assert(ps && pc);
- for (iter_top(pc->its,i); i.ok(); i++){
- if (i->pstaff_l_ == ps)
- ret.push((Item*)(const Item*)i);
- }
- return ret;
-}
-
-void
-PScore::OK()const
-{
-#ifdef NDEBUG
- for (iter_top(cols,cc); cc.ok(); cc++)
- cc->OK();
- for (iter_top(suz,i); i.ok(); i++)
- i->OK();
-#endif
-}
-
-void
-PScore::print() const
-{
-#ifndef NPRINT
- mtor << "PScore { ";
- paper_l_->print();
- mtor << "\ncolumns: ";
- for (iter_top(cols,cc); cc.ok(); cc++)
- cc->print();
-
- mtor << "\nideals: ";
- for (iter_top(suz,i); i.ok(); i++)
- i->print();
- mtor << "}\n";
-#endif
-}
-
-void
-PScore::preprocess()
-{
- for (iter_top(spanners,i); i.ok(); i++) {
- i->pre_processing();
- }
- for (iter_top(its,i); i.ok(); i++){
- i->pre_processing();
- }
-}
-
-void
-PScore::postprocess()
-{
- for (iter_top(broken_spans,i); i.ok(); i++) { // could chase spans as well.
- i->post_processing();
- }
- for (iter_top(its,i); i.ok(); i++){
- i->post_processing();
- }
-
- for (iter_top(broken_spans,i); i.ok(); i++) {
- i->molecule_processing();
- }
- for (iter_top(its,i); i.ok(); i++){
- i->molecule_processing();
- }
-
- for (iter_top(lines,i); i.ok(); i++)
- i->process();
-
-}
-
-PCursor<PCol *>
-PScore::find_col(const PCol *c)const
-{
- const PCol*what = c;
- if (what->daddy_l_ )
- what = what->daddy_l_;
-
- return cols.find((PCol*)what);
-}
-
-void
-PScore::add_broken(Spanner*s)
-{
- assert(s->left->line_l_ == s->right->line_l_);
- broken_spans.bottom().add(s);
- s->left->starters.bottom().add (s);
- s->right->stoppers.bottom().add (s);
-}
-
-void
-PScore::set_breaking(Array<Col_hpositions> breaking)
-{
- for (int j=0; j < breaking.size(); j++) {
- Array<PCol*> &curline(breaking[j].cols);
- Array<Real> &config(breaking[j].config);
-
- Line_of_score *s_p = new Line_of_score(curline,this);
- lines.bottom().add(s_p);
- for (int i=0; i < curline.size(); i++){
- curline[i]->hpos = config[i];
- }
- }
-}
-
-void
-PScore::calc_breaking()
-{
- Word_wrap w(*this);
- set_breaking(w.solve());
-}
-
-void
-PScore::process()
-{
- clean_cols();
- *mlog << "Preprocessing ... " <<flush;
- preprocess();
- *mlog << "\nCalculating column positions ... " <<flush;
- calc_breaking();
- *mlog << "\nPostprocessing ..." << endl;
- postprocess();
-}
+++ /dev/null
-#include "pstaff.hh"
-#include "molecule.hh"
-
-PStaff::PStaff(PScore*ps)
-{
- pscore_l_=ps;
-}
-
-void
-PStaff::add(Item *i)
-{
- its.bottom().add(i);
- i->pstaff_l_ = this;
-}
+++ /dev/null
-/*
- request.cc -- implement all musical requests.
-
- source file of the LilyPond music typesetter
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-
-#include "musicalrequest.hh"
-#include "misc.hh"
-#include "debug.hh"
-#include "script-def.hh"
-#include "text-def.hh"
-#include "voice.hh"
-#include "voice-element.hh"
-
-void
-Stem_req::do_print() const
-{
- Rhythmic_req::do_print();
- mtor << "dir : " << dir_i_;
-}
-
-Stem_req::Stem_req(int s, int d)
- : Rhythmic_req(s,d)
-{
- dir_i_ = 0;
-}
-
-/* ************** */
-void Musical_req::do_print()const{}
-void Request::do_print() const{}
-
-/* *************** */
-
-void
-Request::print() const
-{
- mtor << name() << " {";
- do_print();
- mtor << "}\n";
-}
-
-
-
-void
-Span_req::do_print() const
-{
-#ifndef NPRINT
- mtor << spantype ;
-#endif
-}
-
-Request::Request()
-{
- elt_l_ = 0;
- defined_ch_c_l_ = 0;
-}
-Request::Request(Request const&src)
-{
- elt_l_ = 0;
- defined_ch_c_l_ = src.defined_ch_c_l_;
-}
-/* *************** */
-Spacing_req::Spacing_req()
-{
- next = 0;
- distance = 0;
- strength = 0;
-}
-void
-Spacing_req::do_print()const
-{
-#ifndef NPRINT
- mtor << "next " << next << "dist " << distance << "strength\n";
-#endif
-}
-
-void
-Blank_req::do_print()const
-{
- Spacing_req::do_print();
-}
-/* *************** */
-Melodic_req::Melodic_req()
-{
- notename_i_ = 0;
- octave_i_ = 0;
- accidental_i_ = 0;
- forceacc_b_ = false;
-}
-
-void
-Melodic_req::do_print() const
-{
- mtor << "notename: " << notename_i_ << " acc: " <<accidental_i_<<" oct: "<< octave_i_;
-}
-
-int
-Melodic_req::height() const
-{
- return notename_i_ + octave_i_*7;
-}
-
-/*
- should be settable from input to allow "viola"-mode
- */
-static Byte pitch_byte_a[ 7 ] = { 0, 2, 4, 5, 7, 9, 11 };
-
-int
-Melodic_req::pitch() const
-{
- return pitch_byte_a[ notename_i_ % 7 ] + accidental_i_ + octave_i_ * 12;
-}
-
-Plet_req::Plet_req()
-{
- type_c_ = ']';
- dur_i_ = 1;
- type_i_ = 1;
-}
-
-void
-Plet_req::do_print() const
-{
- mtor << "plet: " << type_c_ << ": " << dur_i_ << "/" << type_i_;
-}
-
-/* *************** */
-int
-Rhythmic_req::compare(const Rhythmic_req &r1, const Rhythmic_req &r2)
-{
- return sign(r1.duration() - r2.duration());
-}
-Rhythmic_req::Rhythmic_req(int b, int d)
-{
- plet_factor = 1;
- balltype = b;
- dots = d;
-}
-
-Rhythmic_req::Rhythmic_req()
-{
- plet_factor = 1;
- balltype = 1;
- dots = 0;
-}
-
-void
-Rhythmic_req::do_print() const
-{
- mtor << "ball: " << balltype ;
- int d =dots;
- while (d--)
- mtor << '.';
-
- mtor<<", plet factor"<<plet_factor<<"\n";
-}
-
-
-Moment
-Rhythmic_req::duration() const {
- return wholes(balltype,dots)*plet_factor;
-}
-/* *************** */
-
-Lyric_req::Lyric_req(Text_def* def_p)
- :Text_req(0, def_p)
-{
- def_p->align_i_ = 0; // centre
- dir_i_ = -1; // lyrics below (invisible) staff
-}
-
-void
-Lyric_req::do_print() const
-{
- Rhythmic_req::do_print();
- Text_req::do_print();
-}
-/* *************** */
-void
-Note_req::do_print() const
-{
- Melodic_req::do_print();
- Rhythmic_req::do_print();
-}
-/* *************** */
-void
-Rest_req::do_print() const
-{
- Rhythmic_req::do_print();
-}
-
-/* *************** */
-Beam_req::Beam_req()
-{
- nplet = 0;
-}
-
-void Beam_req::do_print()const{}
-/* *************** */
-void Slur_req::do_print()const{}
-/* *************** */
-int
-Span_req:: compare(const Span_req &r1, const Span_req &r2)
-{
- return r1.spantype - r2.spantype;
-}
-
-Span_req::Span_req()
-{
- spantype = NOSPAN;
-}
-
-/* *************** */
-Script_req::Script_req(int d , Script_def*def)
-{
- dir_i_ = d;
- scriptdef_p_ = def;
-}
-
-int
-Script_req::compare(const Script_req &d1, const Script_req &d2)
-{
- return d1.dir_i_ == d2.dir_i_ &&
- d1.scriptdef_p_->compare(*d2.scriptdef_p_);
-}
-
-Script_req::Script_req(Script_req const &s)
- : Request( s )
-{
- dir_i_ = s.dir_i_;
- scriptdef_p_ = new Script_def(*s.scriptdef_p_);
-}
-
-void
-Script_req::do_print() const
-{
- mtor << " dir " << dir_i_ ;
- scriptdef_p_->print();
-}
-
-
-Script_req::~Script_req()
-{
- delete scriptdef_p_;
-}
-/* *************** */
-int
-Text_req:: compare(const Text_req &r1, const Text_req &r2)
-{
- bool b1 = (r1.dir_i_ == r2.dir_i_);
- bool b2 = (r1.tdef_p_ ->compare(*r2.tdef_p_));
- return b1 && b2;
-}
-Text_req::~Text_req()
-{
- delete tdef_p_;
- tdef_p_ = 0;
-}
-
-Text_req::Text_req(Text_req const& src)
-{
- tdef_p_ = new Text_def(*src.tdef_p_);
- dir_i_ = src.dir_i_;
-}
-
-Text_req::Text_req(int dir_i, Text_def* tdef_p)
-{
- dir_i_ = dir_i;
- tdef_p_ = tdef_p;
-}
-
-void
-Text_req::do_print() const
-{
- mtor << " dir " << dir_i_ ;
- tdef_p_->print();
-}
-
-/* *************** */
-
-Moment
-Skip_req::duration() const
-{
- return duration_;
-}
-
-void
-Skip_req::do_print() const
-{
- mtor << "duration: " << duration();
-}
-
-Voice *
-Request::voice_l()
-{
- if (!elt_l_)
- return 0;
- else
- return (Voice*)elt_l_->voice_l_;
-}
-/* *************** */
-
-void
-Subtle_req::do_print() const
-{
- mtor << " subtime " << subtime_;
-}
-
-void
-Dynamic_req::do_print() const
-{
- Subtle_req::do_print();
-}
-
-void
-Absolute_dynamic_req::do_print() const
-{
- Dynamic_req::do_print();
- mtor << " loudness_" <<loudness_;
-}
-
-String
-Dynamic_req::loudness_str(Loudness l)
-{
- switch (l) {
- case FFF: return "fff";
- case FF: return "ff";
- case F: return "f";
- case MF: return "mf";
- case MP: return "mp";
- case P: return "p";
- case PP: return "pp";
- case PPP: return "ppp";
- }
- assert(false);
- return "";
-}
-
-Absolute_dynamic_req::Absolute_dynamic_req()
-{
- loudness_ = MF;
-}