Reviewers: ,

Message:
http://code.google.com/p/lilypond/issues/detail?id=1938

fix by Heikki Tauriainen

Description:
MIDI volume can exceed maximum value (fix 1938)

make Dynamic performer respect midiMinimumVolume
and midiMaximumVolume, also with (de)crescendi
which aren't terminated by absolute dynamic mark.

Please review this at http://codereview.appspot.com/5134047/

Affected files:
  M lily/audio-item.cc
  M lily/dynamic-performer.cc
  M lily/include/audio-item.hh


Index: lily/audio-item.cc
diff --git a/lily/audio-item.cc b/lily/audio-item.cc
index 1cbf7765b70f338ff82a5b9ed004ddf47c8eebbd..e14fa2f7af1972351093b84afabc1912f505b825 100644
--- a/lily/audio-item.cc
+++ b/lily/audio-item.cc
@@ -79,9 +79,11 @@ Audio_dynamic::Audio_dynamic ()
 {
 }

-Audio_span_dynamic::Audio_span_dynamic ()
+Audio_span_dynamic::Audio_span_dynamic (Real min_volume, Real max_volume)
 {
   grow_dir_ = CENTER;
+  min_volume_ = min_volume;
+  max_volume_ = max_volume;
 }

 void
@@ -135,7 +137,7 @@ Audio_span_dynamic::render ()

   Real start_v = dynamics_[0]->volume_;
   if (dynamics_.back ()->volume_ < 0)
- dynamics_.back ()->volume_ = max (min (start_v + grow_dir_ * 0.25, 1.0), 0.1); + dynamics_.back ()->volume_ = max (min (start_v + grow_dir_ * 0.25, max_volume_), min_volume_);

   delta_v = dynamics_.back ()->volume_ - dynamics_[0]->volume_;

Index: lily/dynamic-performer.cc
diff --git a/lily/dynamic-performer.cc b/lily/dynamic-performer.cc
index 3977a77c30a2166efe89f91e6cc92c8759cc5624..be6cc166de354e1dead268333ebc9a133882831a 100644
--- a/lily/dynamic-performer.cc
+++ b/lily/dynamic-performer.cc
@@ -110,7 +110,7 @@ Dynamic_performer::process_music ()

   if (span_events_[START])
     {
-      span_dynamic_ = new Audio_span_dynamic ();
+ span_dynamic_ = new Audio_span_dynamic (equalize_volume (0.1), equalize_volume (1.0)); announce_element (Audio_element_info (span_dynamic_, span_events_[START]));

       span_dynamic_->grow_dir_ = grow_dir_[START];
Index: lily/include/audio-item.hh
diff --git a/lily/include/audio-item.hh b/lily/include/audio-item.hh
index dc4bb6efbd3c1073426567205c4401cb9d540718..ee0e2e9447beb4a7dcf58367f80983342f614a7d 100644
--- a/lily/include/audio-item.hh
+++ b/lily/include/audio-item.hh
@@ -54,10 +54,12 @@ class Audio_span_dynamic : public Audio_element
 public:
   Direction grow_dir_;
   vector<Audio_dynamic *> dynamics_;
+  Real min_volume_;
+  Real max_volume_;

   virtual void render ();
   void add_absolute (Audio_dynamic *);
-  Audio_span_dynamic ();
+  Audio_span_dynamic (Real min_volume, Real max_volume);
 };

 class Audio_key : public Audio_item



_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to