Set some half reasonable defaults when there's no optimal sample rate available

This commit is contained in:
Henrik Rydgard committed 2015-01-14 00:34:27 +01:00
1 parent a506ba2e83
commit d2f95b9190
1 file changed
+6 -2
+6 -2
View File
@@ -249,10 +249,14 @@ extern "C" void Java_com_henrikrydgard_libnative_NativeApp_init
extern "C" void Java_com_henrikrydgard_libnative_NativeApp_audioInit(JNIEnv *, jclass) {
sampleRate = optimalSampleRate;
if (NativeQueryConfig("force44khz") != "0") {
if (NativeQueryConfig("force44khz") != "0" || optimalSampleRate == 0) {
sampleRate = 44100;
}
framesPerBuffer = optimalFramesPerBuffer;
if (optimalFramesPerBuffer > 0) {
framesPerBuffer = optimalFramesPerBuffer;
} else {
framesPerBuffer = 512;
}
ILOG("NativeApp.audioInit() -- Using OpenSL audio! frames/buffer: %i optimal sr: %i actual sr: %i", optimalFramesPerBuffer, optimalSampleRate, sampleRate);
AndroidAudio_Init(&NativeMix, library_path, framesPerBuffer, sampleRate);
}