From b6133ccc91e69deeb45c0861dfd6aaee734d6807 Mon Sep 17 00:00:00 2001 From: fred Date: Fri, 15 Nov 1996 23:49:15 +0000 Subject: [PATCH] lilypond-0.0.10 --- src/accidental.cc | 32 ++++++++++++++++++++++++++++++ src/beam.cc | 21 ++++++++++++-------- src/break.cc | 4 ++-- src/keyitem.cc | 50 +++++++++++++++++++++++++++++++++++++++++++++++ src/note.cc | 5 +---- src/paper.cc | 6 +++--- src/request.cc | 7 ++----- src/staff.cc | 26 ++++++++++++++---------- src/template1.cc | 18 ++++++++--------- src/template2.cc | 11 ++++++----- src/voice.cc | 2 +- 11 files changed, 135 insertions(+), 47 deletions(-) create mode 100644 src/accidental.cc create mode 100644 src/keyitem.cc diff --git a/src/accidental.cc b/src/accidental.cc new file mode 100644 index 0000000000..eb3ca7c7e3 --- /dev/null +++ b/src/accidental.cc @@ -0,0 +1,32 @@ +#include "accidental.hh" +#include "debug.hh" +#include "molecule.hh" +#include "paper.hh" +#include "lookup.hh" + +Accidental::Accidental(int t, int p) +{ + type = t; + pos = p; +} + +void +Accidental::preprocess() +{ + brew_molecole(); +} + +void +Accidental::brew_molecole() +{ + Symbol s =paper()->lookup_->accidental(type); + output = new Molecule(Atom(s)); + output->translate(Offset(0, pos * paper()->interline()/2)); +} + +void +Accidental::print()const +{ + mtor << "Accidental "<dir = dir; } } - +/* + should use minimum energy formulation (cf linespacing) + */ void Beam::solve_slope() { @@ -88,13 +92,14 @@ Beam::solve_slope() left_pos *= dir; slope *= dir; - {Real inter =paper()->interline()/2; - Real unitslope = slope*inter; - - // set beamslope, for setting stems correctly - // ignoring return. - Symbol sy = paper()->lookup_->beam(unitslope, width().length()); - slope =unitslope / inter; + { + Real inter =paper()->interline()/2; + Real unitslope = slope*inter; + + // set beamslope, for setting stems correctly + // ignoring return. + Symbol sy = paper()->lookup_->beam(unitslope, width().length()); + slope =unitslope / inter; } } diff --git a/src/break.cc b/src/break.cc index de9a704984..6cb1d3303b 100644 --- a/src/break.cc +++ b/src/break.cc @@ -100,7 +100,7 @@ PScore::calc_breaking() while (i < breakpoints.sz()) { // add another measure. - while(breakpoints[i] !=curcol){ + while (breakpoints[i] != curcol.ptr()){ current.add(curcol); curcol++; @@ -118,7 +118,7 @@ PScore::calc_breaking() minimum = current; } else { // we're one col too far. i--; - while (curcol != breakpoints[i]) + while (curcol.ptr() != breakpoints[i]) curcol --; break; diff --git a/src/keyitem.cc b/src/keyitem.cc new file mode 100644 index 0000000000..d02ed700af --- /dev/null +++ b/src/keyitem.cc @@ -0,0 +1,50 @@ +#include "keyitem.hh" +#include "key.hh" +#include "debug.hh" +#include "molecule.hh" +#include "paper.hh" +#include "lookup.hh" + + +Keyitem::Keyitem(int c) +{ + c_position = c; +} + + +void +Keyitem::read(svec s) +{ + for (int i = 0 ; i< s.sz(); ) { + int note = s[i++]; + int acc = s[i++]; + + add(note, acc); + } +} +void +Keyitem::add(int p, int a) +{ + pitch.add(p); + acc.add(a); +} + +void +Keyitem::preprocess() { + brew_molecole(); +} + +void +Keyitem::brew_molecole() +{ + output = new Molecule; + Real inter = paper()->interline()/2; + + for (int i =0; i < pitch.sz(); i++) { + Symbol s= paper()->lookup_->accidental(acc[i]); + Atom a(s); + a.translate(Offset(0,c_position + pitch[i] * inter)); + Molecule m(a); + output->add_right(m); + } +} diff --git a/src/note.cc b/src/note.cc index 0041bb7238..1c1a4cb571 100644 --- a/src/note.cc +++ b/src/note.cc @@ -105,10 +105,7 @@ get_note_element(String pitch, String durstr) int oct, pit, acc; bool forceacc; parse_pitch(pitch, i, oct, forceacc, pit, acc); - char nm = pit + 'c'; - if (nm > 'g') - nm += 'a' - 'h'; - rq->name =nm; + rq->name =pit; rq->octave = oct; rq->accidental = acc; diff --git a/src/paper.cc b/src/paper.cc index 8cd98339d4..2b98eef988 100644 --- a/src/paper.cc +++ b/src/paper.cc @@ -31,7 +31,8 @@ Paperdef::Paperdef() parse(); linewidth = convert_dimen(15,"cm"); // in cm for now whole_width= 8*note_width(); - geometric_ = PHI; +// geometric_ = PHI; + geometric_ = sqrt(2); } void @@ -40,8 +41,7 @@ Paperdef::parse() Text_db symini("symbol.ini"); - while (!symini.eof()) { - + while (!symini.eof()) { Text_record r( symini++); if (r[0] == "symboltables") diff --git a/src/request.cc b/src/request.cc index 9928f62bed..6f3778a66d 100644 --- a/src/request.cc +++ b/src/request.cc @@ -27,7 +27,7 @@ Request::Request() Note_req::Note_req() { - name = 'c'; + name = 0; octave = 0; accidental = 0; forceacc = false; @@ -36,10 +36,7 @@ Note_req::Note_req() int Note_req::height() const { - int s = name -'c'; - if (s < 0) - s+=7; - return s + octave*7; + return name + octave*7; } Rhythmic_req::Rhythmic_req() diff --git a/src/staff.cc b/src/staff.cc index 3a32801b2f..4b3322fcef 100644 --- a/src/staff.cc +++ b/src/staff.cc @@ -36,30 +36,36 @@ Staff::get_col(Real w, bool mus) { Score_column* sc = score_->find_col(w,mus); assert(sc->when == w); - PCursor stc(cols); - for (; stc.ok(); stc++) { - if (*stc->score_column > *sc) // too far + + PCursor i(cols); + for (; i.ok(); i++) { + if (*i->score_column > *sc) // too far break; - if (sc == stc->score_column) - return stc; + if (sc == i->score_column) + return i; } + /* post: *sc > *->score_column || !i.ok() */ Staff_column* newst = create_col(sc); - if (!stc.ok()) { + if (!i.ok()) { cols.bottom().add(newst); return cols.bottom(); } if (mus) { - stc.insert(newst); + i.insert(newst); return newst; } - if ((stc-1)->when() == newst->when()) { - stc--; +// ; assert((i-1).ok()) + // todo! + + // making a fix at 2:30 am, with several beers drunk. + if ((i-1).ok()&& (i-1)->when() == newst->when()) { + i--; } - stc.insert(newst); + i.insert(newst); return newst; } diff --git a/src/template1.cc b/src/template1.cc index fd2431130e..e2bae216b6 100644 --- a/src/template1.cc +++ b/src/template1.cc @@ -12,14 +12,14 @@ #include "plist.cc" #include "cursor.cc" -#define PLC_instantiate(a) PL_instantiate(a); PL_instantiate(const a) +#define IPLC_instantiate(a) IPL_instantiate(a); PL_instantiate(const a) -L_instantiate(Stem*); -PLC_instantiate(Line_of_score); -PLC_instantiate(Line_of_staff); -PLC_instantiate(Item); -PLC_instantiate(Spanner); -PLC_instantiate(PStaff); -PLC_instantiate(Idealspacing); -PLC_instantiate(PCol); +IPLC_instantiate(Stem*); +IPLC_instantiate(Line_of_score); +IPLC_instantiate(Line_of_staff); +IPLC_instantiate(Item); +IPLC_instantiate(Spanner); +IPLC_instantiate(PStaff); +IPLC_instantiate(Idealspacing); +IPLC_instantiate(PCol); diff --git a/src/template2.cc b/src/template2.cc index 01695c863f..a4ce99da1f 100644 --- a/src/template2.cc +++ b/src/template2.cc @@ -10,10 +10,11 @@ #include "list.cc" #include "plist.cc" #include "cursor.cc" -PL_instantiate(Score_column); -PL_instantiate(Staff_column); -PL_instantiate(Staff); -PL_instantiate(Voice_element); -PL_instantiate(Voice); + +IPL_instantiate(Score_column); +IPL_instantiate(Staff_column); +IPL_instantiate(Staff); +IPL_instantiate(Voice_element); +IPL_instantiate(Voice); diff --git a/src/voice.cc b/src/voice.cc index 14883e1499..c713822a4b 100644 --- a/src/voice.cc +++ b/src/voice.cc @@ -72,7 +72,7 @@ Voice_element::Voice_element(Voice_element const&src) { duration=src.duration; voice=src.voice; - PointerList__copy(Request*, reqs, src.reqs, clone()); + IPointerList__copy(Request*, reqs, src.reqs, clone()); group=src.group; assert(!granted_items.size() && !granted_spanners.size()); } -- 2.39.5