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.
--- /dev/null
+\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 {}
+}
{
string delta_string = int2midi_varint_string (delta_ticks_);
string midi_string = midi_->to_string ();
- if (midi_string.empty ())
- return "";
return delta_string + midi_string;
}
/****************************************************************
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);
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;