From e86f0d30381c1bbe7c04e4b996c1d55497d4cfd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janek=20Warcho=C5=82?= Date: Sun, 13 Feb 2011 22:32:40 +0100 Subject: [PATCH] improving the transition between full-length and shortened stems. Now the change in length between regular stems (3.5 ss) and shortened stems (2.5 ss) is executed more gradually. --- lily/stem.cc | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lily/stem.cc b/lily/stem.cc index 11cf6de..8785112 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -346,11 +346,11 @@ Stem::calc_length (SCM smob) SCM sshorten = ly_assoc_get (ly_symbol2scm ("stem-shorten"), details, SCM_EOL); SCM scm_shorten = scm_is_pair (sshorten) ? robust_list_ref (max (duration_log (me) - 2, 0), sshorten) : SCM_EOL; - Real shorten = 2* robust_scm2double (scm_shorten, 0); - - /* On boundary: shorten only half */ - if (abs (head_positions (me)[dir]) <= 1) - shorten *= 0.5; + Real shorten = 2 * robust_scm2double (scm_shorten, 0); + /* make a smooth transition between shortened stems and normal ones: */ + Real shortening_steps[] = {0.166, 0.333, 0.5, 0.666, 0.833}; + if (abs (head_positions (me)[dir]) < 5) + shorten *= shortening_steps[(int) abs (head_positions (me)[dir])]; length -= shorten; } -- 1.7.0.4