mirror of
https://github.com/holub/mame
synced 2025-07-01 00:09:18 +03:00
x1_010: Clamp output samples to within range
This commit is contained in:
parent
99cbd58562
commit
f2511bcb67
@ -215,13 +215,13 @@ void x1_010_device::sound_stream_update(sound_stream &stream, std::vector<read_s
|
|||||||
|
|
||||||
// if (m_sound_enable == 0) return;
|
// if (m_sound_enable == 0) return;
|
||||||
|
|
||||||
|
auto &bufL = outputs[0];
|
||||||
|
auto &bufR = outputs[1];
|
||||||
for (int ch = 0; ch < NUM_CHANNELS; ch++)
|
for (int ch = 0; ch < NUM_CHANNELS; ch++)
|
||||||
{
|
{
|
||||||
X1_010_CHANNEL *reg = (X1_010_CHANNEL *)&(m_reg[ch*sizeof(X1_010_CHANNEL)]);
|
X1_010_CHANNEL *reg = (X1_010_CHANNEL *)&(m_reg[ch*sizeof(X1_010_CHANNEL)]);
|
||||||
if ((reg->status & 1) != 0) // Key On
|
if ((reg->status & 1) != 0) // Key On
|
||||||
{
|
{
|
||||||
auto &bufL = outputs[0];
|
|
||||||
auto &bufR = outputs[1];
|
|
||||||
const int div = (reg->status & 0x80) ? 1 : 0;
|
const int div = (reg->status & 0x80) ? 1 : 0;
|
||||||
if ((reg->status & 2) == 0) // PCM sampling
|
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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user