From f5985ab8694e94d688dd41462b934f0af96c6f12 Mon Sep 17 00:00:00 2001 From: MooglyGuy Date: Mon, 11 Mar 2019 17:37:43 +0100 Subject: -spg2xx: Scale SPU channel sum by a fixed 1/16 divider rather than by the active channel count. Fixes volume 'wobble'. [Ryan Holtz] --- src/devices/machine/spg2xx.cpp | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/src/devices/machine/spg2xx.cpp b/src/devices/machine/spg2xx.cpp index 2ea8e8ff10d..102d4802375 100644 --- a/src/devices/machine/spg2xx.cpp +++ b/src/devices/machine/spg2xx.cpp @@ -2871,7 +2871,6 @@ void spg2xx_device::sound_stream_update(sound_stream &stream, stream_sample_t ** { int32_t left_total = 0; int32_t right_total = 0; - int32_t active_count = 0; for (uint32_t channel = 0; channel < 16; channel++) { @@ -2897,8 +2896,6 @@ void spg2xx_device::sound_stream_update(sound_stream &stream, stream_sample_t ** sample = (sample * (int32_t)get_edd(channel)) >> 7; - active_count++; - int32_t vol = get_volume(channel); int32_t pan = get_pan(channel); @@ -2940,18 +2937,10 @@ void spg2xx_device::sound_stream_update(sound_stream &stream, stream_sample_t ** } } - if (active_count) - { - left_total /= active_count; - right_total /= active_count; - *out_l++ = (left_total * (int16_t)m_audio_regs[AUDIO_MAIN_VOLUME]) >> 7; - *out_r++ = (right_total * (int16_t)m_audio_regs[AUDIO_MAIN_VOLUME]) >> 7; - } - else - { - *out_l++ = 0; - *out_r++ = 0; - } + left_total >>= 4; + right_total >>= 4; + *out_l++ = (left_total * (int16_t)m_audio_regs[AUDIO_MAIN_VOLUME]) >> 7; + *out_r++ = (right_total * (int16_t)m_audio_regs[AUDIO_MAIN_VOLUME]) >> 7; } } -- cgit v1.2.3