X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fstaff-performer.cc;h=5aafabe512bbf64e5874c569b2205d630d5dfd85;hb=93b7a6ff072d73dcdd41da59cd18da8aa8d8e8cb;hp=1f34290aac4451d185499cb8c01678daff86534f;hpb=41bf7534250b6f0b60d74d082b5dfc26a5387144;p=lilypond.git diff --git a/lily/staff-performer.cc b/lily/staff-performer.cc index 1f34290aac..5aafabe512 100644 --- a/lily/staff-performer.cc +++ b/lily/staff-performer.cc @@ -50,7 +50,7 @@ private: int get_channel (string instrument); Audio_staff* get_audio_staff (string voice); Audio_staff* new_audio_staff (string voice); - Real get_dynamic (string voice); + Audio_dynamic* get_dynamic (string voice); string instrument_string_; int channel_; @@ -60,7 +60,7 @@ private: Audio_tempo *tempo_; map staff_map_; map channel_map_; - map dynamic_map_; + map dynamic_map_; static map static_channel_map_; static int channel_count_; }; @@ -140,10 +140,10 @@ Staff_performer::get_audio_staff (string voice) return new_audio_staff (voice); } -Real +Audio_dynamic* Staff_performer::get_dynamic (string voice) { - map::const_iterator i = dynamic_map_.find (voice); + map::const_iterator i = dynamic_map_.find (voice); if (i != dynamic_map_.end ()) return i->second; return 0; @@ -266,15 +266,19 @@ Staff_performer::acknowledge_audio_element (Audio_element_info inf) } Audio_staff* audio_staff = get_audio_staff (voice); ai->channel_ = channel_; - // Output volume as velocity and disable Midi_dynamic output - if (Audio_dynamic *d = dynamic_cast (inf.elem_)) + bool encode_dynamics_as_velocity_ = true; + if (encode_dynamics_as_velocity_) { - dynamic_map_[voice] = d->volume_; - d->volume_ = -1; + if (Audio_dynamic *d = dynamic_cast (inf.elem_)) + { + dynamic_map_[voice] = d; + // Output volume as velocity: must disable Midi_dynamic output + d->silent_ = true; + } + if (Audio_dynamic *d = get_dynamic (voice)) + if (Audio_note *n = dynamic_cast (inf.elem_)) + n->dynamic_ = d; } - if (Real d = get_dynamic (voice)) - if (Audio_note *n = dynamic_cast (inf.elem_)) - n->volume_ = d; audio_staff->add_audio_item (ai); } }