okim6295, okim6376, okim9810: Explicitly clamp output streams to within range

This commit is contained in:
AJR 2021-08-23 23:42:25 -04:00
parent 756616a2b5
commit 92ffd8d026
3 changed files with 12 additions and 0 deletions

View File

@ -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));
}

View File

@ -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));
}

View File

@ -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));
}
}