From cef6157803320544651bfc96457d2f8a6df0abd6 Mon Sep 17 00:00:00 2001 From: Olivier Galibert Date: Mon, 14 Apr 2025 11:31:53 +0200 Subject: New sound infrastructure. Should be added soon: - mute - lua hookup (with documentation) - speaker/microphone resampling To be added a little later: - compression - reverb Needs to be added by someone else: - coreaudio - direct - portaudio - xaudio2 - js --- src/devices/sound/hc55516.cpp | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) (limited to 'src/devices/sound/hc55516.cpp') diff --git a/src/devices/sound/hc55516.cpp b/src/devices/sound/hc55516.cpp index 885751c1a6a..0bd36ae381f 100644 --- a/src/devices/sound/hc55516.cpp +++ b/src/devices/sound/hc55516.cpp @@ -197,15 +197,12 @@ void cvsd_device_base::process_bit(bool bit, bool clock_state) // sound_stream_update - handle a stream update //------------------------------------------------- -void cvsd_device_base::sound_stream_update(sound_stream &stream, std::vector const &inputs, std::vector &outputs) +void cvsd_device_base::sound_stream_update(sound_stream &stream) { // Stub, just return silence - auto &buffer = outputs[0]; - - m_samples_generated += buffer.samples(); + m_samples_generated += stream.samples(); if (m_samples_generated >= SAMPLE_RATE) m_samples_generated -= SAMPLE_RATE; - buffer.fill(0); } @@ -356,16 +353,14 @@ void hc55516_device::process_bit(bool bit, bool clock_state) // sound_stream_update_legacy - handle a stream update //------------------------------------------------- -void hc55516_device::sound_stream_update(sound_stream &stream, std::vector const &inputs, std::vector &outputs) +void hc55516_device::sound_stream_update(sound_stream &stream) { - auto &buffer = outputs[0]; - if (is_external_oscillator()) { // external oscillator - for (int i = 0; i < buffer.samples(); i++) + for (int i = 0; i < stream.samples(); i++) { - buffer.put_int(i, m_next_sample, 32768); + stream.put_int(0, i, m_next_sample, 32768); m_samples_generated++; @@ -384,8 +379,8 @@ void hc55516_device::sound_stream_update(sound_stream &stream, std::vector const &inputs, std::vector &outputs) +void mc3417_device::sound_stream_update(sound_stream &stream) { - auto &buffer = outputs[0]; - if (!is_external_oscillator()) { // track how many samples we've updated without a clock; if it's been more than 1/32 of a second, output silence - m_samples_generated += buffer.samples(); + m_samples_generated += stream.samples(); if (m_samples_generated > SAMPLE_RATE / 32) { m_samples_generated = SAMPLE_RATE; @@ -509,16 +502,16 @@ void mc3417_device::sound_stream_update(sound_stream &stream, std::vector