summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/sound/uda1344.cpp
diff options
context:
space:
mode:
author Olivier Galibert <galibert@pobox.com>2025-04-14 11:31:53 +0200
committer Olivier Galibert <galibert@pobox.com>2025-04-14 22:28:31 +0200
commitcef6157803320544651bfc96457d2f8a6df0abd6 (patch)
treef8a64867e3d654cdcad5f4c24824ea82e2c77194 /src/devices/sound/uda1344.cpp
parent9473c027358e1a2d5c93d240a48052368f9d3b84 (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/uda1344.cpp')
-rw-r--r--src/devices/sound/uda1344.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/devices/sound/uda1344.cpp b/src/devices/sound/uda1344.cpp
index b8d445ef3b8..3031ea2e75d 100644
--- a/src/devices/sound/uda1344.cpp
+++ b/src/devices/sound/uda1344.cpp
@@ -88,25 +88,21 @@ void uda1344_device::device_reset()
memset(m_bufout, 0, sizeof(uint32_t) * 2);
}
-void uda1344_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
+void uda1344_device::sound_stream_update(sound_stream &stream)
{
- for (int channel = 0; channel < 2 && channel < outputs.size(); channel++)
+ for (int channel = 0; channel < 2 && channel < stream.output_count(); channel++)
{
- auto &output = outputs[channel];
uint32_t curout = m_bufout[channel];
uint32_t curin = m_bufin[channel];
// feed as much as we can
int sampindex;
- for (sampindex = 0; curout != curin && sampindex < output.samples(); sampindex++)
+ for (sampindex = 0; curout != curin && sampindex < stream.samples(); sampindex++)
{
- output.put(sampindex, stream_buffer::sample_t(m_buffer[channel][curout]) * m_volume);
+ stream.put(channel, sampindex, sound_stream::sample_t(m_buffer[channel][curout]) * m_volume);
curout = (curout + 1) % BUFFER_SIZE;
}
- // fill the rest with silence
- output.fill(0, sampindex);
-
// save the new output pointer
m_bufout[channel] = curout;
}
@@ -116,8 +112,8 @@ void uda1344_device::ingest_samples(int16_t left, int16_t right)
{
const int16_t samples[2] = { left, right };
- const stream_buffer::sample_t sample_scale = 1.0 / 32768.0;
- const stream_buffer::sample_t enable_scale = m_dac_enable ? 1.0 : 0.0;
+ const sound_stream::sample_t sample_scale = 1.0 / 32768.0;
+ const sound_stream::sample_t enable_scale = m_dac_enable ? 1.0 : 0.0;
m_stream->update();
@@ -126,7 +122,7 @@ void uda1344_device::ingest_samples(int16_t left, int16_t right)
int maxin = (m_bufout[channel] + BUFFER_SIZE - 1) % BUFFER_SIZE;
if (m_bufin[channel] != maxin)
{
- m_buffer[channel][m_bufin[channel]] = stream_buffer::sample_t(samples[channel]) * sample_scale * enable_scale;
+ m_buffer[channel][m_bufin[channel]] = sound_stream::sample_t(samples[channel]) * sample_scale * enable_scale;
m_bufin[channel] = (m_bufin[channel] + 1) % BUFFER_SIZE;
}
else