mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-20 21:16:04 +00:00
aaudio: Fixed for older SDKs and Android releases.
This commit is contained in:
parent
5ff87c6d4a
commit
ab68428a64
1 changed files with 5 additions and 1 deletions
|
|
@ -30,6 +30,10 @@
|
|||
#include <stdbool.h>
|
||||
#include <aaudio/AAudio.h>
|
||||
|
||||
#if __ANDROID_API__ < 31
|
||||
#define AAUDIO_FORMAT_PCM_I32 4
|
||||
#endif
|
||||
|
||||
struct SDL_PrivateAudioData
|
||||
{
|
||||
AAudioStream *stream;
|
||||
|
|
@ -119,7 +123,7 @@ static int AAUDIO_OpenDevice(SDL_AudioDevice *device)
|
|||
const aaudio_direction_t direction = (iscapture ? AAUDIO_DIRECTION_INPUT : AAUDIO_DIRECTION_OUTPUT);
|
||||
ctx.AAudioStreamBuilder_setDirection(builder, direction);
|
||||
aaudio_format_t format;
|
||||
if (device->spec.format == SDL_AUDIO_S32SYS) {
|
||||
if ((device->spec.format == SDL_AUDIO_S32SYS) && (SDL_GetAndroidSDKVersion() >= 31)) {
|
||||
format = AAUDIO_FORMAT_PCM_I32;
|
||||
} else if (device->spec.format == SDL_AUDIO_F32SYS) {
|
||||
format = AAUDIO_FORMAT_PCM_FLOAT;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue