diff options
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/backends/opensl.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Alc/backends/opensl.c b/Alc/backends/opensl.c index 32f6fa7d..84e73f7b 100644 --- a/Alc/backends/opensl.c +++ b/Alc/backends/opensl.c @@ -282,13 +282,16 @@ static ALCboolean opensl_reset_playback(ALCdevice *Device) //int sampleRate = Integer.parseInt(srateStr); sampleRate = JCALL(env,CallStaticIntMethod)(int_cls, int_parseint, srateStr); + TRACE("Got system sample rate %uhz\n", sampleRate); if(!sampleRate) sampleRate = Device->Frequency; else sampleRate = maxu(sampleRate, MIN_OUTPUT_RATE); } if(sampleRate != Device->Frequency) { - Device->NumUpdates = Device->NumUpdates * sampleRate / Device->Frequency; + Device->NumUpdates = (Device->NumUpdates*sampleRate + (Device->Frequency>>1)) / + Device->Frequency; + Device->NumUpdates = maxu(Device->NumUpdates, 2); Device->Frequency = sampleRate; } Device->FmtChans = DevFmtStereo; |