]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.1.55
authorfred <fred>
Sun, 24 Mar 2002 20:09:34 +0000 (20:09 +0000)
committerfred <fred>
Sun, 24 Mar 2002 20:09:34 +0000 (20:09 +0000)
VERSION
input/sleur.ly
lily/slur.cc
lily/template6.cc
lily/template7.cc

diff --git a/VERSION b/VERSION
index 3729e0a8d1f0337fdb5e3d098abadbeac3469d70..5532217ea84aa7deadcfc48916df13bb261ac717 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1,6 +1,6 @@
 MAJOR_VERSION=0
 MINOR_VERSION=1
-PATCH_LEVEL=54
+PATCH_LEVEL=55
 MY_PATCH_LEVEL=
 
 # now used as shell script in configure too
index 0f53a82adca8923e543f5f237109fcaefe8a94ea..964e05a0cae6296f14580c54eb35f4f57cb5a873 100644 (file)
@@ -32,14 +32,15 @@ beum = \melodic{
 }
 
 extend = \melodic{
-         c8(( c c )c c c c )c |
-         \[4/5c8( c c' c )c\]1/1 c c c c |
-         \[4/5c8( c c c c'\]1/1 c c c )c |
-         \[4/5c8( c c c c''\]1/1 c c c )c' |
-         \[4/5c8( c c c c'\]1/1 c c c )'c |
-         \[4/5c8( c c' c c\]1/1 c c c )c |
-         \[4/5c8( c c c ''c\]1/1 c c c )c |
-         \[4/5c8( c ''c c c\]1/1 c c c )c |
+       \octave c;
+       c8(( c c )c c c c )c |
+       \[4/5c8( c c' c )c\]1/1 c c c c |
+       \[4/5c8( c c c c'\]1/1 c c c )c |
+       \[4/5c8( c c c c''\]1/1 c c c )c' |
+       \[4/5c8( c c c c'\]1/1 c c c )'c |
+       \[4/5c8( c c' c c\]1/1 c c c )c |
+       \[4/5c8( c c c ''c\]1/1 c c c )c |
+       \[4/5c8( c ''c c c\]1/1 c c c )c |
 }
 
 extendbug = \melodic{
@@ -49,10 +50,36 @@ extendbug = \melodic{
        [c'8( b g a] [c' d' e' c'] [c' d' e' )c']
        c( c' c' )c
        e( g' g' )e
+
+}
+
+blend = \melodic{
+       \octave c; 
+       \stemdown; 
+%%         \[4/5c8( c ''c c c\]1/1 c c c )c |
+       \[4/5c8( c ''f c c\]1/1 c c c )c |
+       \[4/5c8( c \stemup ''f \stemdown c c\]1/1 c c c )c |
+       \stemup; 
+       \octave c''; 
+       \[4/5c8( c f'' c c\]1/1 c c c )c |
+       \[4/5c8( c \stemdown f'' \stemup c c\]1/1 c c c )c |
+%          \octave c''';
+       \stemboth;
+       c4( 'c16 'e 'g 'b d f a )'c16 c4 |
+       c4( 'c16 'e 'g 'b d f f )'c16 c4 |
+       \octave c'; 
+       \stemdown; 
+       c( c'' c'' )c
+       \stemboth;
+       e( g' g' )e
+       e( g' g' )e
+       e( g' g' )e
+       e( g' g' )e
 }
 
 \score{
        \melodic{ 
+               \blend
                \shortlong
                \dirs
                \complex
index e1a8cf926bf8d9cdd0bfeb97cd8c8fe7c63ef5e2..8ec8633b5d59d0e09791e9fcc19089341dc2cba7 100644 (file)
@@ -22,6 +22,7 @@
 #include "molecule.hh"
 #include "debug.hh"
 #include "boxes.hh"
+#include "bezier.hh"
 
 void
 Slur::add (Note_column*n)
@@ -130,48 +131,116 @@ Slur::do_post_processing ()
   while (flip(&d) != LEFT);
 }
 
+static Real
+pos_correct (Real x, Real dx, Real dy)
+{
+  /*
+    guess how much we can safely increase 'h'
+    parameter of bow without taking too large
+    or too many steps.
+    empiric computer science
+   */
+//  return (1.0 + 2.0 * x / dx) / 4.0;
+  return 1.0;
+}
+
 Real
 Slur::height_f () const
 {
+  Real interline = paper ()->interline_f ();
+  Real notewidth = paper ()->note_width ();
+  Real internote = interline / 2;
+
   /*
-   rather braindead way that of adjusting slur height 
-   for heads/stems that extend beyond default slur
-   works quite good
+   having the correct (i.e. exactly the same as the ps stuff)
+   x,y coordinates is essential.
+   getting them is quite a mess, currently.
    */
 
-  Real interline_f = paper ()->interline_f ();
-  Real nh_f = interline_f / 2;
-  Real h = 0;
+  Stem* left_stem =encompass_arr_[0]->stem_l_; 
+  Real left_x = left_stem->hpos_f ();
+  // ugh, do bow corrections (see brew_mol)
+  left_x += dx_f_drul_[LEFT] + 0.5 * notewidth;
+
+//  Real left_y = left_stem->dir_ == dir_ ? left_stem->stem_end_f () + dir_
+//    : left_stem->stem_begin_f () + 0.5 * dir_;
+//  left_y *= internote;
+  // ugh, do bow corrections (see brew_mol)
+//  left_y = dy_f_drul_[LEFT];
+
+  // ugh, do bow corrections (see brew_mol)
+  Real left_y = dy_f_drul_[LEFT];
+
+  // ugh, where does this asymmetry come from?
+  if (dir_ == DOWN)
+    left_y -= dir_ * internote;
+
   Real dx = width ().length ();
-//  Real dy = (dy_f_drul_[RIGHT] - dy_f_drul_[LEFT]) * nh_f;
   Real dy = (dy_f_drul_[RIGHT] - dy_f_drul_[LEFT]);
-  Stem* stem = encompass_arr_[0]->stem_l_;
-  Real lx = stem->hpos_f ();
-  Real centre = (width ().min () + width ().max ()) / 2 + lx;
-  Real ly = stem->dir_ == dir_ ? stem->stem_end_f () : stem->stem_begin_f () 
-    + dir_ * 0.5;
-  ly *= nh_f;
-  for (int i = 0; i < encompass_arr_.size (); i++) 
+  Real centre_x = dx / 2;
+
+
+  // ugh, need staffheight for bow damping
+  Bezier_bow b (paper ());
+
+  if (check_debug && !monitor->silent_b ("Slur"))
     {
-      Stem* s = encompass_arr_[i]->stem_l_;
-      Real sx = abs (centre - s->hpos_f ());
-      Real stemy = s->dir_ == dir_ ? s->stem_end_f () : s->stem_begin_f () + dir_ * 0.5;
-      stemy *= nh_f;
-      Real sy = dir_ * (stemy - (ly + ((s->hpos_f () - lx) / dx) * dy));
-      /*
-        uhm, correct for guess bezier curve (more if further from centre)
-        forget the cos alpha...
-       */
-      if (sy > 0.5 * nh_f)
-       h = h >? (sy * (1 + 2 * sx / dx))*(1 + abs (dy)/32);
+      cout << "*****************" << endl;
+      cout << "dir: " << (int)dir_ << endl;
+      cout << "dx: " << dx << endl;
+      cout << "dy: " << dy << endl;
+      cout << "centre: " << centre_x << endl;
+      for (int i = 0; i < encompass_arr_.size (); i++)
+       cout << "i: " << i << " x: " 
+           << encompass_arr_[i]->stem_l_->hpos_f () - left_x << endl;
     }
-    if ( h < nh_f )
-      return 0;
-  h *= h/(dx*dx*dx);
-//  h *= 32;
-//  h *= h;
-  h *= 40000;
-  return h;
+  Real height = 0;
+  Real dh = 0;
+  do
+    {
+      height += dh;
+      dh = 0;
+      b.calc (dx, dy, height, dir_);
+      
+      if (check_debug && !monitor->silent_b ("Slur"))
+        cout << "----" << endl;
+      for (int i = 1; i < encompass_arr_.size () - 1; i++) 
+       {
+         Stem* stem = encompass_arr_[i]->stem_l_;
+         /* 
+           set x to middle of notehead or on exact x position of stem,
+           according to slur direction
+          */
+         Real x = stem->hpos_f () - left_x + notewidth / 2;
+         if (stem->dir_ != dir_)
+           x += notewidth / 2;
+         else if (stem->dir_ == UP)
+           x += notewidth;
+         Real y = stem->dir_ == dir_ ? stem->stem_end_f ()
+           : stem->stem_begin_f () + 1.5 * dir_;
+
+         /*
+           leave a gap: slur mustn't touch head/stem
+          */
+         y += 2.5 * dir_;
+         y *= internote;
+         y -= left_y;
+
+         Real shift = dir_ * (y - b.y (x));
+
+         if (check_debug && !monitor->silent_b ("Slur"))
+           {
+             cout << "x: " << x << " (" << abs (centre_x - x) << ")" << endl;
+             cout << "y: " << y << ", curve: " << b.y (x) << endl;
+             cout << "shift: " << shift << endl;
+           }
+
+         if (shift > 0.1 * internote)
+           dh = dh >? shift * pos_correct (abs (centre_x - x), dx, dy);
+       }
+    } while (dh);
+
+  return height;
 }
 
 IMPLEMENT_IS_TYPE_B1(Slur,Spanner);
index 4f7a1ed1ab8c9bd0ea6abbc907b1d5f0c6888ed2..3785014d698c26567cdd113f70ab80eb9400286b 100644 (file)
@@ -1,4 +1,5 @@
 #include "proto.hh"
+#include "pcursor.tcc"
 #include "plist.tcc"
 #include "translator.hh"
 
index 7b5d8142ed67fbf1a02505f9b1353504023d0a4a..868573a37494fdcd586f705f1e0d54f37e67c7cb 100644 (file)
@@ -7,8 +7,8 @@
 */
 
 #include "proto.hh"
-#include "plist.hh"
 #include "pcursor.tcc"
+#include "plist.hh"
 #include "plist.tcc"
 
 #include "music-list.hh"