diff options
author | Heikki Tauriainen <g034737@welho.com> | 2016-01-07 10:05:27 +0200 |
---|---|---|
committer | James Lowe <pkx166h@gmail.com> | 2016-01-15 19:51:33 +0000 |
commit | c27954a2ec2c13e14666408982e156bea20e806a (patch) | |
tree | 15ee80a167f35fe4fa17df93e3ad81b5ab162d60 | |
parent | 90e10b6cd083c310c0a66886e163f0135915755d (diff) |
Do not output CC#7 events in MIDI on dynamic changes
As volume changes for MIDI are encoded as note velocities, it is not
necessary to add "silent" Audio_dynamic elements to Audio_staffs to
be processed by Midi_walker. (Every "silent" Audio_dynamic event
will only get converted to a Midi_dynamic event outputted as a CC#7
event with fixed volume 100 in MIDI, see Midi_dynamic::to_string.
This behavior is not consistent with the handling of other MIDI
controls on which LilyPond will not enforce any "default" values.)
As Staff_performer::get_audio_staff has the side effect of creating
a new Audio_staff for a voice if it does not yet exist, accessing the
current voice's associated Audio_staff was moved before the handling
of Audio_dynamic elements.
Based on the revision history, not emitting any CC#7 events in MIDI
appears to have been the original intention when encoding dynamic
changes as note velocities (93b7a6ff072d73dcdd41da59cd18da8aa8d8e8cb),
but apparently the initial implementation (of passing "silent"
Audio_dynamic events to Midi_walker, and ignoring them only at the
output stage) caused problems with MIDI timing (#1593), possibly
because skipping these events only just before outputting them might
have interfered with the logic for tracking the delta times between
the MIDI events that would be actually outputted. To fix #1593,
commit f114e3c33f9c37c39c7a3fedf66ca5a074785118 conservatively
restored the emission of CC#7 events in MIDI.
The current commit tries to avoid the issues with MIDI timing by
pruning all Audio_dynamic events already from the input given to
Midi_walker, so that Midi_walker sees no events, the skipping of
which would confuse the measurement of delta times at the output
stage.
-rw-r--r-- | lily/staff-performer.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lily/staff-performer.cc b/lily/staff-performer.cc index 0648d0aae8..26781f0dcd 100644 --- a/lily/staff-performer.cc +++ b/lily/staff-performer.cc @@ -331,6 +331,7 @@ Staff_performer::acknowledge_audio_element (Audio_element_info inf) set_instrument_name (voice); } ai->channel_ = channel_; + Audio_staff *audio_staff = get_audio_staff (voice); bool encode_dynamics_as_velocity_ = true; if (encode_dynamics_as_velocity_) { @@ -344,11 +345,11 @@ Staff_performer::acknowledge_audio_element (Audio_element_info inf) else if (Audio_dynamic *d = dynamic_cast<Audio_dynamic *> (inf.elem_)) { dynamic_map_[voice] = d; - // Output volume as velocity: must disable Midi_dynamic output - d->silent_ = true; + // Output volume as velocity: skip Midi_dynamic output for the + // current element. + return; } } - Audio_staff *audio_staff = get_audio_staff (voice); audio_staff->add_audio_item (ai); } } |