aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/alc.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-04-26 18:04:22 -0700
committerChris Robinson <[email protected]>2019-04-26 18:04:22 -0700
commit9e4ee500b61462c205ed588c31a045bd95215cdc (patch)
tree6ecded32c953d11aec4b5196f9f76f52b570e47c /Alc/alc.cpp
parentb29be3b39ea2d128f9b380fb8d079815ed707c7c (diff)
Scale the update size with sample rate changes
Diffstat (limited to 'Alc/alc.cpp')
-rw-r--r--Alc/alc.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/Alc/alc.cpp b/Alc/alc.cpp
index edea3846..7c218785 100644
--- a/Alc/alc.cpp
+++ b/Alc/alc.cpp
@@ -1754,6 +1754,8 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
{
freq = maxi(freq, MIN_OUTPUT_RATE);
+ device->UpdateSize = (device->UpdateSize*freq + device->Frequency/2) /
+ device->Frequency;
device->BufferSize = (device->BufferSize*freq + device->Frequency/2) /
device->Frequency;
@@ -1763,9 +1765,6 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
ConfigValueUInt(devname, nullptr, "period_size", &device->UpdateSize);
device->UpdateSize = clampu(device->UpdateSize, 64, 8192);
- /* SSE and Neon do best with the update size being a multiple of 4. */
- if((CPUCapFlags&(CPU_CAP_SSE|CPU_CAP_NEON)) != 0)
- device->UpdateSize = (device->UpdateSize+3u)&~3u;
ALuint periods{};
if(ConfigValueUInt(devname, nullptr, "periods", &periods))
@@ -3765,6 +3764,7 @@ START_API_FUNC
ERR("%uhz request clamped to %uhz minimum\n", freq, MIN_OUTPUT_RATE);
freq = MIN_OUTPUT_RATE;
}
+ device->UpdateSize = (device->UpdateSize*freq + device->Frequency/2) / device->Frequency;
device->BufferSize = (device->BufferSize*freq + device->Frequency/2) / device->Frequency;
device->Frequency = freq;
device->Flags |= DEVICE_FREQUENCY_REQUEST;
@@ -3772,8 +3772,6 @@ START_API_FUNC
ConfigValueUInt(deviceName, nullptr, "period_size", &device->UpdateSize);
device->UpdateSize = clampu(device->UpdateSize, 64, 8192);
- if((CPUCapFlags&(CPU_CAP_SSE|CPU_CAP_NEON)) != 0)
- device->UpdateSize = (device->UpdateSize+3u)&~3u;
ALuint periods{};
if(ConfigValueUInt(deviceName, nullptr, "periods", &periods))