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))
{
}
string
Midi_dynamic::to_string () const
{
- if (audio_->volume_ < 0)
- 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;