]> git.donarmstrong.com Git - lilypond.git/commitdiff
MIDI: always output all midi events. Fixes #1593.
authorJan Nieuwenhuizen <janneke@gnu.org>
Tue, 5 Apr 2011 20:08:34 +0000 (22:08 +0200)
committerJan Nieuwenhuizen <janneke@gnu.org>
Tue, 5 Apr 2011 20:09:23 +0000 (22:09 +0200)
It seemed to be a good trick to not output midi dynamics and use note
velocities instead.  However, all events are preceeded by delta times
so we need every midi event.

When we are using note velocities, always output the default midi
channel value, which is 100.

input/regression/midi/rest-dynamic.ly [new file with mode: 0644]
lily/midi-chunk.cc
lily/midi-item.cc

diff --git a/input/regression/midi/rest-dynamic.ly b/input/regression/midi/rest-dynamic.ly
new file mode 100644 (file)
index 0000000..299507f
--- /dev/null
@@ -0,0 +1,12 @@
+\header {
+texidoc="LilyPond respects rests, also when there are dynamics"
+options=""
+}
+
+\score {
+  \new Staff \relative c' {
+    \time 2/4 e4 e r4 e\f |
+  }
+  \layout {}
+  \midi {}
+}
index 625781dc5a44ad55902fcc4ff07646ede6d8be1c..0aa11eb5497bc388f83b7e323217d46ab9705cbb 100644 (file)
@@ -110,8 +110,6 @@ Midi_event::to_string () const
 {
   string delta_string = int2midi_varint_string (delta_ticks_);
   string midi_string = midi_->to_string ();
-  if (midi_string.empty ())
-    return "";
   return delta_string + midi_string;
 }
 /****************************************************************
index 883d1419f026e7b92402efac35db1b515376ded5..a04553508fc660314c5d9a7452af6501ae0189b8 100644 (file)
@@ -272,9 +272,6 @@ Midi_dynamic::Midi_dynamic (Audio_dynamic *a)
 string
 Midi_dynamic::to_string () const
 {
-  if (audio_->volume_ < 0 || audio_->silent_)
-    return "";
-
   Byte status_byte = (char) (0xB0 + channel_);
   string str = ::to_string ((char)status_byte);
 
@@ -291,6 +288,10 @@ Midi_dynamic::to_string () const
   if (volume > full_scale)
     volume = (int)full_scale;
 
+  int const volume_default = 100;
+  if (audio_->volume_ < 0 || audio_->silent_)
+    volume = volume_default;
+  
   str += ::to_string ((char)0x07);
   str += ::to_string ((char)volume);
   return str;