]> git.donarmstrong.com Git - lilypond.git/commitdiff
Update to dashed-slur package
authorCarl Sorensen <c_sorensen@byu.edu>
Sat, 18 Apr 2009 21:12:20 +0000 (15:12 -0600)
committerCarl Sorensen <c_sorensen@byu.edu>
Sat, 18 Apr 2009 21:12:20 +0000 (15:12 -0600)
Eliminate Bezier & arguments to Bezier::subdivide and
replace with Bezier *

Add support for dashed parenthesis arpeggios.

Add error checking for Bezier::extract arguments.

Remove unnecessary {} and clean up comments.

Update convert-ly rule.

Make Bezier::subdivide and Bezier::extract const functions.

Add complex dashed ties to documentation.

Documentation/user/expressive.itely
Documentation/user/rhythms.itely
input/new/making-slurs-with-complex-dash-structure.ly
lily/arpeggio.cc
lily/bezier.cc
lily/include/bezier.hh
lily/lookup.cc
ly/property-init.ly
python/convertrules.py

index cf1a09547c55f1a9e8d025fcccaea77389dc1bbc..129edfa528c9b29d7a97a0bedce09f423241cca8 100644 (file)
@@ -545,16 +545,13 @@ slur can overlap a slur.  This permits two slurs to be printed at
 once.  For details, see @ref{Phrasing slurs}.
 
 @cindex slur style
-@cindex solid slur
-@cindex dotted slur
-@cindex dashed slur
 @cindex slur, solid
 @cindex slur, dotted
 @cindex slur, dashed
 @cindex solid slur
 @cindex dotted slur
 @cindex dashed slur
-@cindex sytle, slur
+@cindex style, slur
 @funindex \slurDashed
 @funindex slurDashed
 @funindex \slurDotted
@@ -579,12 +576,14 @@ g4( e c2)
 @funindex slurHalfDashed
 @funindex \slurHalfSolid
 @funindex slurHalfSolid
+@cindex slur, half dashed and half solid
 
 Slurs can also be made half-dashed (the first half dashed, the
 second half solid) or half-solid (the first half solid, the second
 half dashed):
 
 @lilypond[verbatim,quote,relative=1]
+c4( e g2)
 \slurHalfDashed
 g4( e c2)
 \slurHalfSolid
@@ -593,9 +592,14 @@ c4( e g2)
 g4( e c2)
 @end lilypond
 
+@funindex \slurDashPattern
+@funindex slurDashPattern
+@cindex slur, defining dash patterns
+
 Custom dash patterns for slurs can be defined:
 
 @lilypond[verbatim,quote,relative=1]
+c4( e g2)
 \slurDashPattern #0.7 #0.75
 g4( e c2)
 \slurDashPattern #0.5 #2.0
