Fix audio related crash.

In some cases, __DisplayGetFPS can return wildly negative values and cause a crash based on how we compute samples. Known occurrence in Power Stone Collection while loading Power Stone.
This commit is contained in:
clobber
2014-07-04 19:38:27 -05:00
parent 5d686c8d6c
commit 92cfef3db3
+2
View File
@@ -171,6 +171,8 @@
float vps, fps;
__DisplayGetFPS(&vps, &_frameInterval, &fps);
if(_frameInterval <= 0) _frameInterval = 60;
int samplesWritten = NativeMix((short *)_soundBuffer, SAMPLERATE / _frameInterval);
[[self ringBufferAtIndex:0] write:_soundBuffer maxLength:sizeof(uint16_t) * samplesWritten * 2];