]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/audio-item.cc
Revert "layout.cc: do not draw empty boxes"
[lilypond.git] / lily / audio-item.cc
index e14fa2f7af1972351093b84afabc1912f505b825..201e8fd98e7cf4939c1de6b4a7e8ca64efc540d6 100644 (file)
@@ -1,7 +1,7 @@
 /*
   This file is part of LilyPond, the GNU music typesetter.
 
-  Copyright (C) 1997--2011 Jan Nieuwenhuizen <janneke@gnu.org>
+  Copyright (C) 1997--2012 Jan Nieuwenhuizen <janneke@gnu.org>
 
   LilyPond is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -133,13 +133,16 @@ Audio_span_dynamic::render ()
       return;
     }
 
-  Real delta_v = grow_dir_ * 0.1;
-
   Real start_v = dynamics_[0]->volume_;
   if (dynamics_.back ()->volume_ < 0)
-    dynamics_.back ()->volume_ = max (min (start_v + grow_dir_ * 0.25, max_volume_), min_volume_);
+    {
+      // The dynamic spanner does not end with an explicit dynamic script
+      // event.  Adjust the end volume by at most 1/4 of the available
+      // volume range in this case.
+      dynamics_.back ()->volume_ = max (min (start_v + grow_dir_ * (max_volume_ - min_volume_) * 0.25, max_volume_), min_volume_);
+    }
 
-  delta_v = dynamics_.back ()->volume_ - dynamics_[0]->volume_;
+  Real delta_v = dynamics_.back ()->volume_ - dynamics_[0]->volume_;
 
   Moment start = dynamics_[0]->get_column ()->when ();