summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/sound/astrocde.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/sound/astrocde.cpp')
-rw-r--r--src/devices/sound/astrocde.cpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/devices/sound/astrocde.cpp b/src/devices/sound/astrocde.cpp
index 63f900b4806..17df6999989 100644
--- a/src/devices/sound/astrocde.cpp
+++ b/src/devices/sound/astrocde.cpp
@@ -126,12 +126,12 @@ void astrocade_io_device::device_start()
//-------------------------------------------------
-// sound_stream_update - handle a stream update
+// sound_stream_update_legacy - handle a stream update
//-------------------------------------------------
-void astrocade_io_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
+void astrocade_io_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
{
- stream_sample_t *dest = outputs[0];
+ auto &dest = outputs[0];
uint16_t noise_state;
uint8_t master_count;
uint8_t noise_clock;
@@ -142,17 +142,16 @@ void astrocade_io_device::sound_stream_update(sound_stream &stream, stream_sampl
noise_state = m_noise_state;
/* loop over samples */
- while (samples > 0)
+ int samples_this_time;
+ constexpr stream_buffer::sample_t sample_scale = 1.0f / 60.0f;
+ for (int sampindex = 0; sampindex < dest.samples(); sampindex += samples_this_time)
{
stream_sample_t cursample = 0;
- int samples_this_time;
- int samp;
/* compute the number of cycles until the next master oscillator reset */
/* or until the next noise boundary */
- samples_this_time = std::min(samples, 256 - master_count);
+ samples_this_time = std::min<int>(dest.samples() - sampindex, 256 - master_count);
samples_this_time = std::min(samples_this_time, 64 - noise_clock);
- samples -= samples_this_time;
/* sum the output of the tone generators */
if (m_a_state)
@@ -167,9 +166,7 @@ void astrocade_io_device::sound_stream_update(sound_stream &stream, stream_sampl
cursample += m_reg[7] >> 4;
/* scale to max and output */
- cursample = cursample * 32767 / 60;
- for (samp = 0; samp < samples_this_time; samp++)
- *dest++ = cursample;
+ dest.fill(stream_buffer::sample_t(cursample) * sample_scale, sampindex, samples_this_time);
/* clock the noise; a 2-bit counter clocks a 4-bit counter which clocks the LFSR */
noise_clock += samples_this_time;