diff --git a/Components/AY38910/AY38910.cpp b/Components/AY38910/AY38910.cpp index e4cb90027..76612c59d 100644 --- a/Components/AY38910/AY38910.cpp +++ b/Components/AY38910/AY38910.cpp @@ -111,20 +111,19 @@ void AY38910SampleSource::set_output_mixing(float a_left, float b_lef template void AY38910SampleSource::advance() { -#define step_channel(c) \ - if(tone_counters_[c]) tone_counters_[c]--;\ - else {\ - tone_outputs_[c] ^= 1;\ - tone_counters_[c] = tone_periods_[c] << 1;\ - } + const auto step_channel = [&](int c) { + if(tone_counters_[c]) --tone_counters_[c]; + else { + tone_outputs_[c] ^= 1; + tone_counters_[c] = tone_periods_[c] << 1; + } + }; // Update the tone channels. step_channel(0); step_channel(1); step_channel(2); -#undef step_channel - // Update the noise generator. This recomputes the new bit repeatedly but harmlessly, only shifting // it into the official 17 upon divider underflow. if(noise_counter_) noise_counter_--;