summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/sound/upd934g.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/sound/upd934g.cpp')
-rw-r--r--src/devices/sound/upd934g.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/devices/sound/upd934g.cpp b/src/devices/sound/upd934g.cpp
index fecb6fc8a18..fc25628abbd 100644
--- a/src/devices/sound/upd934g.cpp
+++ b/src/devices/sound/upd934g.cpp
@@ -49,7 +49,7 @@ upd934g_device::upd934g_device(const machine_config &mconfig, const char *tag, d
void upd934g_device::device_start()
{
// create sound stream
- m_stream = stream_alloc_legacy(0, 4, 20000);
+ m_stream = stream_alloc(0, 4, 20000);
// resolve callbacks
m_data_cb.resolve_safe(0);
@@ -81,32 +81,33 @@ void upd934g_device::device_reset()
}
//-------------------------------------------------
-// sound_stream_update_legacy - handle update requests for
+// sound_stream_update - handle update requests for
// our sound stream
//-------------------------------------------------
-void upd934g_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)
+void upd934g_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
for (unsigned ch = 0; ch < 4; ch++)
{
- std::fill(&outputs[ch][0], &outputs[ch][samples], 0);
-
if (m_ready && m_channel[ch].playing != -1)
{
uint16_t end = m_addr[m_channel[ch].playing + 1] - 1;
- for (unsigned i = 0; i < samples; i++)
+ for (unsigned i = 0; i < outputs[ch].samples(); i++)
{
int8_t raw = static_cast<int8_t>(m_data_cb(m_channel[ch].pos));
- outputs[ch][i] = raw * (m_channel[ch].volume + 1) * 64;
+ outputs[ch].put_int(i, raw * (m_channel[ch].volume + 1), 32768 / 64);
if (++m_channel[ch].pos >= end)
{
m_channel[ch].playing = -1;
+ outputs[ch].fill(0, i + 1);
break;
}
}
}
+ else
+ outputs[ch].fill(0);
}
}