diff options
author | 2020-09-20 19:40:21 -0700 | |
---|---|---|
committer | 2020-09-20 19:40:21 -0700 | |
commit | 4849a5aebaf94b0ee95293308309bf43a5ff8da6 (patch) | |
tree | 4700e4cb5e458f84c923708d045b5f8d547c2625 /src/devices/sound/ics2115.cpp | |
parent | 6eaa5f09467165e144da9369dc51aa6cfc500cd0 (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/ics2115.cpp')
-rw-r--r-- | src/devices/sound/ics2115.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/devices/sound/ics2115.cpp b/src/devices/sound/ics2115.cpp index 98c5916c253..80e4aa9cd09 100644 --- a/src/devices/sound/ics2115.cpp +++ b/src/devices/sound/ics2115.cpp @@ -391,7 +391,6 @@ int ics2115_device::fill_output(ics2115_voice& voice, std::vector<write_stream_v const u16 fine = 1 << (3*(voice.vol.incr >> 6)); voice.vol.add = (voice.vol.incr & 0x3f)<< (10 - fine); - constexpr stream_buffer::sample_t sample_scale = 1.0 / (32768.0 * (1 << (5 + volume_bits))); for (int i = 0; i < outputs[0].samples(); i++) { const u32 volacc = (voice.vol.acc >> 10) & 0xffff; @@ -411,8 +410,8 @@ int ics2115_device::fill_output(ics2115_voice& voice, std::vector<write_stream_v { /*if (voice.playing()) {*/ - outputs[0].add(i, stream_buffer::sample_t(sample * vleft) * sample_scale); - outputs[1].add(i, stream_buffer::sample_t(sample * vright) * sample_scale); + outputs[0].add_int(i, (sample * vleft) >> (5 + volume_bits), 32768); + outputs[1].add_int(i, (sample * vright) >> (5 + volume_bits), 32768); } voice.update_ramp(); |