src/audio/openslES/SDL_openslES.c
changeset 12767 8b07df58da32
parent 12766 a85ea89b0561
child 13041 6ea2f4ed7014
     1.1 --- a/src/audio/openslES/SDL_openslES.c	Fri Jun 07 15:09:15 2019 -0700
     1.2 +++ b/src/audio/openslES/SDL_openslES.c	Sat Jun 08 10:21:38 2019 -0700
     1.3 @@ -22,6 +22,10 @@
     1.4  
     1.5  #if SDL_AUDIO_DRIVER_OPENSLES
     1.6  
     1.7 +/* For more discussion of low latency audio on Android, see this:
     1.8 +   https://googlesamples.github.io/android-audio-high-performance/guides/opensl_es.html
     1.9 +*/
    1.10 +
    1.11  #include "SDL_audio.h"
    1.12  #include "../SDL_audio_c.h"
    1.13  #include "SDL_openslES.h"
    1.14 @@ -290,8 +294,9 @@
    1.15  #define SL_SPEAKER_TOP_BACK_CENTER       ((SLuint32) 0x00010000)
    1.16  #define SL_SPEAKER_TOP_BACK_RIGHT        ((SLuint32) 0x00020000)
    1.17  */
    1.18 -#define SL_ANDROID_SPEAKER_QUAD (SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT | SL_SPEAKER_BACK_LEFT | SL_SPEAKER_BACK_RIGHT)
    1.19 -#define SL_ANDROID_SPEAKER_5DOT1 (SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT | SL_SPEAKER_FRONT_CENTER  | SL_SPEAKER_LOW_FREQUENCY| SL_SPEAKER_BACK_LEFT | SL_SPEAKER_BACK_RIGHT)
    1.20 +#define SL_ANDROID_SPEAKER_STEREO (SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT)
    1.21 +#define SL_ANDROID_SPEAKER_QUAD (SL_ANDROID_SPEAKER_STEREO | SL_SPEAKER_BACK_LEFT | SL_SPEAKER_BACK_RIGHT)
    1.22 +#define SL_ANDROID_SPEAKER_5DOT1 (SL_ANDROID_SPEAKER_QUAD | SL_SPEAKER_FRONT_CENTER  | SL_SPEAKER_LOW_FREQUENCY)
    1.23  #define SL_ANDROID_SPEAKER_7DOT1 (SL_ANDROID_SPEAKER_5DOT1 | SL_SPEAKER_SIDE_LEFT | SL_SPEAKER_SIDE_RIGHT)
    1.24  
    1.25      switch (this->spec.channels)
    1.26 @@ -300,10 +305,10 @@
    1.27          format_pcm.channelMask = SL_SPEAKER_FRONT_LEFT;
    1.28          break;
    1.29      case 2:
    1.30 -        format_pcm.channelMask = SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT;
    1.31 +        format_pcm.channelMask = SL_ANDROID_SPEAKER_STEREO;
    1.32          break;
    1.33      case 3:
    1.34 -        format_pcm.channelMask = SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT | SL_SPEAKER_FRONT_CENTER;
    1.35 +        format_pcm.channelMask = SL_ANDROID_SPEAKER_STEREO | SL_SPEAKER_FRONT_CENTER;
    1.36          break;
    1.37      case 4:
    1.38          format_pcm.channelMask = SL_ANDROID_SPEAKER_QUAD;