mirror of
https://github.com/holub/mame
synced 2025-04-21 16:01:56 +03:00
okim6295, okim6376, okim9810: Explicitly clamp output streams to within range
This commit is contained in:
parent
756616a2b5
commit
92ffd8d026
@ -183,6 +183,9 @@ void okim6295_device::sound_stream_update(sound_stream &stream, std::vector<read
|
||||
// iterate over voices and accumulate sample data
|
||||
for (auto & elem : m_voice)
|
||||
elem.generate_adpcm(*this, outputs[0]);
|
||||
|
||||
for (int i = 0; i < outputs[0].samples(); i++)
|
||||
outputs[0].put(i, std::clamp(outputs[0].getraw(i), -1.0f, 1.0f));
|
||||
}
|
||||
|
||||
|
||||
|
@ -615,4 +615,7 @@ void okim6376_device::sound_stream_update(sound_stream &stream, std::vector<read
|
||||
sampindex += samples;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < outputs[0].samples(); i++)
|
||||
outputs[0].put(i, std::clamp(outputs[0].getraw(i), -1.0f, 1.0f));
|
||||
}
|
||||
|
@ -223,6 +223,12 @@ void okim9810_device::sound_stream_update(sound_stream &stream, std::vector<read
|
||||
// iterate over voices and accumulate sample data
|
||||
for (auto & elem : m_voice)
|
||||
elem.generate_audio(*this, outputs, m_global_volume, m_filter_type);
|
||||
|
||||
for (int i = 0; i < outputs[0].samples(); i++)
|
||||
{
|
||||
outputs[0].put(i, std::clamp(outputs[0].getraw(i), -1.0f, 1.0f));
|
||||
outputs[1].put(i, std::clamp(outputs[1].getraw(i), -1.0f, 1.0f));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user