diff options
author | chai <chaifix@163.com> | 2019-01-31 18:38:35 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-01-31 18:38:35 +0800 |
commit | 2ec55fd974a63b705a4777c256d2222c874fa043 (patch) | |
tree | 48f1fea59ee9fc713a28a9aac3f05b98dc5ae66f /Source/3rdParty/SDL2/src/audio/android/SDL_androidaudio.c | |
parent | c581dfbf1e849f393861d15e82aa6446c0c1c310 (diff) |
*SDL project
Diffstat (limited to 'Source/3rdParty/SDL2/src/audio/android/SDL_androidaudio.c')
-rw-r--r-- | Source/3rdParty/SDL2/src/audio/android/SDL_androidaudio.c | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/Source/3rdParty/SDL2/src/audio/android/SDL_androidaudio.c b/Source/3rdParty/SDL2/src/audio/android/SDL_androidaudio.c index 7a25424..77a5f0d 100644 --- a/Source/3rdParty/SDL2/src/audio/android/SDL_androidaudio.c +++ b/Source/3rdParty/SDL2/src/audio/android/SDL_androidaudio.c @@ -57,7 +57,9 @@ ANDROIDAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) test_format = SDL_FirstAudioFormat(this->spec.format); while (test_format != 0) { /* no "UNKNOWN" constant */ - if ((test_format == AUDIO_U8) || (test_format == AUDIO_S16LSB)) { + if ((test_format == AUDIO_U8) || + (test_format == AUDIO_S16) || + (test_format == AUDIO_F32)) { this->spec.format = test_format; break; } @@ -69,25 +71,8 @@ ANDROIDAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) return SDL_SetError("No compatible audio format!"); } - if (this->spec.channels > 1) { - this->spec.channels = 2; - } else { - this->spec.channels = 1; - } - - if (this->spec.freq < 8000) { - this->spec.freq = 8000; - } - if (this->spec.freq > 48000) { - this->spec.freq = 48000; - } - - /* TODO: pass in/return a (Java) device ID */ - this->spec.samples = Android_JNI_OpenAudioDevice(iscapture, this->spec.freq, this->spec.format == AUDIO_U8 ? 0 : 1, this->spec.channels, this->spec.samples); - - if (this->spec.samples == 0) { - /* Init failed? */ - return SDL_SetError("Java-side initialization failed!"); + if (Android_JNI_OpenAudioDevice(iscapture, &this->spec) < 0) { + return -1; } SDL_CalculateAudioSpec(&this->spec); |