summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/sound/huc6230.cpp
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2020-09-20 19:40:21 -0700
committer Aaron Giles <aaron@aarongiles.com>2020-09-20 19:40:21 -0700
commit4849a5aebaf94b0ee95293308309bf43a5ff8da6 (patch)
tree4700e4cb5e458f84c923708d045b5f8d547c2625 /src/devices/sound/huc6230.cpp
parent6eaa5f09467165e144da9369dc51aa6cfc500cd0 (diff)
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
Diffstat (limited to 'src/devices/sound/huc6230.cpp')
-rw-r--r--src/devices/sound/huc6230.cpp5
1 files changed, 2 insertions, 3 deletions
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<read_stream_view> const &inputs, std::vector<write_stream_view> &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::vector<read_
samp1 = clamp(samp1 + ((channel->m_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);
}
}