From 86256511ff93fa202110df55edaf8880ec699db0 Mon Sep 17 00:00:00 2001 From: Carl Sorensen Date: Sat, 18 Apr 2009 15:12:20 -0600 Subject: [PATCH] Update to dashed-slur package 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 | 58 ++++++++++++++----- Documentation/user/rhythms.itely | 4 +- ...aking-slurs-with-complex-dash-structure.ly | 4 +- lily/arpeggio.cc | 4 +- lily/bezier.cc | 27 +++++---- lily/include/bezier.hh | 4 +- lily/lookup.cc | 19 +++--- ly/property-init.ly | 11 +++- python/convertrules.py | 3 +- 9 files changed, 87 insertions(+), 47 deletions(-) diff --git a/Documentation/user/expressive.itely b/Documentation/user/expressive.itely index cf1a09547c..129edfa528 100644 --- a/Documentation/user/expressive.itely +++ b/Documentation/user/expressive.itely @@ -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: 2\arpeggio \arpeggioParenthesis 2\arpeggio +\arpeggioParenthesisDashed +2\arpeggio \arpeggioNormal 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}. diff --git a/Documentation/user/rhythms.itely b/Documentation/user/rhythms.itely index dd4745a96a..ebdd7e70a7 100644 --- a/Documentation/user/rhythms.itely +++ b/Documentation/user/rhythms.itely @@ -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 diff --git a/input/new/making-slurs-with-complex-dash-structure.ly b/input/new/making-slurs-with-complex-dash-structure.ly index fd41dd7c9b..dacb4c98d6 100644 --- a/input/new/making-slurs-with-complex-dash-structure.ly +++ b/input/new/making-slurs-with-complex-dash-structure.ly @@ -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' { diff --git a/lily/arpeggio.cc b/lily/arpeggio.cc index 0265b3dedd..8e6e9c5a33 100644 --- a/lily/arpeggio.cc +++ b/lily/arpeggio.cc @@ -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 ); diff --git a/lily/bezier.cc b/lily/bezier.cc index b9044063ba..b341d73754 100644 --- a/lily/bezier.cc +++ b/lily/bezier.cc @@ -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; } } diff --git a/lily/include/bezier.hh b/lily/include/bezier.hh index 5cfca578c2..31f68d23e0 100644 --- a/lily/include/bezier.hh +++ b/lily/include/bezier.hh @@ -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 solve_point (Axis, Real coordinate) const; diff --git a/lily/lookup.cc b/lily/lookup.cc index b557986c07..671c0da04e 100644 --- a/lily/lookup.cc +++ b/lily/lookup.cc @@ -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