diff options
Diffstat (limited to 'src/mame/audio/turrett.cpp')
-rw-r--r-- | src/mame/audio/turrett.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/mame/audio/turrett.cpp b/src/mame/audio/turrett.cpp index 4d8414b0118..a2f9ecdb5af 100644 --- a/src/mame/audio/turrett.cpp +++ b/src/mame/audio/turrett.cpp @@ -47,7 +47,7 @@ void turrett_device::device_start() space().cache(m_cache); // Create the sound stream - m_stream = stream_alloc_legacy(0, 2, 44100); + m_stream = stream_alloc(0, 2, 44100); // Create the volume table for (int i = 0; i < 0x4f; ++i) @@ -78,20 +78,17 @@ void turrett_device::device_reset() //------------------------------------------------- -// sound_stream_update_legacy - update sound stream +// sound_stream_update - update sound stream //------------------------------------------------- -void turrett_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void turrett_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { // Silence the buffers - memset(outputs[0], 0x00, sizeof(stream_sample_t) * samples); - memset(outputs[1], 0x00, sizeof(stream_sample_t) * samples); + outputs[0].fill(0); + outputs[1].fill(0); for (int ch = 0; ch < SOUND_CHANNELS; ++ch) { - stream_sample_t *l = outputs[0]; - stream_sample_t *r = outputs[1]; - if (m_channels[ch].m_playing) { uint32_t &addr = m_channels[ch].m_address; @@ -104,7 +101,7 @@ void turrett_device::sound_stream_update_legacy(sound_stream &stream, stream_sam // Channels 30 and 31 expect interleaved stereo samples uint32_t incr = (ch >= 30) ? 2 : 1; - for (int s = 0; s < samples; ++s) + for (int s = 0; s < outputs[0].samples(); ++s) { int16_t sample = m_cache.read_word(addr << 1); @@ -116,8 +113,8 @@ void turrett_device::sound_stream_update_legacy(sound_stream &stream, stream_sam addr += incr; - *l++ += (sample * lvol) >> 17; - *r++ += (sample * rvol) >> 17; + outputs[0].add_int(s, (sample * lvol) >> 17, 32768); + outputs[1].add_int(s, (sample * rvol) >> 17, 32768); } } } |