summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/sound/sp0250.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/sound/sp0250.cpp')
-rw-r--r--src/devices/sound/sp0250.cpp14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/devices/sound/sp0250.cpp b/src/devices/sound/sp0250.cpp
index e18143a29b0..da836cde53c 100644
--- a/src/devices/sound/sp0250.cpp
+++ b/src/devices/sound/sp0250.cpp
@@ -259,12 +259,12 @@ void sp0250_device::sound_stream_update(sound_stream &stream, std::vector<read_s
if (!m_pwm_mode)
{
constexpr stream_buffer::sample_t sample_scale = 1.0 / 128.0;
- for (int sampindex = 0; sampindex < output.samples(); sampindex++)
- output.put(sampindex, stream_buffer::sample_t(next()) * sample_scale);
+ while (!output.done())
+ output.put(stream_buffer::sample_t(next()) * sample_scale);
}
else
{
- for (int sampindex = 0; sampindex < output.samples(); )
+ while (!output.done())
{
// see where we're at in the current PWM cycle
if (m_pwm_index >= PWM_CLOCKS)
@@ -291,14 +291,8 @@ void sp0250_device::sound_stream_update(sound_stream &stream, std::vector<read_s
remaining = PWM_CLOCKS - m_pwm_index;
}
- // clamp to the number of samples requested and advance the counters
- if (remaining > output.samples() - sampindex)
- remaining = output.samples() - sampindex;
- m_pwm_index += remaining;
-
// fill the output
- while (remaining-- != 0)
- outputs[0].put(sampindex++, value);
+ m_pwm_index += outputs[0].fill(value, remaining);
}
}
}