Skip to content

Commit a91ef63

Browse files
committed
Merge tag 'release-2.32.10'
2 parents d29847e + 5d24957 commit a91ef63

File tree

21 files changed

+308
-80
lines changed

21 files changed

+308
-80
lines changed

android-project/app/src/main/java/org/libsdl/app/SDLActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
6161
private static final String TAG = "SDL";
6262
private static final int SDL_MAJOR_VERSION = 2;
6363
private static final int SDL_MINOR_VERSION = 32;
64-
private static final int SDL_MICRO_VERSION = 8;
64+
private static final int SDL_MICRO_VERSION = 10;
6565
/*
6666
// Display InputType.SOURCE/CLASS of events and devices
6767
//

build.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pub fn build(b: *std.Build) void {
77

88
const lib = b.addLibrary(.{
99
.name = "SDL2",
10-
.version = .{ .major = 2, .minor = 32, .patch = 6 },
10+
.version = .{ .major = 2, .minor = 32, .patch = 10 },
1111
.linkage = if (t.abi.isAndroid()) .dynamic else .static,
1212
.root_module = b.createModule(.{
1313
.target = target,

build.zig.zon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.{
22
.name = .SDL,
3-
.version = "2.32.6",
3+
.version = "2.32.10",
44
.fingerprint = 0x7ac4ce41df223a25,
55
.minimum_zig_version = "0.14.0",
66
.dependencies = .{},

include/SDL_assert.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *,
153153
#define SDL_enabled_assert(condition) \
154154
do { \
155155
while ( !(condition) ) { \
156-
static struct SDL_AssertData sdl_assert_data = { 0, 0, #condition, 0, 0, 0, 0 }; \
156+
static struct SDL_AssertData sdl_assert_data = { 0, 0, #condition, NULL, 0, NULL, NULL }; \
157157
const SDL_AssertState sdl_assert_state = SDL_ReportAssertion(&sdl_assert_data, SDL_FUNCTION, SDL_FILE, SDL_LINE); \
158158
if (sdl_assert_state == SDL_ASSERTION_RETRY) { \
159159
continue; /* go again. */ \

include/SDL_config.h.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@
193193
#cmakedefine HAVE_MEMFD_CREATE 1
194194
#cmakedefine HAVE_POSIX_FALLOCATE 1
195195
#cmakedefine HAVE_SIGACTION 1
196+
#cmakedefine HAVE_SIGTIMEDWAIT 1
196197
#cmakedefine HAVE_SA_SIGACTION 1
197198
#cmakedefine HAVE_SETJMP 1
198199
#cmakedefine HAVE_NANOSLEEP 1

include/SDL_keyboard.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ typedef struct SDL_Keysym
4949
{
5050
SDL_Scancode scancode; /**< SDL physical key code - see SDL_Scancode for details */
5151
SDL_Keycode sym; /**< SDL virtual key code - see SDL_Keycode for details */
52-
Uint16 mod; /**< current key modifiers */
52+
Uint16 mod; /**< current key modifiers - see SDL_Keymod for details */
5353
Uint32 unused;
5454
} SDL_Keysym;
5555

include/SDL_version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ typedef struct SDL_version
5858
*/
5959
#define SDL_MAJOR_VERSION 2
6060
#define SDL_MINOR_VERSION 32
61-
#define SDL_PATCHLEVEL 8
61+
#define SDL_PATCHLEVEL 10
6262

