From 47bcb078f547554735daf2d919127f6cdd0cd656 Mon Sep 17 00:00:00 2001
From: Brick <[EMAIL REDACTED]>
Date: Sun, 3 Sep 2023 20:47:11 +0100
Subject: [PATCH] Fixed some incorrect SDL_AUDIO_F32 uses
---
src/audio/SDL_audio.c | 2 +-
test/testautomation_audio.c | 12 ++++++------
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c
index bef59b43cbc6..de2e3a4f9ce6 100644
--- a/src/audio/SDL_audio.c
+++ b/src/audio/SDL_audio.c
@@ -765,7 +765,7 @@ SDL_bool SDL_OutputAudioThreadIterate(SDL_AudioDevice *device)
case MIXSTRATEGY_MIX: {
//SDL_Log("MIX STRATEGY: MIX");
- float *mix_buffer = (float *) ((device->spec.format == SDL_AUDIO_F32) ? device_buffer : device->mix_buffer);
+ float *mix_buffer = (float *) ((device->spec.format == SDL_AUDIO_F32SYS) ? device_buffer : device->mix_buffer);
const int needed_samples = buffer_size / (SDL_AUDIO_BITSIZE(device->spec.format) / 8);
const int work_buffer_size = needed_samples * sizeof (float);
SDL_AudioSpec outspec;
diff --git a/test/testautomation_audio.c b/test/testautomation_audio.c
index 69b4369d2995..33cb68472224 100644
--- a/test/testautomation_audio.c
+++ b/test/testautomation_audio.c
@@ -842,14 +842,14 @@ static int audio_resampleLoss(void *arg)
SDLTest_AssertPass("Test resampling of %i s %i Hz %f phase sine wave from sampling rate of %i Hz to %i Hz",
spec->time, spec->freq, spec->phase, spec->rate_in, spec->rate_out);
- tmpspec1.format = SDL_AUDIO_F32;
+ tmpspec1.format = SDL_AUDIO_F32SYS;
tmpspec1.channels = num_channels;
tmpspec1.freq = spec->rate_in;
- tmpspec2.format = SDL_AUDIO_F32;
+ tmpspec2.format = SDL_AUDIO_F32SYS;
tmpspec2.channels = num_channels;
tmpspec2.freq = spec->rate_out;
stream = SDL_CreateAudioStream(&tmpspec1, &tmpspec2);
- SDLTest_AssertPass("Call to SDL_CreateAudioStream(SDL_AUDIO_F32, 1, %i, SDL_AUDIO_F32, 1, %i)", spec->rate_in, spec->rate_out);
+ SDLTest_AssertPass("Call to SDL_CreateAudioStream(SDL_AUDIO_F32SYS, 1, %i, SDL_AUDIO_F32SYS, 1, %i)", spec->rate_in, spec->rate_out);
SDLTest_AssertCheck(stream != NULL, "Expected SDL_CreateAudioStream to succeed.");
if (stream == NULL) {
return TEST_ABORTED;
@@ -1020,13 +1020,13 @@ static int audio_convertAccuracy(void *arg)
float target_max_delta = (bits > 23) ? 0.0f : (1.0f / (float)(1 << bits));
float target_min_delta = -target_max_delta;
- src_spec.format = SDL_AUDIO_F32;
+ src_spec.format = SDL_AUDIO_F32SYS;
src_spec.channels = 1;
- src_spec.freq = 44800;
+ src_spec.freq = 44100;
tmp_spec.format = format;
tmp_spec.channels = 1;
- tmp_spec.freq = 44800;
+ tmp_spec.freq = 44100;
convert_begin = SDL_GetPerformanceCounter();