]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/audio-item.cc
Add changes entry for Mike's work on skylines (28f3294954eff1).
[lilypond.git] / lily / audio-item.cc
index 8460ee8e5eeb1b917f30b8c3ed1c335564c7b101..895439e78401bbbb118a0c227eaaa592e457855a 100644 (file)
@@ -58,15 +58,41 @@ void
 Audio_note::tie_to (Audio_note *t, Moment skip)
 {
   tied_ = t;
-  Audio_note *first = t;
-  while (first->tied_)
-    first = first->tied_;
+  Audio_note *first = tie_head();
   // Add the skip to the tied note and the length of the appended note
   // to the full duration of the tie...
   first->length_mom_ += skip + length_mom_;
   length_mom_ = 0;
 }
 
+Audio_note *
+Audio_note::tie_head ()
+{
+  Audio_note *first = this;
+  while (first->tied_)
+    first = first->tied_;
+  return first;
+}
+
+string
+Audio_note::to_string () const
+{
+  string s = "#<Audio_note pitch ";
+  s += pitch_.to_string();
+  s += " len ";
+  s += length_mom_.to_string();
+  if (tied_)
+    {
+      s += " tied to " + tied_->to_string();
+    }
+  if (tie_event_)
+    {
+      s += " tie_event";
+    }
+  s += ">";
+  return s;
+}
+
 Audio_key::Audio_key (int acc, bool major)
 {
   accidentals_ = acc;
@@ -133,13 +159,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 ();