Issue 3234
My idea is to ensure that the volume is *always* initialised in
Dynamic_performer::process_music. The code to do that is mostly
copied from what happens if there is an actual script event.
The constant 0.71 was obtained by calculating backwards from the
default velocity value (0x5a) in the Midi_note constructor,
midi-item.cc line 179.
I found that I had to create and announce an Audio_element_info for
the change to take effect.
Backward compatibility notes
----------------------------
As far as the music itself goes there are a few cases:
- Music that doesn't set midiMaximumVolume or midiMinimumVolume will
be unchanged, as the default dynamic setting is chosen so the
calculated midi velocity is the same as the current default when no
volume is set.
- Music that sets midiMaximumVolume or midiMinimumVolume and has
initial dynamic expressions will be unchanged - the explicit
dynamic takes effect before the first midi note is created.
- Music that sets midiMaximumVolume or midiMinimumVolume but doesn't
have an initial dynamic expression will change. In the current
version such would be an error, so I don't expect many of those.
announce_element (info);
}
+ if (!last_volume_initialized_)
+ {
+ absolute_ = new Audio_dynamic ();
+
+ last_volume_
+ = absolute_->volume_ = equalize_volume (0.71); // Backward compatible
+ last_volume_initialized_ = true;
+
+ Audio_element_info info (absolute_, script_event_);
+ announce_element (info);
+ }
+
if (span_dynamic_)
span_dynamic_->add_absolute (absolute_);