From 4849a5aebaf94b0ee95293308309bf43a5ff8da6 Mon Sep 17 00:00:00 2001 From: Aaron Giles Date: Sun, 20 Sep 2020 19:40:21 -0700 Subject: sound: Add a few new helpers to write_stream_view * put_clamp - clamps the input value before writing * put_int - takes an integer and coverts it to float * put_int_clamp - converts and clamps an integer * add_int - converts an int and adds to the current sample --- src/devices/sound/huc6230.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/devices/sound/huc6230.cpp') diff --git a/src/devices/sound/huc6230.cpp b/src/devices/sound/huc6230.cpp index 8c7e9bd91a7..31e143fea8c 100644 --- a/src/devices/sound/huc6230.cpp +++ b/src/devices/sound/huc6230.cpp @@ -23,7 +23,6 @@ constexpr int clamp(int val, int min, int max) { return std::min(max, std::max(m void huc6230_device::sound_stream_update(sound_stream &stream, std::vector const &inputs, std::vector &outputs) { - constexpr stream_buffer::sample_t sample_scale = 1.0 / 32768.0; for (int i = 0; i < outputs[0].samples(); i++) { s32 samp0 = inputs[0].get(i) * 32768.0; @@ -40,8 +39,8 @@ void huc6230_device::sound_stream_update(sound_stream &stream, std::vectorm_output * channel->m_rvol) >> 3), -32768, 32767); } - outputs[0].put(i, stream_buffer::sample_t(samp0) * sample_scale); - outputs[1].put(i, stream_buffer::sample_t(samp1) * sample_scale); + outputs[0].put_int(i, samp0, 32768); + outputs[1].put_int(i, samp1, 32768); } } -- cgit v1.2.3