src/audio/openslES/SDL_openslES.c
changeset 12766 a85ea89b0561
parent 12754 aec84759c57e
child 12767 8b07df58da32
equal deleted inserted replaced
12765:80586f864508 12766:a85ea89b0561
   288 #define SL_SPEAKER_TOP_FRONT_RIGHT       ((SLuint32) 0x00004000)
   288 #define SL_SPEAKER_TOP_FRONT_RIGHT       ((SLuint32) 0x00004000)
   289 #define SL_SPEAKER_TOP_BACK_LEFT         ((SLuint32) 0x00008000)
   289 #define SL_SPEAKER_TOP_BACK_LEFT         ((SLuint32) 0x00008000)
   290 #define SL_SPEAKER_TOP_BACK_CENTER       ((SLuint32) 0x00010000)
   290 #define SL_SPEAKER_TOP_BACK_CENTER       ((SLuint32) 0x00010000)
   291 #define SL_SPEAKER_TOP_BACK_RIGHT        ((SLuint32) 0x00020000)
   291 #define SL_SPEAKER_TOP_BACK_RIGHT        ((SLuint32) 0x00020000)
   292 */
   292 */
   293 
   293 #define SL_ANDROID_SPEAKER_QUAD (SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT | SL_SPEAKER_BACK_LEFT | SL_SPEAKER_BACK_RIGHT)
   294     if (this->spec.channels == 1) {
   294 #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)
   295         format_pcm.channelMask = SL_SPEAKER_FRONT_CENTER;
   295 #define SL_ANDROID_SPEAKER_7DOT1 (SL_ANDROID_SPEAKER_5DOT1 | SL_SPEAKER_SIDE_LEFT | SL_SPEAKER_SIDE_RIGHT)
   296     } else if (this->spec.channels == 2) {
   296 
       
   297     switch (this->spec.channels)
       
   298     {
       
   299     case 1:
       
   300         format_pcm.channelMask = SL_SPEAKER_FRONT_LEFT;
       
   301         break;
       
   302     case 2:
   297         format_pcm.channelMask = SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT;
   303         format_pcm.channelMask = SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT;
   298     } else if (this->spec.channels == 3) {
   304         break;
       
   305     case 3:
   299         format_pcm.channelMask = SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT | SL_SPEAKER_FRONT_CENTER;
   306         format_pcm.channelMask = SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT | SL_SPEAKER_FRONT_CENTER;
   300     } else if (this->spec.channels == 4) {
   307         break;
   301         format_pcm.channelMask = SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT |
   308     case 4:
   302               SL_SPEAKER_BACK_LEFT | SL_SPEAKER_BACK_RIGHT;
   309         format_pcm.channelMask = SL_ANDROID_SPEAKER_QUAD;
   303     } else {
   310         break;
   304         format_pcm.channelMask = SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT |
   311     case 5:
   305               SL_SPEAKER_BACK_LEFT | SL_SPEAKER_BACK_RIGHT | SL_SPEAKER_FRONT_CENTER;
   312         format_pcm.channelMask = SL_ANDROID_SPEAKER_QUAD | SL_SPEAKER_FRONT_CENTER;
       
   313         break;
       
   314     case 6:
       
   315         format_pcm.channelMask = SL_ANDROID_SPEAKER_5DOT1;
       
   316         break;
       
   317     case 7:
       
   318         format_pcm.channelMask = SL_ANDROID_SPEAKER_5DOT1 | SL_SPEAKER_BACK_CENTER;
       
   319         break;
       
   320     case 8:
       
   321         format_pcm.channelMask = SL_ANDROID_SPEAKER_7DOT1;
       
   322         break;
       
   323     default:
       
   324         /* Unknown number of channels, fall back to stereo */
       
   325         this->spec.channels = 2;
       
   326         format_pcm.channelMask = SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT;
       
   327         break;
   306     }
   328     }
   307 
   329 
   308     SLDataSource audioSrc = { &loc_bufq, &format_pcm };
   330     SLDataSource audioSrc = { &loc_bufq, &format_pcm };
   309 
   331 
   310     /* configure audio sink */
   332     /* configure audio sink */