summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2021-02-25 14:11:38 -0500
committer AJR <ajrhacker@users.noreply.github.com>2021-02-25 14:12:48 -0500
commitf2511bcb67d8f562617ee9fc5ce80a4f877dc9d3 (patch)
treee9d6836282bf188445da7daa47652cc9f895ec3a /src/devices
parent99cbd585626aa9a30986d4c9a73074304bf9b879 (diff)
x1_010: Clamp output samples to within range
Diffstat (limited to 'src/devices')
-rw-r--r--src/devices/sound/x1_010.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/devices/sound/x1_010.cpp b/src/devices/sound/x1_010.cpp
index b54fa6bd6cf..4ad9993c120 100644
--- a/src/devices/sound/x1_010.cpp
+++ b/src/devices/sound/x1_010.cpp
@@ -215,13 +215,13 @@ void x1_010_device::sound_stream_update(sound_stream &stream, std::vector<read_s
// if (m_sound_enable == 0) return;
+ auto &bufL = outputs[0];
+ auto &bufR = outputs[1];
for (int ch = 0; ch < NUM_CHANNELS; ch++)
{
X1_010_CHANNEL *reg = (X1_010_CHANNEL *)&(m_reg[ch*sizeof(X1_010_CHANNEL)]);
if ((reg->status & 1) != 0) // Key On
{
- auto &bufL = outputs[0];
- auto &bufR = outputs[1];
const int div = (reg->status & 0x80) ? 1 : 0;
if ((reg->status & 2) == 0) // PCM sampling
{
@@ -295,4 +295,10 @@ void x1_010_device::sound_stream_update(sound_stream &stream, std::vector<read_s
}
}
}
+
+ for (int i = 0; i < bufL.samples(); i++)
+ {
+ bufL.put(i, std::clamp(bufL.getraw(i), -1.0f, 1.0f));
+ bufR.put(i, std::clamp(bufR.getraw(i), -1.0f, 1.0f));
+ }
}