--- /dev/null
+#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 "<<type;
+ Item::print();
+}
Real miny;
int no_beams;
+ ///////////////
+
Stem_info(){}
Stem_info(const Stem*);
};
sc->dir = dir;
}
}
-
+/*
+ should use minimum energy formulation (cf linespacing)
+ */
void
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;
}
}
while (i < breakpoints.sz()) {
// add another measure.
- while(breakpoints[i] !=curcol){
+ while (breakpoints[i] != curcol.ptr()){
current.add(curcol);
curcol++;
minimum = current;
} else { // we're one col too far.
i--;
- while (curcol != breakpoints[i])
+ while (curcol.ptr() != breakpoints[i])
curcol --;
break;
--- /dev/null
+#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<int> 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);
+ }
+}
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;
parse();
linewidth = convert_dimen(15,"cm"); // in cm for now
whole_width= 8*note_width();
- geometric_ = PHI;
+// geometric_ = PHI;
+ geometric_ = sqrt(2);
}
void
Text_db symini("symbol.ini");
- while (!symini.eof()) {
-
+ while (!symini.eof()) {
Text_record r( symini++);
if (r[0] == "symboltables")
Note_req::Note_req()
{
- name = 'c';
+ name = 0;
octave = 0;
accidental = 0;
forceacc = false;
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()
{
Score_column* sc = score_->find_col(w,mus);
assert(sc->when == w);
- PCursor<Staff_column *> stc(cols);
- for (; stc.ok(); stc++) {
- if (*stc->score_column > *sc) // too far
+
+ PCursor<Staff_column *> 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;
}
#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);
#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);
{
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());
}