src/core/android/SDL_android.c
changeset 7552 463f78515a07
parent 7516 4a98853e8e4c
child 7564 d2bc997ef5d6
     1.1 --- a/src/core/android/SDL_android.c	Tue Jul 30 23:33:32 2013 -0700
     1.2 +++ b/src/core/android/SDL_android.c	Wed Jul 31 10:04:59 2013 -0300
     1.3 @@ -123,7 +123,7 @@
     1.4      midFlipBuffers = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
     1.5                                  "flipBuffers","()V");
     1.6      midAudioInit = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
     1.7 -                                "audioInit", "(IZZI)V");
     1.8 +                                "audioInit", "(IZZI)I");
     1.9      midAudioWriteShortBuffer = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
    1.10                                  "audioWriteShortBuffer", "([S)V");
    1.11      midAudioWriteByteBuffer = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
    1.12 @@ -456,7 +456,11 @@
    1.13      audioBuffer16Bit = is16Bit;
    1.14      audioBufferStereo = channelCount > 1;
    1.15  
    1.16 -    (*env)->CallStaticVoidMethod(env, mActivityClass, midAudioInit, sampleRate, audioBuffer16Bit, audioBufferStereo, desiredBufferFrames);
    1.17 +    if ((*env)->CallStaticIntMethod(env, mActivityClass, midAudioInit, sampleRate, audioBuffer16Bit, audioBufferStereo, desiredBufferFrames) != 0) {
    1.18 +        /* Error during audio initialization */
    1.19 +        __android_log_print(ANDROID_LOG_WARN, "SDL", "SDL audio: error on AudioTrack initialization!");
    1.20 +        return 0;
    1.21 +    }
    1.22  
    1.23      /* Allocating the audio buffer from the Java side and passing it as the return value for audioInit no longer works on
    1.24       * Android >= 4.2 due to a "stale global reference" error. So now we allocate this buffer directly from this side. */