src/core/android/SDL_android.c
changeset 7552 463f78515a07
parent 7516 4a98853e8e4c
child 7564 d2bc997ef5d6
equal deleted inserted replaced
7551:823c0c5b2d8d 7552:463f78515a07
   121     midCreateGLContext = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
   121     midCreateGLContext = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
   122                                 "createGLContext","(II[I)Z");
   122                                 "createGLContext","(II[I)Z");
   123     midFlipBuffers = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
   123     midFlipBuffers = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
   124                                 "flipBuffers","()V");
   124                                 "flipBuffers","()V");
   125     midAudioInit = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
   125     midAudioInit = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
   126                                 "audioInit", "(IZZI)V");
   126                                 "audioInit", "(IZZI)I");
   127     midAudioWriteShortBuffer = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
   127     midAudioWriteShortBuffer = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
   128                                 "audioWriteShortBuffer", "([S)V");
   128                                 "audioWriteShortBuffer", "([S)V");
   129     midAudioWriteByteBuffer = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
   129     midAudioWriteByteBuffer = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
   130                                 "audioWriteByteBuffer", "([B)V");
   130                                 "audioWriteByteBuffer", "([B)V");
   131     midAudioQuit = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
   131     midAudioQuit = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
   454 
   454 
   455     __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "SDL audio: opening device");
   455     __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "SDL audio: opening device");
   456     audioBuffer16Bit = is16Bit;
   456     audioBuffer16Bit = is16Bit;
   457     audioBufferStereo = channelCount > 1;
   457     audioBufferStereo = channelCount > 1;
   458 
   458 
   459     (*env)->CallStaticVoidMethod(env, mActivityClass, midAudioInit, sampleRate, audioBuffer16Bit, audioBufferStereo, desiredBufferFrames);
   459     if ((*env)->CallStaticIntMethod(env, mActivityClass, midAudioInit, sampleRate, audioBuffer16Bit, audioBufferStereo, desiredBufferFrames) != 0) {
       
   460         /* Error during audio initialization */
       
   461         __android_log_print(ANDROID_LOG_WARN, "SDL", "SDL audio: error on AudioTrack initialization!");
       
   462         return 0;
       
   463     }
   460 
   464 
   461     /* Allocating the audio buffer from the Java side and passing it as the return value for audioInit no longer works on
   465     /* Allocating the audio buffer from the Java side and passing it as the return value for audioInit no longer works on
   462      * Android >= 4.2 due to a "stale global reference" error. So now we allocate this buffer directly from this side. */
   466      * Android >= 4.2 due to a "stale global reference" error. So now we allocate this buffer directly from this side. */
   463 
   467 
   464     if (is16Bit) {
   468     if (is16Bit) {