]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/midi-item.cc
Midi: Use span dynamics render results for note velocities. Fixes #1586.
[lilypond.git] / lily / midi-item.cc
index 9168f1148079c874a307f6365cf868e813c33920..883d1419f026e7b92402efac35db1b515376ded5 100644 (file)
@@ -181,7 +181,8 @@ Midi_time_signature::to_string () const
 Midi_note::Midi_note (Audio_note *a)
   : Midi_channel_item (a)
   , audio_ (a)
-  , dynamic_byte_ (a->volume_ > 0 ? Byte (a->volume_ * 0x7f) : Byte (0x5a))
+  , dynamic_byte_ (a->dynamic_ && a->dynamic_->volume_ > 0
+                  ? Byte (a->dynamic_->volume_ * 0x7f) : Byte (0x5a))
 {
 }
 
@@ -271,7 +272,7 @@ Midi_dynamic::Midi_dynamic (Audio_dynamic *a)
 string
 Midi_dynamic::to_string () const
 {
-  if (audio_->volume_ < 0)
+  if (audio_->volume_ < 0 || audio_->silent_)
     return "";
 
   Byte status_byte = (char) (0xB0 + channel_);