mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-20 19:45:20 +00:00
Clamp volume in cellAudioAdd/2c/6c/Data
Same as firmware, NaN and Inf are flushed to zero.
This commit is contained in:
parent
cd6b6c8a4f
commit
8d5ef2c7b9
1 changed files with 6 additions and 0 deletions
|
@ -1469,6 +1469,8 @@ error_code cellAudioAddData(u32 portNum, vm::ptr<float> src, u32 samples, float
|
|||
|
||||
lock.unlock();
|
||||
|
||||
volume = std::isfinite(volume) ? std::clamp(volume, -16.f, 16.f) : 0.f;
|
||||
|
||||
for (u32 i = 0; i < samples * port.num_channels; i++)
|
||||
{
|
||||
dst[i] += src[i] * volume; // mix all channels
|
||||
|
@ -1508,6 +1510,8 @@ error_code cellAudioAdd2chData(u32 portNum, vm::ptr<float> src, u32 samples, flo
|
|||
|
||||
lock.unlock();
|
||||
|
||||
volume = std::isfinite(volume) ? std::clamp(volume, -16.f, 16.f) : 0.f;
|
||||
|
||||
if (port.num_channels == 2)
|
||||
{
|
||||
for (u32 i = 0; i < samples; i++)
|
||||
|
@ -1574,6 +1578,8 @@ error_code cellAudioAdd6chData(u32 portNum, vm::ptr<float> src, float volume)
|
|||
|
||||
lock.unlock();
|
||||
|
||||
volume = std::isfinite(volume) ? std::clamp(volume, -16.f, 16.f) : 0.f;
|
||||
|
||||
if (port.num_channels == 6)
|
||||
{
|
||||
for (u32 i = 0; i < 256; i++)
|
||||
|
|
Loading…
Add table
Reference in a new issue