From 82e7d1f82e34f2b9d912722cc735f2f98922d46d Mon Sep 17 00:00:00 2001 From: fred Date: Sun, 24 Mar 2002 19:28:19 +0000 Subject: [PATCH] lilypond-0.0.23 --- input/maartje.ly | 74 +++++++++++++++++++++++++++++++++++++++++++++++ src/inputscore.cc | 17 +++++++++-- src/staff.cc | 48 +++++++++++++++++++++++++----- 3 files changed, 129 insertions(+), 10 deletions(-) create mode 100644 input/maartje.ly diff --git a/input/maartje.ly b/input/maartje.ly new file mode 100644 index 0000000000..894118206d --- /dev/null +++ b/input/maartje.ly @@ -0,0 +1,74 @@ +ritme = staff {rhythmic + music {$ + c8 + |[a8() a8. a8 a16 a16 a16] c4. + + %[c8( )'a8() c8 c8]% BUG! + |c2 c2 + + |[fis16 'dis16( fis16 'dis16 ][fis16) 'dis16 fis16 'dis16] + | r32 r32 r16 r8 r4 r2 + |[c8. c16] [c16 c8.] [c16 c16 c8] [c16 c8 c16] + + c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 + + $} +} + +melody= +staff { melodic + music{$ + c8 + |r4 r4 r4 r4 + |'cis2.. r8 + | r4 r8 r16 r32 r32 + + \duration {4} + { + \music { c () `bes [c8 c8] } + \music { 'fis ()'gisis fis8 fis8 } + \music { d () d dis8 dis8 } + \music { a () bes eis8 eis8 } + \music { fis () g gis8 gis8 } + } + { c4 'c4 } + + [d8 e8 'f8 g8] d8 e8 f8 g8 + |''fis2 + | a8 b8 'c8 'd8 |''c8 ```c8 c4 |c4 c4 |c4 + \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 3:0 + key $ fis cis gis $ + skip 2:0 + key + skip 5:0 + clef bass + } +} + +score { + paper { + geometric 1.4 + unitspace 3.0 cm + } + staff { ritme } + staff { melody } + commands { + meter 4* 4 + partial 8 + skip 1:2 + bar ":|:" + skip 2:0 + meter 2* 4 + skip 19:0 + } +} + + + diff --git a/src/inputscore.cc b/src/inputscore.cc index cdc348c725..28e1f71599 100644 --- a/src/inputscore.cc +++ b/src/inputscore.cc @@ -4,6 +4,7 @@ #include "inputstaff.hh" #include "score.hh" #include "paper.hh" +#include "staff.hh" void Input_score::add(Array &s) @@ -25,17 +26,27 @@ Input_score::set(Paperdef*p) delete paper_; paper_ = p; } +Input_score::Input_score(Input_score const&) +{ + assert(false); +} Score* Input_score::parse() { Paperdef* paper_p=new Paperdef(*paper_); Score *s_p = new Score(paper_p); - + s_p->define_spot_str_ = define_spot_str_; + Array parsed_staffs; for (iter_top(staffs_,i); i.ok(); i++) { - Staff* staf_p=i->parse(commands_, s_p); + Staff* staf_p=i->parse(s_p); + parsed_staffs.add(staf_p); s_p->add(staf_p); } + int j = 0; + for (iter_top(staffs_,i); i.ok(); i++,j++) { + parsed_staffs[j]->do_commands(commands_, i->commands_); + } return s_p; } @@ -54,9 +65,11 @@ Input_score::Input_score() void Input_score::print()const { + #ifndef NPRINT mtor << "Input_score {\n"; for (iter_top(staffs_,i); i.ok(); i++) { i->print(); } mtor << "}\n"; +#endif } diff --git a/src/staff.cc b/src/staff.cc index ef54dbe466..c6a65e016e 100644 --- a/src/staff.cc +++ b/src/staff.cc @@ -6,6 +6,22 @@ #include "sccol.hh" #include "staffcommands.hh" #include "debug.hh" +#include "inputcommands.hh" +#include "inputcommand.hh" +#include "request.hh" + +void +Staff::do_commands(PointerList score_wide, + PointerList staff_wide) +{ + Input_commands commands; + for (iter_top(score_wide,i); i.ok(); i++) + commands.add(**i, score_l_->markers_assoc_); + for (iter_top(staff_wide,i); i.ok(); i++) + commands.add(**i,score_l_->markers_assoc_); + + commands.parse(this); +} void Staff::add(PointerList &l) @@ -19,7 +35,9 @@ Staff::truncate_cols(Moment l) { iter_bot(cols, i); for (; i->when() > l; i=cols.bottom()) { - i.del(); + Staff_column * col_p = i.get(); + assert(col_p->when() > l); + delete col_p; } } @@ -35,7 +53,7 @@ Staff::clean_cols() iter_top(cols,i); for(; i.ok(); ){ if (!i->score_column_l_->used()) - i.del(); + delete i.get(); else i++; } @@ -80,8 +98,22 @@ Staff::get_col(Moment w, bool mus) return newst; } - - +void +Staff::get_marks(Array&s_arr, Array&m_arr) +{ + for (iter_top(voices,i); i.ok(); i++) { + Moment now = i->start; + for (iter_top(i->elts,j); j.ok(); j++) { + for (iter_top(j->reqs, k); k.ok(); k++) { + if (k->mark()) { // ugh. 4 levels + s_arr.add(k->mark()->mark_str_); + m_arr.add(now); + } + } + now += j->duration; + } + } +} /* put all stuff grouped vertically in the Staff_cols */ @@ -90,11 +122,11 @@ Staff::setup_staffcols() { for (iter_top(voices,i); i.ok(); i++) { Moment now = i->start; - for (iter_top(i->elts,ve); ve.ok(); ve++) { + for (iter_top(i->elts,j); j.ok(); j++) { - Staff_column *sc=get_col(now,true); - sc->add(ve); - now += ve->duration; + Staff_column *s_l=get_col(now,true); + s_l->add(j); + now += j->duration; } } set_time_descriptions(); -- 2.39.5