File tree Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -413,27 +413,32 @@ static int openslES_CreatePCMPlayer(_THIS)
413
413
SLresult result ;
414
414
int i ;
415
415
416
- /* If we want to add floating point audio support (requires API level 21)
417
- it can be done as described here:
418
- https://developer.android.com/ndk/guides/audio/opensl/android-extensions.html#floating-point
419
- */
416
+ /* according to https://developer.android.com/ndk/guides/audio/opensl/opensl-for-android,
417
+ Android's OpenSL ES only supports Uint8 and _littleendian_ Sint16.
418
+ (and float32, with an extension we use, below.) */
420
419
if (SDL_GetAndroidSDKVersion () >= 21 ) {
421
420
SDL_AudioFormat test_format ;
422
421
for (test_format = SDL_FirstAudioFormat (this -> spec .format ); test_format ; test_format = SDL_NextAudioFormat ()) {
423
- if (SDL_AUDIO_ISSIGNED (test_format )) {
422
+ switch (test_format ) {
423
+ case SDL_AUDIO_U8 :
424
+ case SDL_AUDIO_S16LE :
425
+ case SDL_AUDIO_F32 :
424
426
break ;
427
+ default :
428
+ continue ;
425
429
}
430
+ break ;
426
431
}
427
432
428
433
if (!test_format ) {
429
434
/* Didn't find a compatible format : */
430
- LOGI ("No compatible audio format, using signed 16-bit audio" );
431
- test_format = AUDIO_S16SYS ;
435
+ LOGI ("No compatible audio format, using signed 16-bit LE audio" );
436
+ test_format = AUDIO_S16LSB ;
432
437
}
433
438
this -> spec .format = test_format ;
434
439
} else {
435
440
/* Just go with signed 16-bit audio as it's the most compatible */
436
- this -> spec .format = AUDIO_S16SYS ;
441
+ this -> spec .format = AUDIO_S16LSB ;
437
442
}
438
443
439
444
/* Update the fragment size as size in bytes */
You can’t perform that action at this time.
0 commit comments