diff options
Diffstat (limited to 'src/devices/sound/es5503.cpp')
-rw-r--r-- | src/devices/sound/es5503.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/devices/sound/es5503.cpp b/src/devices/sound/es5503.cpp index f3127b69261..2344a7c695b 100644 --- a/src/devices/sound/es5503.cpp +++ b/src/devices/sound/es5503.cpp @@ -228,11 +228,21 @@ void es5503_device::device_start() save_item(NAME(oscillators[osc].irqpend), osc); } - output_rate = (clock()/8)/34; // (input clock / 8) / # of oscs. enabled + 2 + output_rate = (clock() / 8) / (2 + oscsenabled); m_stream = machine().sound().stream_alloc(*this, 0, output_channels, output_rate); m_timer = timer_alloc(0, nullptr); - m_timer->adjust(attotime::from_hz(output_rate), 0, attotime::from_hz(output_rate)); + attotime update_rate = output_rate ? attotime::from_hz(output_rate) : attotime::never; + m_timer->adjust(update_rate, 0, update_rate); +} + +void es5503_device::device_clock_changed() +{ + output_rate = (clock() / 8) / (2 + oscsenabled); + m_stream->set_sample_rate(output_rate); + + attotime update_rate = output_rate ? attotime::from_hz(output_rate) : attotime::never; + m_timer->adjust(update_rate, 0, update_rate); } void es5503_device::device_reset() @@ -416,12 +426,16 @@ WRITE8_MEMBER( es5503_device::write ) break; case 0xe1: // oscillator enable + { oscsenabled = (data>>1) & 0x1f; output_rate = (clock()/8)/(2+oscsenabled); m_stream->set_sample_rate(output_rate); - m_timer->adjust(attotime::from_hz(output_rate), 0, attotime::from_hz(output_rate)); + + attotime update_rate = output_rate ? attotime::from_hz(output_rate) : attotime::never; + m_timer->adjust(update_rate, 0, update_rate); break; + } case 0xe2: // A/D converter break; |