--- /dev/null
+% pavane pour une Infante d\'efunte
+%
+% M. Ravel
+%
+% (Ravel has been dead for over 50 years. This does not have copyright)
+%
+
+horn = melodicstaff {
+ $
+ \octave { 'c }
+ \duration { 8}
+
+% 1
+ d2( [)d e cis `b] `a4 [`b cis] [cis `b] `b4
+ fis2( [)fis g e d] cis4 [d e(] [)e fis d cis]
+ `b4 [cis d(] [)d e cis `b] cis2 r2
+ r4 fis2 fis4 fis2()[fis e a fis]
+ fis4 e4 d4 e4 `b2()[`b `a( d cis]
+% 11
+ )`b [`fis `a `b] cis4 `b4 `fis2 r2
+ cis4 d4()[d cis d e]
+\octave { c }
+ a4 gis2.
+ a4 b4()[b a b cis] fis4 e4 cis2
+ e4 fis4 () [fis e fis gis] cis4 `b4()`b8 r8 r4
+
+ r4 r4 'cis4 'd4 () ['d 'cis 'd 'e]
+ a4 gis2. a4 b4()[b a b cis]
+ fis4 e4 cis2 e4 fis4()[fis e fis gis]
+ cis4 `b4()`b8 r8 r4 r1
+ r2 r4 r4
+%% cut 'n paste.
+ \octave { 'c }
+ d2( [)d e cis `b] `a4 [`b cis] [cis `b] `b4
+ fis2( [)fis g e d] cis4 [d e(] [)e fis d cis]
+ `b4 [cis d(] [)d e cis `b] cis2 r2
+ r4 fis2 fis4 fis2()[fis e a fis]
+ fis4 e4 d4 e4 `b2() [`b `a d cis]
+ `b [`fis `a `b] cis4 `b4 `fis2 r2
+ $
+ commands {
+ key $fis cis $
+ }
+}
+
+score {
+ staff { horn }
+ paper { unitspace 2.2 cm
+ geometric 1.5
+ }
+ commands { meter 4 4
+ skip 18:0
+ meter 2 4
+ skip 1:0
+ meter 4 4
+ skip 20:0
+ }
+}
\ No newline at end of file
#include "paper.hh"
#include "sccol.hh"
#include "debug.hh"
+#include "dimen.hh"
void
-Score::do_connect(PCol *c1, PCol *c2, Real d)
+Score::do_connect(PCol *c1, PCol *c2, Real d, Real h)
{
+ if (!c1 || !c2 )
+ return;
Idealspacing*sp=pscore_->get_spacing(c1,c2);
if (!sp->hooke){
- sp->hooke = 1.0;
+ sp->hooke = h;
sp->space =d;
}
}
void
-Score::connect_nonmus(PCol* c1, PCol *c2, Real d)
+Score::connect(PCol* c1, PCol *c2, Real d, Real h)
{
if (c2->used() && c1->used()) {
- do_connect(c1,c2,d);
-
- // alert! this is broken!
- if (c1->breakable()) {
- do_connect(c1->postbreak, c2,d);
- }
- if (c2->breakable()) {
- do_connect(c1, c2->prebreak,d);
- }
- if (c1->breakable() &&c2->breakable()) {
- do_connect(c1->postbreak, c2->prebreak,d);
- }
+ do_connect(c1,c2,d,h);
+ do_connect(c1->postbreak, c2,d,h);
+ do_connect(c1, c2->prebreak,d,h);
+ do_connect(c1->postbreak, c2->prebreak,d,h);
}
}
+
/* this needs A LOT of rethinking.
generate springs between columns.
void
Score::calc_idealspacing()
{
- PCursor<Score_column*> sc(cols_);
+ PCursor<Score_column*> i(cols_);
- for (; sc.ok(); sc++) {
- if (sc->musical)
- for (int i=0; i < sc->durations.sz(); i++) {
- Real d = sc->durations[i];
+ for (; i.ok(); i++) {
+
+ PCursor<Score_column*> j (i+1);
+ if (i->musical) {
+ for (int n=0; n < i->durations.sz(); n++) {
+ Real d = i->durations[n];
Real dist = paper_->duration_to_dist(d);
- PCol * c2 = find_col(sc->when + d,true)->pcol_;
- connect_nonmus(sc->pcol_, c2, dist);
- c2 = find_col(sc->when + d,false)->pcol_;
- connect_nonmus(sc->pcol_, c2, dist);
+ while (d + i->when > j->when)
+ j++;
+
+ if (j->used())
+ connect(i->pcol_, j->pcol_, dist);
+ if (!j->musical && (j+1)->used && (j+1)->when == j->when) {
+ j++;
+ connect(i->pcol_, j->pcol_, dist);
+ }
+ }
+ } else if (i->used()) {
+
+ /* attach i to the next column in use. This exists, since
+ the last col is breakable, and therefore in use
+ */
+ for (;j.ok(); j++) {
+ if (j->used()) {
+ Real d = j->when - i->when;
+ Real dist = (d) ? paper_->duration_to_dist(d) :
+ convert_dimen(2,"pt");
+
+ connect(i->pcol_, j->pcol_, dist, (d) ? 1.0:1.0);
+ break;
+ }
}
- else if (sc->used()) { // ignore empty columns
- PCol * c2 = find_col(sc->when,true)->pcol_;
- connect_nonmus(sc->pcol_, c2, 0.0);
+ // !j.ok() might hold if we're at the last col.
}
}
}