summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author cam900 <dbtlrchl@naver.com>2020-09-24 18:50:09 +0900
committer GitHub <noreply@github.com>2020-09-24 12:50:09 +0300
commitcfa4fa4ae4fdb54d8264fc16ee6793b1a6fca702 (patch)
treec5dd29822b53c9c5a79eec33cb20cc47468184b7 /src
parent210d93e33fbc26db858a371dd6d67cbdd41f3f24 (diff)
ay8910.cpp: Fix noise rate regression (#7283)
Diffstat (limited to 'src')
-rw-r--r--src/devices/sound/ay8910.cpp5
-rw-r--r--src/devices/sound/ay8910.h2
2 files changed, 3 insertions, 4 deletions
diff --git a/src/devices/sound/ay8910.cpp b/src/devices/sound/ay8910.cpp
index 6ba9691fc37..8ba53fb8b3f 100644
--- a/src/devices/sound/ay8910.cpp
+++ b/src/devices/sound/ay8910.cpp
@@ -1125,8 +1125,9 @@ void ay8910_device::sound_stream_update(sound_stream &stream, std::vector<read_s
* channels.
*/
m_count_noise = 0;
+ m_prescale_noise ^= 1;
- if (!m_prescale_noise)
+ if (!m_prescale_noise || is_expanded_mode()) // AY8930 noise generator rate is twice compares as compatibility mode
{
/* The Random Number Generator of the 8910 is a 17-bit shift */
/* register. The input to the shift register is bit0 XOR bit3 */
@@ -1135,9 +1136,7 @@ void ay8910_device::sound_stream_update(sound_stream &stream, std::vector<read_s
// TODO : get actually algorithm for AY8930
m_rng ^= (((m_rng & 1) ^ ((m_rng >> 3) & 1)) << 17);
m_rng >>= 1;
- m_prescale_noise = 1;
}
- m_prescale_noise--;
}
for (int chan = 0; chan < NUM_CHANNELS; chan++)
diff --git a/src/devices/sound/ay8910.h b/src/devices/sound/ay8910.h
index 373a850b662..407de93f8a3 100644
--- a/src/devices/sound/ay8910.h
+++ b/src/devices/sound/ay8910.h
@@ -268,7 +268,7 @@ private:
inline u8 get_envelope_chan(int chan) { return is_expanded_mode() ? chan : 0; }
inline bool noise_enable(int chan) { return BIT(m_regs[AY_ENABLE], 3 + chan); }
- inline u8 noise_period() { return is_expanded_mode() ? m_regs[AY_NOISEPER] & 0xff : (m_regs[AY_NOISEPER] & 0x1f) << 1; }
+ inline u8 noise_period() { return is_expanded_mode() ? m_regs[AY_NOISEPER] & 0xff : m_regs[AY_NOISEPER] & 0x1f; }
inline u8 noise_output() { return m_rng & 1; }
inline bool is_expanded_mode() { return ((m_feature & PSG_HAS_EXPANDED_MODE) && ((m_mode & 0xe) == 0xa)); }