sound/gt155.cpp: Increased range of filter output to avoid overflow. (#13454)

This commit is contained in:
Devin Acker 2025-03-12 10:57:53 -04:00 committed by GitHub
parent 06183fc297
commit 515a8c31e8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 3 deletions

View File

@ -129,10 +129,9 @@ void gt155_device::mix_sample(voice_t &voice, s64 &left, s64 &right)
// interpolate, apply envelope + channel gain and lowpass, and mix into output
s64 sample = voice.m_sample_last + (s64(voice.m_sample - voice.m_sample_last) * voice.m_addr_frac >> 15);
// TODO: does this produce accurate filter output?
sample = sample * voice.m_filter_gain;
sample += s32(voice.m_filter_out) * (voice.m_filter ^ 0xffff);
sample += s64(voice.m_filter_out) * (voice.m_filter ^ 0xffff);
sample >>= 16;
voice.m_filter_out = sample;

View File

@ -60,7 +60,7 @@ private:
u32 m_filter_gain = 0;
u16 m_filter = 0;
s16 m_filter_out = 0;
s32 m_filter_out = 0;
u16 m_filter_unk = 0;
s16 m_sample_last = 0;