diff options
Diffstat (limited to 'src/devices/sound/t6w28.cpp')
-rw-r--r-- | src/devices/sound/t6w28.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/devices/sound/t6w28.cpp b/src/devices/sound/t6w28.cpp index 6c024c37757..9525794e489 100644 --- a/src/devices/sound/t6w28.cpp +++ b/src/devices/sound/t6w28.cpp @@ -101,14 +101,14 @@ void t6w28_device::write(offs_t offset, uint8_t data) //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void t6w28_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void t6w28_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { int i; - stream_sample_t *buffer0 = outputs[0]; - stream_sample_t *buffer1 = outputs[1]; + auto &buffer0 = outputs[0]; + auto &buffer1 = outputs[1]; /* If the volume is 0, increase the counter */ @@ -119,11 +119,11 @@ void t6w28_device::sound_stream_update_legacy(sound_stream &stream, stream_sampl /* note that I do count += samples, NOT count = samples + 1. You might think */ /* it's the same since the volume is 0, but doing the latter could cause */ /* interferencies when the program is rapidly modulating the volume. */ - if (m_count[i] <= samples*STEP) m_count[i] += samples*STEP; + if (m_count[i] <= buffer0.samples()*STEP) m_count[i] += buffer0.samples()*STEP; } } - while (samples > 0) + for (int sampindex = 0; sampindex < buffer0.samples(); sampindex++) { int vol[8]; unsigned int out0, out1; @@ -252,10 +252,8 @@ void t6w28_device::sound_stream_update_legacy(sound_stream &stream, stream_sampl if (out0 > MAX_OUTPUT * STEP) out0 = MAX_OUTPUT * STEP; if (out1 > MAX_OUTPUT * STEP) out1 = MAX_OUTPUT * STEP; - *(buffer0++) = out0 / STEP; - *(buffer1++) = out1 / STEP; - - samples--; + buffer0.put_int(sampindex, out0 / STEP, 32768); + buffer1.put_int(sampindex, out1 / STEP, 32768); } } @@ -296,7 +294,7 @@ void t6w28_device::device_start() int i; m_sample_rate = clock() / 16; - m_channel = stream_alloc_legacy(0, 2, m_sample_rate); + m_channel = stream_alloc(0, 2, m_sample_rate); for (i = 0;i < 8;i++) m_volume[i] = 0; |