lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: property to set voiced-rest positions; issue 3902 (issue 188580043 b


From: k-ohara5a5a
Subject: Re: property to set voiced-rest positions; issue 3902 (issue 188580043 by address@hidden)
Date: Tue, 06 Jan 2015 05:07:46 +0000

Reviewers: dak,

Message:
Shouldn't the fallback remain 4 rather than 0?

Either one.  I couldn't decide.

If anyone says  \override MultiMeasureRest #'voiced-position = #'()
should we default to the historical value of 4, or the less-surprising 0
?

Description:
property to set voiced-rest positions; issue 3902

Please review this at https://codereview.appspot.com/188580043/

Affected files (+18, -10 lines):
  M input/regression/rest-polyphonic.ly
  M lily/rest.cc
  M scm/define-grob-properties.scm
  M scm/define-grobs.scm


Index: input/regression/rest-polyphonic.ly
diff --git a/input/regression/rest-polyphonic.ly b/input/regression/rest-polyphonic.ly index a1e762923bc37e7339f93a7610845bf1dbbfd765..4dca1efc9ace4eb63392e6044e728791e34e0e1b 100644
--- a/input/regression/rest-polyphonic.ly
+++ b/input/regression/rest-polyphonic.ly
@@ -2,7 +2,7 @@

   texidoc = "In polyphonic situations, rests are moved according
 to their @code{direction} even if there is no opposite note or rest.
-The amount is two @code{staff-space}s. "
+The amount in @code{staff-position}s is set by @code{voiced-position}."

 }

@@ -15,6 +15,9 @@ The amount is two @code{staff-space}s. "
 \new Staff  \relative c' {
   << { r8 g''4 g8       r g4 g8 } \\
      { d,4    r \stemUp b   r   } >>
+ \override Staff.Rest.voiced-position = 2
+  << { r8 g''4 g8       r g4 g8 } \\
+     { d,4    r \stemUp b   r   } >>
 }


Index: lily/rest.cc
diff --git a/lily/rest.cc b/lily/rest.cc
index 7191b3ba93eeca9134b062eaf08d5c8645baca58..d8ae3b664101ff06ed34cb55ad790b731ee83029 100644
--- a/lily/rest.cc
+++ b/lily/rest.cc
@@ -72,12 +72,13 @@ Rest::staff_position_internal (Grob *me, int duration_log, int dir)
       return pos;
     }

-  pos = 4 * dir;
+ Real vpos = dir * robust_scm2int (me->get_property ("voiced-position"), 0);
+  pos = vpos;

   if (duration_log > 1)
     /* Only half notes or longer want alignment with staff lines */
     return pos;
-
+
   /*
     We need a staff symbol for actually aligning anything
   */
@@ -89,9 +90,9 @@ Rest::staff_position_internal (Grob *me, int duration_log, int dir)

   if (linepos.empty ())
     return pos;
-
+
   std::sort (linepos.begin (), linepos.end ());
-
+
   if (duration_log == 0)
     {
       /*
@@ -105,7 +106,7 @@ Rest::staff_position_internal (Grob *me, int duration_log, int dir)
         make a semibreve rest hang from the next available line,
         except when there is none.
       */
-
+
       std::vector<Real>::const_iterator it
         = std::upper_bound (linepos.begin (), linepos.end (), pos);
       if (it != linepos.end ())
@@ -127,16 +128,15 @@ Rest::staff_position_internal (Grob *me, int duration_log, int dir)
     return pos;

   /* If we have a voiced position, make sure that it's on the
-     proper side of neutral before using it.  If it isn't, we fall
-     back to a constant offset from neutral position.
+     proper side of neutral before using it.
   */

   Real neutral = staff_position_internal (me, duration_log, 0);

   if (dir * (pos - neutral) > 0)
     return pos;
-
-  return neutral + 4 * dir;
+  else
+    return neutral + vpos;
 }

 /* A rest might lie under a beam, in which case it should be cross-staff if
@@ -318,4 +318,5 @@ ADD_INTERFACE (Rest,
                "direction "
                "minimum-distance "
                "style "
+               "voiced-position "
               );
Index: scm/define-grob-properties.scm
diff --git a/scm/define-grob-properties.scm b/scm/define-grob-properties.scm
index 676432bb1aa4abf30adf38e265d6cfee9aca1aa7..6cc58394f38eee94a1d87660e37a4dc35bc650bf 100644
--- a/scm/define-grob-properties.scm
+++ b/scm/define-grob-properties.scm
@@ -1112,6 +1112,8 @@ positioning?")
 ;;;
      (vertical-skylines ,ly:skyline-pair? "Two skylines, one above and
 one below this grob.")
+     (voiced-position ,number? "The staff-position of a voiced
address@hidden, negative if the rest has @code{direction} @code{DOWN}.")

 ;;;
 ;;; w
Index: scm/define-grobs.scm
diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm
index d90cc885a2026a066a736ecb76d782b18ecc2d83..bbf4c564814805adbb9b081f3f5e0b8c83f1de7f 100644
--- a/scm/define-grobs.scm
+++ b/scm/define-grobs.scm
@@ -1512,6 +1512,7 @@
         (thick-thickness . 6.6)
         ;; See Wanske pp. 125
         (usable-duration-logs . ,(iota 4 -3))
+        (voiced-position . 4)
(Y-extent . ,(ly:make-unpure-pure-container ly:multi-measure-rest::height))
         (Y-offset . ,staff-symbol-referencer::callback)
         (meta . ((class . Spanner)
@@ -1879,6 +1880,7 @@
         (duration-log . ,stem::calc-duration-log)
         (minimum-distance . 0.25)
         (stencil . ,ly:rest::print)
+        (voiced-position . 4)
         (X-extent . ,ly:rest::width)
(Y-extent . ,(ly:make-unpure-pure-container ly:rest::height ly:rest::pure-height)) (Y-offset . ,(ly:make-unpure-pure-container ly:rest::y-offset-callback))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]