6363
/**
6464
* Macro to determine SDL version program was compiled against.

src/audio/alsa/SDL_alsa_audio.c

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ static int (*ALSA_snd_device_name_hint)(int, const char *, void ***);
8383
static char *(*ALSA_snd_device_name_get_hint)(const void *, const char *);
8484
static int (*ALSA_snd_device_name_free_hint)(void **);
8585
static snd_pcm_sframes_t (*ALSA_snd_pcm_avail)(snd_pcm_t *);
86+
static int (*ALSA_snd_pcm_info)(snd_pcm_t *, snd_pcm_info_t *);
87+
static const char *(*ALSA_snd_pcm_info_get_name)(const snd_pcm_info_t *);
88+
static int (*ALSA_snd_pcm_info_get_card)(const snd_pcm_info_t *);
89+
static int (*ALSA_snd_card_get_name)(int, char **);
90+
static int (*ALSA_snd_pcm_info_malloc)(snd_pcm_info_t **);
91+
static int (*ALSA_snd_pcm_info_free)(snd_pcm_info_t *);
8692
#ifdef SND_CHMAP_API_VERSION
8793
static snd_pcm_chmap_t *(*ALSA_snd_pcm_get_chmap)(snd_pcm_t *);
8894
static int (*ALSA_snd_pcm_chmap_print)(const snd_pcm_chmap_t *map, size_t maxlen, char *buf);
@@ -152,6 +158,12 @@ static int load_alsa_syms(void)
152158
SDL_ALSA_SYM(snd_device_name_get_hint);
153159
SDL_ALSA_SYM(snd_device_name_free_hint);
154160
SDL_ALSA_SYM(snd_pcm_avail);
161+
SDL_ALSA_SYM(snd_pcm_info);
162+
SDL_ALSA_SYM(snd_pcm_info_get_card);
163+
SDL_ALSA_SYM(snd_pcm_info_get_name);
164+
SDL_ALSA_SYM(snd_card_get_name);
165+
SDL_ALSA_SYM(snd_pcm_info_malloc);
166+
SDL_ALSA_SYM(snd_pcm_info_free);
155167
#ifdef SND_CHMAP_API_VERSION
156168
SDL_ALSA_SYM(snd_pcm_get_chmap);
157169
SDL_ALSA_SYM(snd_pcm_chmap_print);
@@ -466,6 +478,58 @@ static void ALSA_CloseDevice(_THIS)
466478
SDL_free(this->hidden);
467479
}
468480

481+
static int ALSA_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int iscapture)
482+
{
483+
const char *device = "default";
484+
snd_pcm_t *pcm_handle;
485+
snd_pcm_info_t *pcm_info;
486+
snd_pcm_stream_t stream;
487+
int card_index;
488+
const char *dev_name;
489+
char *card_name = NULL;
490+
char final_name[256];
491+
492+
SDL_zero(final_name);
493+
stream = iscapture ? SND_PCM_STREAM_CAPTURE : SND_PCM_STREAM_PLAYBACK;
494+
495+
if (ALSA_snd_pcm_open(&pcm_handle, device, stream, SND_PCM_NONBLOCK) < 0) {
496+
return SDL_SetError("ALSA: Couldn't open default device");
497+
}
498+
499+
if (ALSA_snd_pcm_info_malloc(&pcm_info) < 0) {
500+
ALSA_snd_pcm_close(pcm_handle);
501+
return SDL_SetError("ALSA: Couldn't allocate pcm_info");
502+
}
503+
504+
if (ALSA_snd_pcm_info(pcm_handle, pcm_info) < 0) {
505+
ALSA_snd_pcm_info_free(pcm_info);
506+
ALSA_snd_pcm_close(pcm_handle);
507+
return SDL_SetError("ALSA: Couldn't get PCM info");
508+
}
509+
510+
card_index = ALSA_snd_pcm_info_get_card(pcm_info);
511+
dev_name = ALSA_snd_pcm_info_get_name(pcm_info);
512+
513+
if (card_index >= 0 && ALSA_snd_card_get_name(card_index, &card_name) >= 0) {
514+
SDL_snprintf(final_name, sizeof(final_name), "%s, %s", card_name, dev_name);
515+
*name = SDL_strdup(final_name);
516+
} else {
517+
*name = SDL_strdup(dev_name ? dev_name : "Unknown ALSA Device");
518+
}
519+
520+
if (spec) {
521+
SDL_zero(*spec);
522+
spec->freq = 48000;
523+
spec->format = AUDIO_S16SYS;
524+
spec->channels = 2;
525+
spec->samples = 512;
526+
}
527+
528+
ALSA_snd_pcm_info_free(pcm_info);
529+
ALSA_snd_pcm_close(pcm_handle);
530+
return 0;
531+
}
532+
469533
static int ALSA_set_buffer_size(_THIS, snd_pcm_hw_params_t *params)
470534
{
471535
int status;
@@ -975,6 +1039,7 @@ static SDL_bool ALSA_Init(SDL_AudioDriverImpl *impl)
9751039
impl->Deinitialize = ALSA_Deinitialize;
9761040
impl->CaptureFromDevice = ALSA_CaptureFromDevice;
9771041
impl->FlushCapture = ALSA_FlushCapture;
1042+
impl->GetDefaultAudioInfo = ALSA_GetDefaultAudioInfo;
9781043

9791044
impl->HasCaptureSupport = SDL_TRUE;
9801045
impl->SupportsNonPow2Samples = SDL_TRUE;

src/audio/coreaudio/SDL_coreaudio.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,8 @@ static BOOL update_audio_session(_THIS, SDL_bool open, SDL_bool allow_playandrec
383383

384384
hint = SDL_GetHint(SDL_HINT_AUDIO_CATEGORY);
385385
if (hint) {
386-
if (SDL_strcasecmp(hint, "AVAudioSessionCategoryAmbient") == 0) {
386+
if (SDL_strcasecmp(hint, "AVAudioSessionCategoryAmbient") == 0 ||
387+
SDL_strcasecmp(hint, "ambient") == 0) {
387388
category = AVAudioSessionCategoryAmbient;
388389
} else if (SDL_strcasecmp(hint, "AVAudioSessionCategorySoloAmbient") == 0) {
389390
category = AVAudioSessionCategorySoloAmbient;

src/audio/openslES/SDL_openslES.c

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -413,27 +413,32 @@ static int openslES_CreatePCMPlayer(_THIS)
413413
SLresult result;
414414
int i;
415415

416-
/* If we want to add floating point audio support (requires API level 21)
417-
it can be done as described here:
418-
https://developer.android.com/ndk/guides/audio/opensl/android-extensions.html#floating-point
419-
*/
416+
/* according to https://developer.android.com/ndk/guides/audio/opensl/opensl-for-android,
417+
Android's OpenSL ES only supports Uint8 and _littleendian_ Sint16.
418+
(and float32, with an extension we use, below.) */
420419
if (SDL_GetAndroidSDKVersion() >= 21) {
421420
SDL_AudioFormat test_format;
422421
for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) {
423-
if (SDL_AUDIO_ISSIGNED(test_format)) {
422+
switch (test_format) {
423+
case AUDIO_U8:
424+
case AUDIO_S16LSB:
425+
case AUDIO_F32LSB:
424426
break;
427+
default:
428+
continue;
425429
}
430+
break;
426431
}
427432

428433
if (!test_format) {
429434
/* Didn't find a compatible format : */
430-
LOGI("No compatible audio format, using signed 16-bit audio");
431-
test_format = AUDIO_S16SYS;
435+
LOGI("No compatible audio format, using signed 16-bit LE audio");
436+
test_format = AUDIO_S16LSB;
432437
}
433438
this->spec.format = test_format;
434439
} else {
435440
/* Just go with signed 16-bit audio as it's the most compatible */
436-
this->spec.format = AUDIO_S16SYS;
441+
this->spec.format = AUDIO_S16LSB;
437442
}
438443

439444
/* Update the fragment size as size in bytes */

0 commit comments

Comments
 (0)