diff options
Diffstat (limited to 'src/devices/sound/multipcm.cpp')
-rw-r--r-- | src/devices/sound/multipcm.cpp | 38 |
1 files changed, 9 insertions, 29 deletions
diff --git a/src/devices/sound/multipcm.cpp b/src/devices/sound/multipcm.cpp index c4a5892990f..4ea099b947a 100644 --- a/src/devices/sound/multipcm.cpp +++ b/src/devices/sound/multipcm.cpp @@ -479,7 +479,7 @@ void multipcm_device::device_start() const float clock_divider = 180.0f; m_rate = (float)clock() / clock_divider; - m_stream = stream_alloc_legacy(0, 2, m_rate); + m_stream = stream_alloc(0, 2, m_rate); // Volume + pan table m_left_pan_table = make_unique_clear<int32_t[]>(0x800); @@ -575,7 +575,7 @@ void multipcm_device::device_start() save_item(NAME(m_address)); // Slots - m_slots = make_unique_clear<slot_t []>(28); + m_slots = std::make_unique<slot_t []>(28); save_pointer(STRUCT_MEMBER(m_slots, m_regs), 28); save_pointer(STRUCT_MEMBER(m_slots, m_playing), 28); @@ -628,22 +628,10 @@ void multipcm_device::device_clock_changed() } //----------------------------------------------------- -// clamp_to_int16 - clamp a 32-bit value to 16 bits +// convert_to_stream_sample - clamp a 32-bit value to +// 16 bits and convert to a stream_buffer::sample_t //----------------------------------------------------- -int16_t multipcm_device::clamp_to_int16(int32_t value) -{ - if (value < -32768) - { - return -32768; - } - else if (value > 32767) - { - return 32767; - } - return (int16_t)value; -} - #if MULTIPCM_LOG_SAMPLES void multipcm_device::dump_sample(slot_t &slot) { @@ -677,20 +665,12 @@ void multipcm_device::dump_sample(slot_t &slot) #endif //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void multipcm_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int32_t samples) +void multipcm_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *datap[2]; - - datap[0] = outputs[0]; - datap[1] = outputs[1]; - - memset(datap[0], 0, sizeof(*datap[0]) * samples); - memset(datap[1], 0, sizeof(*datap[1]) * samples); - - for (int32_t i = 0; i < samples; ++i) + for (int32_t i = 0; i < outputs[0].samples(); ++i) { int32_t smpl = 0; int32_t smpr = 0; @@ -741,8 +721,8 @@ void multipcm_device::sound_stream_update_legacy(sound_stream &stream, stream_sa } } - datap[0][i] = clamp_to_int16(smpl); - datap[1][i] = clamp_to_int16(smpr); + outputs[0].put_int_clamp(i, smpl, 32768); + outputs[1].put_int_clamp(i, smpr, 32768); } } |