@@ -692,10 +696,10 @@ c4\( g' c,( b) | c1\)
 
 @cindex simultaneous phrasing slurs
 @cindex multiple phrasing slurs
-@cindex slurs, simultaneous phrasing
-@cindex slurs, multiple phrasing
-@cindex phrasing slurs, simultaneous
-@cindex phrasing slurs, multiple
+@cindex slur, simultaneous phrasing
+@cindex slur, multiple phrasing
+@cindex phrasing slur, simultaneous
+@cindex phrasing slur, multiple
 
 Simultaneous or overlapping phrasing slurs are not permitted.
 
@@ -705,6 +709,12 @@ Simultaneous or overlapping phrasing slurs are not permitted.
 @funindex phrasingSlurDotted
 @funindex \phrasingSlurSolid
 @funindex phrasingSlurSolid
+@cindex phrasing slur, dashed
+@cindex dashed phrasing slur
+@cindex phrasing slur, dotted
+@cindex dotted phrasing slurs
+@cindex slur, dashed phrasing
+@cindex slur, dotted phrasing
 
 Phrasing slurs can be solid, dotted, or dashed.  Solid is the default
 style for phrasing slurs:
@@ -723,33 +733,39 @@ g4\( e c2\)
 @funindex \phrasingSlurHalfDashed
 @funindex \phrasingSlurHalfSolid
 @funindex phrasingSlurHalfSolid
+@cindex phrasing slur, half solid and half dashed
+@cindex slur, half solid and half dashed phrasing
 
 Phrasing slurs can also be made half-dashed (the first half dashed, the
 second half solid) or half-solid (the first half solid, the second
 half dashed):
 
 @lilypond[verbatim,quote,relative=1]
+c4\( e g2\)
 \phrasingSlurHalfDashed
-g4( e c2)
+g4\( e c2\)
 \phrasingSlurHalfSolid
-c4( e g2)
+c4\( e g2\)
 \phrasingSlurSolid
-g4( e c2)
+g4\( e c2\)
 @end lilypond
 
 @funindex \phrasingSlurDashPattern
 @funindex phrasingSlurDashPattern
-
+@cindex phrasing slur, defining dash patterns
+@cindex slur, phrasing, defining dash patterns
+@cindex slur, definind dash patterns for phrasing
 
 Custom dash patterns for phrasing slurs can be defined:
 
 @lilypond[verbatim,quote,relative=1]
+c4\( e g2\)
 \phrasingSlurDashPattern #0.7 #0.75
-g4( e c2)
+g4\( e c2\)
 \phrasingSlurDashPattern #0.5 #2.0
-c4( e g2)
+c4\( e g2\)
 \phrasingSlurSolid
-g4( e c2)
+g4\( e c2\)
 @end lilypond
 
 Dash pattern definitions for phrasing slurs have the same structure
@@ -967,6 +983,8 @@ Different types of arpeggios may be written.
 @funindex arpeggioBracket
 @funindex \arpeggioParenthesis
 @funindex arpeggioParenthesis
+@funindex \arpeggioParenthesisDashed
+@funindex arpeggioParenthesisDashed
 
 Special @emph{bracketed} arpeggio symbols can be created:
 
@@ -976,10 +994,15 @@ Special @emph{bracketed} arpeggio symbols can be created:
 <c e g c>2\arpeggio
 \arpeggioParenthesis
 <c e g c>2\arpeggio
+\arpeggioParenthesisDashed
+<c e g c>2\arpeggio
 \arpeggioNormal
 <c e g c>2\arpeggio
 @end lilypond
 
+The dash properties of the parenthesis arpeggio are controlled
+with the @code{'dash-details} property, which is described at @ref{Slurs}.
+
 Arpeggios can be explicitly written out with ties.  For more
 information, see @ref{Ties}.
 
@@ -990,7 +1013,8 @@ information, see @ref{Ties}.
 @code{\arpeggioArrowDown},
 @code{\arpeggioNormal},
 @code{\arpeggioBracket},
-@code{\arpeggioParenthesis}.
+@code{\arpeggioParenthesis}
+@code{\arpeggioParenthesisDashed}.
 @endpredefined
 
 
@@ -1011,6 +1035,7 @@ Music Glossary:
 @rglos{arpeggio}.
 
 Notation Reference:
+@ref{Slurs},
 @ref{Ties}.
 
 Snippets:
@@ -1018,6 +1043,7 @@ Snippets:
 
 Internals Reference:
 @rinternals{Arpeggio},
+@rinternals{Slur},
 @rinternals{PianoStaff}.
 
 
index dd4745a96ad71193751af6d4ab75c374670a1f55..ebdd7e70a74d4ad9fc3155d5d1835607b3012fe3 100644 (file)
@@ -520,8 +520,8 @@ see the snippets under @ref{Slurs}.
 @code{\tieDotted},
 @code{\tieDashed},
 @code{\tieDashPattern},
-@code(\tieHalfDashed),
-@code{\tieHalfSolid),
+@code{\tieHalfDashed},
+@code{\tieHalfSolid},
 @code{\tieSolid}.
 @endpredefined
 
index fd41dd7c9bd0597b22be170e59066f61bac3a5db..dacb4c98d6a7c0cb27767fd0e5617f961ddd155b 100644 (file)
@@ -1,6 +1,6 @@
 \version "2.13.1"
 
-\header{
+\header {
   texidoc = "
 Slurs can be made with complex dash patterns by defining
 the @code{dash-definition} property.  @code{dash-definition}
@@ -19,6 +19,8 @@ defined in terms of staff spaces.  @code{dash-fraction} is
 set to 1 for a solid slur.
 "
   doctitle = "Making slurs with complex dash structure"
+
+  lsrtags = "rhythms, expressive"
 }
 
 \relative c' {
index 0265b3deddeb5d8a94f4488c1bffb84de3dca00b..8e6e9c5a3364613eac45c2a216288d1d09421709 100644 (file)
@@ -153,6 +153,7 @@ SCM
 Arpeggio::brew_chord_slur (SCM smob)
 {
   Grob *me = unsmob_grob (smob);
+  SCM dash_definition = me->get_property ("dash-definition");
   Interval heads = robust_scm2interval (me->get_property ("positions"),
                                        Interval())
     * Staff_symbol_referencer::staff_space (me);
@@ -165,7 +166,7 @@ Arpeggio::brew_chord_slur (SCM smob)
   Bezier curve = slur_shape (dy, height_limit, ratio);
   curve.rotate (M_PI / 2);
 
-  Stencil mol (Lookup::slur (curve, lt, lt, SCM_UNDEFINED));
+  Stencil mol (Lookup::slur (curve, lt, lt, dash_definition));
   mol.translate_axis (heads[LEFT], Y_AXIS);
   return mol.smobbed_copy ();
 }
@@ -211,5 +212,6 @@ ADD_INTERFACE (Arpeggio,
               "positions "
               "script-priority " // TODO: make around-note-interface
               "stems "
+               "dash-definition " // TODO: make apply to non-slur arpeggios
               );
 
index b9044063baffa5d494aab1b3d8cec59eecf7a552..b341d73754b35ccf5828c9f2372ea65847e5878c 100644 (file)
@@ -272,7 +272,7 @@ Bezier::reverse ()
   using deCasteljau's algorithm.
 */
 void
-Bezier::subdivide (Real t, Bezier &left_part, Bezier &right_part)
+Bezier::subdivide (Real t, Bezier *left_part, Bezier *right_part) const
 {
   Offset p[CONTROL_COUNT][CONTROL_COUNT];
 
@@ -283,8 +283,8 @@ Bezier::subdivide (Real t, Bezier &left_part, Bezier &right_part)
     p[i][j] = p[i][j+1] + t * (p[i+1][j+1] - p[i][j+1]);
   for (int i = 0; i < CONTROL_COUNT; i++)
     {
-      left_part.control_[i]=p[0][CONTROL_COUNT - 1 - i];
-      right_part.control_[i]=p[i][i];
+      left_part->control_[i]=p[0][CONTROL_COUNT - 1 - i];
+      right_part->control_[i]=p[i][i];
     }
 }
 
@@ -293,25 +293,24 @@ Bezier::subdivide (Real t, Bezier &left_part, Bezier &right_part)
 */
 
 Bezier
-Bezier::extract (Real t_min, Real t_max)
+Bezier::extract (Real t_min, Real t_max) const
 {
+  if ((t_min < 0) || (t_max) > 1)
+    programming_error
+      ("bezier extract arguments outside of limits: curve may have bad shape");
+  if (t_min >= t_max)
+    programming_error 
+      ("lower bezier extract value not less than upper value: curve may have bad shape");
   Bezier bez1, bez2, bez3, bez4;
   if (t_min == 0.0)
-    {
-      for (int i = 0; i < CONTROL_COUNT; i++)
-        bez2.control_[i] = control_[i];
-    }
+    bez2 = *this;
   else
-    {
-      subdivide (t_min, bez1, bez2);
-    }
+      subdivide (t_min, &bez1, &bez2);
   if (t_max == 1.0)
-    {
       return bez2;
-    }
   else
    {
-     bez2.subdivide ((t_max-t_min)/(1-t_min), bez3, bez4);
+     bez2.subdivide ((t_max-t_min)/(1-t_min), &bez3, &bez4);
      return bez3;
   }
 }
index 5cfca578c2ebd5270095076cc91788adb6a3bd42..31f68d23e04055851511012e288bdb39d881ef87 100644 (file)
@@ -22,8 +22,8 @@ public:
   void reverse ();
   void rotate (Real);
   void translate (Offset);
-  void subdivide (Real, Bezier &, Bezier &);
-  Bezier extract (Real, Real);
+  void subdivide (Real, Bezier * , Bezier * ) const;
+  Bezier extract (Real, Real) const;
 
   Real get_other_coordinate (Axis a, Real x) const;
   vector<Real> solve_point (Axis, Real coordinate) const;
index b557986c0742a7f7ed5981d6ab1dd2bd0bf527cc..671c0da04e38e93c0e12f418f79bc9db92e9bcbd 100644 (file)
@@ -348,8 +348,9 @@ Lookup::slur (Bezier curve, Real curvethick, Real linethick,
 {
   Stencil return_value;
 
-  /* calculate the offset for the two beziers that make the sandwich
-   *   for the slur
+  /* 
+      calculate the offset for the two beziers that make the sandwich
+      for the slur
   */
   Real alpha = (curve.control_[3] - curve.control_[0]).arg ();
   Bezier back = curve;
@@ -360,12 +361,14 @@ Lookup::slur (Bezier curve, Real curvethick, Real linethick,
   curve.control_[1] -= perp;
   curve.control_[2] -= perp;
  
-  if ((dash_details == SCM_UNDEFINED) || (dash_details == SCM_EOL))
-    { /* solid slur  */
+  if (!scm_is_pair (dash_details))
+    { 
+      /* solid slur  */
       return_value = bezier_sandwich (back, curve, linethick);
     }
   else
-    { /* dashed or combination slur */
+    { 
+      /* dashed or combination slur */
       int num_segments = scm_to_int (scm_length (dash_details));
       for (int i=0; i<num_segments; i++)
         {
@@ -379,11 +382,9 @@ Lookup::slur (Bezier curve, Real curvethick, Real linethick,
           Bezier back_segment = back.extract (t_min, t_max);
           Bezier curve_segment = curve.extract (t_min, t_max);
           if (dash_fraction == 1.0) 
-            {
               return_value.add_stencil (bezier_sandwich (back_segment,
                                                          curve_segment,
                                                          linethick));
-            }
           else
             {
               Bezier back_dash, curve_dash;
@@ -405,8 +406,8 @@ Lookup::slur (Bezier curve, Real curvethick, Real linethick,
                                                              linethick));
                 }
             }
-        }/* end for num_segments */
-    }/* end dashed or combination slur */
+        }
+    }
   return return_value;
 }
 
index 010b5ac0a9bf618a8489e10de0225fd928ca8c24..6744021a1ab0a34b617b9b148937b20fccb20513 100644 (file)
@@ -299,7 +299,8 @@ arpeggioArrowDown = {
 arpeggioNormal = {
   \revert Arpeggio #'stencil
   \revert Arpeggio #'X-extent
-  \revert Arpeggio  #'arpeggio-direction
+  \revert Arpeggio #'arpeggio-direction
+  \revert Arpeggio #'dash-definition
 }
 arpeggioBracket = {
   \revert Arpeggio #'X-extent
@@ -308,7 +309,15 @@ arpeggioBracket = {
 arpeggioParenthesis = {
   \override Arpeggio #'stencil = #ly:arpeggio::brew-chord-slur
   \override Arpeggio #'X-extent = #ly:grob::stencil-width
+  \revert Arpeggio #'dash-definition
 }
+arpeggioParenthesisDashed = {
+  \override Arpeggio #'stencil = #ly:arpeggio::brew-chord-slur
+  \override Arpeggio #'X-extent = #ly:grob::stencil-width
+  \override Arpeggio #'dash-definition = #'((0 1 0.4 0.75))
+}
+
+
 
 glissando = #(make-music 'GlissandoEvent)
 
index 2a70225232b2c5fd9c8e69d74ec3f42e740f37ec..6ee7d0cee27baa4d1a822c2633dedfff5a520cca 100644 (file)
@@ -2900,7 +2900,8 @@ def conv(str):
         stderr_write (NOT_SMART % _("\\bar \".\" now produces a thick barline.\n"))
         stderr_write (UPDATE_MANUALLY)
     str = re.sub (r'ly:hairpin::after-line-breaking', r'ly:spanner::kill-zero-spanned-time', str)
-    if (re.search(r'\'dash-fraction', str) or re.search(r'\'dash-period', str):
+    if (re.search("(Slur|Tie)\w+\#\'dash-fraction", str) \
+        or re.search("(Slur|Tie)\w+\#\'dash-period", str)):
         stderr_write ("\n")
         stderr_write (NOT_SMART % _("Dash parameters for slurs and ties are now in \'dash-details.\n"))
         stderr_write (UPDATE_MANUALLY)