diff options
author | 2025-04-14 11:31:53 +0200 | |
---|---|---|
committer | 2025-04-14 22:28:31 +0200 | |
commit | cef6157803320544651bfc96457d2f8a6df0abd6 (patch) | |
tree | f8a64867e3d654cdcad5f4c24824ea82e2c77194 /src/devices/sound/hc55516.cpp | |
parent | 9473c027358e1a2d5c93d240a48052368f9d3b84 (diff) |
New sound infrastructure.sound
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
Diffstat (limited to 'src/devices/sound/hc55516.cpp')
-rw-r--r-- | src/devices/sound/hc55516.cpp | 37 |
1 files changed, 15 insertions, 22 deletions
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<read_stream_view> const &inputs, std::vector<write_stream_view> &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<read_stream_view> const &inputs, std::vector<write_stream_view> &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<read_ // software driven clock else { - for (int i = 0; i < buffer.samples(); i++) - buffer.put_int(i, m_next_sample, 32768); + for (int i = 0; i < stream.samples(); i++) + stream.put_int(0, i, m_next_sample, 32768); } } @@ -493,14 +488,12 @@ void mc3417_device::process_bit(bool bit, bool clock_state) } } -void mc3417_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &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<read_s } // compute the interpolation slope - stream_buffer::sample_t sample = m_curr_sample; - stream_buffer::sample_t slope = (m_next_sample - sample) / buffer.samples(); + sound_stream::sample_t sample = m_curr_sample; + sound_stream::sample_t slope = (m_next_sample - sample) / stream.samples(); m_curr_sample = m_next_sample; if (is_external_oscillator()) { // external oscillator - for (int i = 0; i < buffer.samples(); i++, sample += slope) + for (int i = 0; i < stream.samples(); i++, sample += slope) { - buffer.put(i, sample); + stream.put(0, i, sample); m_samples_generated++; @@ -537,8 +530,8 @@ void mc3417_device::sound_stream_update(sound_stream &stream, std::vector<read_s // software driven clock else { - for (int i = 0; i < buffer.samples(); i++, sample += slope) - buffer.put(i, sample); + for (int i = 0; i < stream.samples(); i++, sample += slope) + stream.put(0, i, sample); } } |