From: Dan Eble Date: Sat, 4 Jun 2016 19:42:21 +0000 (-0400) Subject: Dynamic_performer: eliminate an unnecessary variable X-Git-Tag: release/2.19.44-1~16 X-Git-Url: https://git.donarmstrong.com/lilypond.git?a=commitdiff_plain;h=421a3bdb97d13fd05623f24a8ae98308b1375464;p=lilypond.git Dynamic_performer: eliminate an unnecessary variable Use -1 to represent an unknown volume. --- diff --git a/lily/dynamic-performer.cc b/lily/dynamic-performer.cc index b24b7a6305..75b153ace8 100644 --- a/lily/dynamic-performer.cc +++ b/lily/dynamic-performer.cc @@ -41,7 +41,6 @@ private: Drul_array span_events_; Drul_array grow_dir_; Real last_volume_; - bool last_volume_initialized_; Audio_dynamic *absolute_; Audio_span_dynamic *span_dynamic_; Audio_span_dynamic *finished_span_dynamic_; @@ -49,8 +48,7 @@ private: Dynamic_performer::Dynamic_performer () { - last_volume_ = 0.0; - last_volume_initialized_ = false; + last_volume_ = -1; script_event_ = 0; absolute_ = 0; span_events_[LEFT] @@ -145,20 +143,18 @@ Dynamic_performer::process_music () last_volume_ = absolute_->volume_ = equalize_volume (volume); - last_volume_initialized_ = true; } Audio_element_info info (absolute_, script_event_); announce_element (info); } - if (!last_volume_initialized_) + if (last_volume_ < 0) { 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); @@ -180,14 +176,16 @@ Dynamic_performer::stop_translation_timestep () finished_span_dynamic_ = 0; } - if (absolute_ && absolute_->volume_ < 0) + if (absolute_) { - absolute_->volume_ = last_volume_; - } - else if (absolute_) - { - last_volume_ = absolute_->volume_; - last_volume_initialized_ = true; + if (absolute_->volume_ < 0) + { + absolute_->volume_ = last_volume_; + } + else + { + last_volume_ = absolute_->volume_; + } } absolute_ = 0;