From 079ae065f1d6c7cc1f2e54f2e595972e7845c353 Mon Sep 17 00:00:00 2001 From: Brick <6098371+0x1F9F1@users.noreply.github.com> Date: Tue, 2 May 2023 13:00:28 +0100 Subject: [PATCH] Added SDL prefix AUDIO_* constants --- build-scripts/SDL_migration.cocci | 56 ++++++++++++++++++++++ docs/README-migration.md | 18 ++++++- include/SDL3/SDL_audio.h | 36 +++++++------- include/SDL3/SDL_oldnames.h | 28 +++++++++++ src/audio/SDL_audio.c | 24 +++++----- src/audio/SDL_audiocvt.c | 48 +++++++++---------- src/audio/SDL_audiotypecvt.c | 36 +++++++------- src/audio/SDL_mixer.c | 16 +++---- src/audio/SDL_wave.c | 10 ++-- src/audio/aaudio/SDL_aaudio.c | 8 ++-- src/audio/alsa/SDL_alsa_audio.c | 16 +++---- src/audio/android/SDL_androidaudio.c | 6 +-- src/audio/coreaudio/SDL_coreaudio.m | 16 +++---- src/audio/directsound/SDL_directsound.c | 8 ++-- src/audio/dsp/SDL_dspaudio.c | 8 ++-- src/audio/emscripten/SDL_emscriptenaudio.c | 2 +- src/audio/haiku/SDL_haikuaudio.cc | 16 +++---- src/audio/jack/SDL_jackaudio.c | 2 +- src/audio/n3ds/SDL_n3dsaudio.c | 4 +- src/audio/netbsd/SDL_netbsdaudio.c | 12 ++--- src/audio/openslES/SDL_openslES.c | 6 +-- src/audio/pipewire/SDL_pipewire.c | 18 +++---- src/audio/ps2/SDL_ps2audio.c | 4 +- src/audio/psp/SDL_pspaudio.c | 2 +- src/audio/pulseaudio/SDL_pulseaudio.c | 28 +++++------ src/audio/qnx/SDL_qsa_audio.c | 16 +++---- src/audio/sndio/SDL_sndioaudio.c | 12 ++--- src/audio/vita/SDL_vitaaudio.c | 2 +- src/audio/wasapi/SDL_wasapi_winrt.cpp | 12 ++--- src/core/android/SDL_android.c | 12 ++--- src/core/windows/SDL_immdevice.c | 12 ++--- src/test/SDL_test_common.c | 12 ++--- test/testaudiocapture.c | 2 +- test/testautomation_audio.c | 44 ++++++++--------- test/testsurround.c | 2 +- 35 files changed, 327 insertions(+), 227 deletions(-) diff --git a/build-scripts/SDL_migration.cocci b/build-scripts/SDL_migration.cocci index da0987b1d..22d9892f7 100644 --- a/build-scripts/SDL_migration.cocci +++ b/build-scripts/SDL_migration.cocci @@ -2608,3 +2608,59 @@ typedef SDL_cond, SDL_Condition; @@ - SDL_cond + SDL_Condition +@@ +@@ +- AUDIO_F32 ++ SDL_AUDIO_F32 +@@ +@@ +- AUDIO_F32LSB ++ SDL_AUDIO_F32LSB +@@ +@@ +- AUDIO_F32MSB ++ SDL_AUDIO_F32MSB +@@ +@@ +- AUDIO_F32SYS ++ SDL_AUDIO_F32SYS +@@ +@@ +- AUDIO_S16 ++ SDL_AUDIO_S16 +@@ +@@ +- AUDIO_S16LSB ++ SDL_AUDIO_S16LSB +@@ +@@ +- AUDIO_S16MSB ++ SDL_AUDIO_S16MSB +@@ +@@ +- AUDIO_S16SYS ++ SDL_AUDIO_S16SYS +@@ +@@ +- AUDIO_S32 ++ SDL_AUDIO_S32 +@@ +@@ +- AUDIO_S32LSB ++ SDL_AUDIO_S32LSB +@@ +@@ +- AUDIO_S32MSB ++ SDL_AUDIO_S32MSB +@@ +@@ +- AUDIO_S32SYS ++ SDL_AUDIO_S32SYS +@@ +@@ +- AUDIO_S8 ++ SDL_AUDIO_S8 +@@ +@@ +- AUDIO_U8 ++ SDL_AUDIO_U8 diff --git a/docs/README-migration.md b/docs/README-migration.md index 3a23c3762..e701068c7 100644 --- a/docs/README-migration.md +++ b/docs/README-migration.md @@ -85,7 +85,7 @@ should be changed to: AUDIO_U16, AUDIO_U16LSB, AUDIO_U16MSB, and AUDIO_U16SYS have been removed. They were not heavily used, and one could not memset a buffer in this format to silence with a single byte value. Use a different audio format. -If you need to convert U16 audio data to a still-supported format at runtime, the fastest, lossless conversion is to AUDIO_S16: +If you need to convert U16 audio data to a still-supported format at runtime, the fastest, lossless conversion is to SDL_AUDIO_S16: ```c /* this converts the buffer in-place. The buffer size does not change. */ @@ -130,6 +130,22 @@ The following functions have been removed: Use the SDL_AudioDevice functions instead. +The following symbols have been renamed: +* AUDIO_F32 => SDL_AUDIO_F32 +* AUDIO_F32LSB => SDL_AUDIO_F32LSB +* AUDIO_F32MSB => SDL_AUDIO_F32MSB +* AUDIO_F32SYS => SDL_AUDIO_F32SYS +* AUDIO_S16 => SDL_AUDIO_S16 +* AUDIO_S16LSB => SDL_AUDIO_S16LSB +* AUDIO_S16MSB => SDL_AUDIO_S16MSB +* AUDIO_S16SYS => SDL_AUDIO_S16SYS +* AUDIO_S32 => SDL_AUDIO_S32 +* AUDIO_S32LSB => SDL_AUDIO_S32LSB +* AUDIO_S32MSB => SDL_AUDIO_S32MSB +* AUDIO_S32SYS => SDL_AUDIO_S32SYS +* AUDIO_S8 => SDL_AUDIO_S8 +* AUDIO_U8 => SDL_AUDIO_U8 + ## SDL_cpuinfo.h The intrinsics headers (mmintrin.h, etc.) have been moved to `` and are no longer automatically included in SDL.h. diff --git a/include/SDL3/SDL_audio.h b/include/SDL3/SDL_audio.h index a8f3631de..36ed3556e 100644 --- a/include/SDL3/SDL_audio.h +++ b/include/SDL3/SDL_audio.h @@ -88,29 +88,29 @@ typedef Uint16 SDL_AudioFormat; * Defaults to LSB byte order. */ /* @{ */ -#define AUDIO_U8 0x0008 /**< Unsigned 8-bit samples */ -#define AUDIO_S8 0x8008 /**< Signed 8-bit samples */ -#define AUDIO_S16LSB 0x8010 /**< Signed 16-bit samples */ -#define AUDIO_S16MSB 0x9010 /**< As above, but big-endian byte order */ -#define AUDIO_S16 AUDIO_S16LSB +#define SDL_AUDIO_U8 0x0008 /**< Unsigned 8-bit samples */ +#define SDL_AUDIO_S8 0x8008 /**< Signed 8-bit samples */ +#define SDL_AUDIO_S16LSB 0x8010 /**< Signed 16-bit samples */ +#define SDL_AUDIO_S16MSB 0x9010 /**< As above, but big-endian byte order */ +#define SDL_AUDIO_S16 SDL_AUDIO_S16LSB /* @} */ /** * \name int32 support */ /* @{ */ -#define AUDIO_S32LSB 0x8020 /**< 32-bit integer samples */ -#define AUDIO_S32MSB 0x9020 /**< As above, but big-endian byte order */ -#define AUDIO_S32 AUDIO_S32LSB +#define SDL_AUDIO_S32LSB 0x8020 /**< 32-bit integer samples */ +#define SDL_AUDIO_S32MSB 0x9020 /**< As above, but big-endian byte order */ +#define SDL_AUDIO_S32 SDL_AUDIO_S32LSB /* @} */ /** * \name float32 support */ /* @{ */ -#define AUDIO_F32LSB 0x8120 /**< 32-bit floating point samples */ -#define AUDIO_F32MSB 0x9120 /**< As above, but big-endian byte order */ -#define AUDIO_F32 AUDIO_F32LSB +#define SDL_AUDIO_F32LSB 0x8120 /**< 32-bit floating point samples */ +#define SDL_AUDIO_F32MSB 0x9120 /**< As above, but big-endian byte order */ +#define SDL_AUDIO_F32 SDL_AUDIO_F32LSB /* @} */ /** @@ -118,13 +118,13 @@ typedef Uint16 SDL_AudioFormat; */ /* @{ */ #if SDL_BYTEORDER == SDL_LIL_ENDIAN -#define AUDIO_S16SYS AUDIO_S16LSB -#define AUDIO_S32SYS AUDIO_S32LSB -#define AUDIO_F32SYS AUDIO_F32LSB +#define SDL_AUDIO_S16SYS SDL_AUDIO_S16LSB +#define SDL_AUDIO_S32SYS SDL_AUDIO_S32LSB +#define SDL_AUDIO_F32SYS SDL_AUDIO_F32LSB #else -#define AUDIO_S16SYS AUDIO_S16MSB -#define AUDIO_S32SYS AUDIO_S32MSB -#define AUDIO_F32SYS AUDIO_F32MSB +#define SDL_AUDIO_S16SYS SDL_AUDIO_S16MSB +#define SDL_AUDIO_S32SYS SDL_AUDIO_S32MSB +#define SDL_AUDIO_F32SYS SDL_AUDIO_F32MSB #endif /* @} */ @@ -425,7 +425,7 @@ extern DECLSPEC int SDLCALL SDL_GetDefaultAudioInfo(char **name, * When filling in the desired audio spec structure: * * - `desired->freq` should be the frequency in sample-frames-per-second (Hz). - * - `desired->format` should be the audio format (`AUDIO_S16SYS`, etc). + * - `desired->format` should be the audio format (`SDL_AUDIO_S16SYS`, etc). * - `desired->samples` is the desired size of the audio buffer, in _sample * frames_ (with stereo output, two samples--left and right--would make a * single sample frame). This number should be a power of two, and may be diff --git a/include/SDL3/SDL_oldnames.h b/include/SDL3/SDL_oldnames.h index 3d2b55b3b..d9487a0fb 100644 --- a/include/SDL3/SDL_oldnames.h +++ b/include/SDL3/SDL_oldnames.h @@ -43,6 +43,20 @@ #define SDL_atomic_t SDL_AtomicInt /* ##SDL_audio.h */ +#define AUDIO_F32 SDL_AUDIO_F32 +#define AUDIO_F32LSB SDL_AUDIO_F32LSB +#define AUDIO_F32MSB SDL_AUDIO_F32MSB +#define AUDIO_F32SYS SDL_AUDIO_F32SYS +#define AUDIO_S16 SDL_AUDIO_S16 +#define AUDIO_S16LSB SDL_AUDIO_S16LSB +#define AUDIO_S16MSB SDL_AUDIO_S16MSB +#define AUDIO_S16SYS SDL_AUDIO_S16SYS +#define AUDIO_S32 SDL_AUDIO_S32 +#define AUDIO_S32LSB SDL_AUDIO_S32LSB +#define AUDIO_S32MSB SDL_AUDIO_S32MSB +#define AUDIO_S32SYS SDL_AUDIO_S32SYS +#define AUDIO_S8 SDL_AUDIO_S8 +#define AUDIO_U8 SDL_AUDIO_U8 #define SDL_AudioStreamAvailable SDL_GetAudioStreamAvailable #define SDL_AudioStreamClear SDL_ClearAudioStream #define SDL_AudioStreamFlush SDL_FlushAudioStream @@ -457,6 +471,20 @@ #elif !defined(SDL_DISABLE_OLD_NAMES) /* ##SDL_audio.h */ +#define AUDIO_F32 AUDIO_F32_renamed_SDL_AUDIO_F32 +#define AUDIO_F32LSB AUDIO_F32LSB_renamed_SDL_AUDIO_F32LSB +#define AUDIO_F32MSB AUDIO_F32MSB_renamed_SDL_AUDIO_F32MSB +#define AUDIO_F32SYS AUDIO_F32SYS_renamed_SDL_AUDIO_F32SYS +#define AUDIO_S16 AUDIO_S16_renamed_SDL_AUDIO_S16 +#define AUDIO_S16LSB AUDIO_S16LSB_renamed_SDL_AUDIO_S16LSB +#define AUDIO_S16MSB AUDIO_S16MSB_renamed_SDL_AUDIO_S16MSB +#define AUDIO_S16SYS AUDIO_S16SYS_renamed_SDL_AUDIO_S16SYS +#define AUDIO_S32 AUDIO_S32_renamed_SDL_AUDIO_S32 +#define AUDIO_S32LSB AUDIO_S32LSB_renamed_SDL_AUDIO_S32LSB +#define AUDIO_S32MSB AUDIO_S32MSB_renamed_SDL_AUDIO_S32MSB +#define AUDIO_S32SYS AUDIO_S32SYS_renamed_SDL_AUDIO_S32SYS +#define AUDIO_S8 AUDIO_S8_renamed_SDL_AUDIO_S8 +#define AUDIO_U8 AUDIO_U8_renamed_SDL_AUDIO_U8 #define SDL_AudioStreamAvailable SDL_AudioStreamAvailable_renamed_SDL_GetAudioStreamAvailable #define SDL_AudioStreamClear SDL_AudioStreamClear_renamed_SDL_ClearAudioStream #define SDL_AudioStreamFlush SDL_AudioStreamFlush_renamed_SDL_FlushAudioStream diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c index e38c4cea8..238ea911f 100644 --- a/src/audio/SDL_audio.c +++ b/src/audio/SDL_audio.c @@ -770,7 +770,7 @@ static SDL_AudioFormat SDL_ParseAudioFormat(const char *string) { #define CHECK_FMT_STRING(x) \ if (SDL_strcmp(string, #x) == 0) \ - return AUDIO_##x + return SDL_AUDIO_##x CHECK_FMT_STRING(U8); CHECK_FMT_STRING(S8); CHECK_FMT_STRING(S16LSB); @@ -1113,9 +1113,9 @@ static int prepare_audiospec(const SDL_AudioSpec *orig, SDL_AudioSpec *prepared) const char *env = SDL_getenv("SDL_AUDIO_FORMAT"); if (env != NULL) { const SDL_AudioFormat format = SDL_ParseAudioFormat(env); - prepared->format = format != 0 ? format : AUDIO_S16; + prepared->format = format != 0 ? format : SDL_AUDIO_S16; } else { - prepared->format = AUDIO_S16; + prepared->format = SDL_AUDIO_S16; } } @@ -1523,14 +1523,14 @@ void SDL_QuitAudio(void) static int format_idx; /* !!! FIXME: whoa, why are there globals in use here?! */ static int format_idx_sub; static SDL_AudioFormat format_list[NUM_FORMATS][NUM_FORMATS] = { - { AUDIO_U8, AUDIO_S8, AUDIO_S16LSB, AUDIO_S16MSB, AUDIO_S32LSB, AUDIO_S32MSB, AUDIO_F32LSB, AUDIO_F32MSB }, - { AUDIO_S8, AUDIO_U8, AUDIO_S16LSB, AUDIO_S16MSB, AUDIO_S32LSB, AUDIO_S32MSB, AUDIO_F32LSB, AUDIO_F32MSB }, - { AUDIO_S16LSB, AUDIO_S16MSB, AUDIO_S32LSB, AUDIO_S32MSB, AUDIO_F32LSB, AUDIO_F32MSB, AUDIO_U8, AUDIO_S8 }, - { AUDIO_S16MSB, AUDIO_S16LSB, AUDIO_S32MSB, AUDIO_S32LSB, AUDIO_F32MSB, AUDIO_F32LSB, AUDIO_U8, AUDIO_S8 }, - { AUDIO_S32LSB, AUDIO_S32MSB, AUDIO_F32LSB, AUDIO_F32MSB, AUDIO_S16LSB, AUDIO_S16MSB, AUDIO_U8, AUDIO_S8 }, - { AUDIO_S32MSB, AUDIO_S32LSB, AUDIO_F32MSB, AUDIO_F32LSB, AUDIO_S16MSB, AUDIO_S16LSB, AUDIO_U8, AUDIO_S8 }, - { AUDIO_F32LSB, AUDIO_F32MSB, AUDIO_S32LSB, AUDIO_S32MSB, AUDIO_S16LSB, AUDIO_S16MSB, AUDIO_U8, AUDIO_S8 }, - { AUDIO_F32MSB, AUDIO_F32LSB, AUDIO_S32MSB, AUDIO_S32LSB, AUDIO_S16MSB, AUDIO_S16LSB, AUDIO_U8, AUDIO_S8 }, + { SDL_AUDIO_U8, SDL_AUDIO_S8, SDL_AUDIO_S16LSB, SDL_AUDIO_S16MSB, SDL_AUDIO_S32LSB, SDL_AUDIO_S32MSB, SDL_AUDIO_F32LSB, SDL_AUDIO_F32MSB }, + { SDL_AUDIO_S8, SDL_AUDIO_U8, SDL_AUDIO_S16LSB, SDL_AUDIO_S16MSB, SDL_AUDIO_S32LSB, SDL_AUDIO_S32MSB, SDL_AUDIO_F32LSB, SDL_AUDIO_F32MSB }, + { SDL_AUDIO_S16LSB, SDL_AUDIO_S16MSB, SDL_AUDIO_S32LSB, SDL_AUDIO_S32MSB, SDL_AUDIO_F32LSB, SDL_AUDIO_F32MSB, SDL_AUDIO_U8, SDL_AUDIO_S8 }, + { SDL_AUDIO_S16MSB, SDL_AUDIO_S16LSB, SDL_AUDIO_S32MSB, SDL_AUDIO_S32LSB, SDL_AUDIO_F32MSB, SDL_AUDIO_F32LSB, SDL_AUDIO_U8, SDL_AUDIO_S8 }, + { SDL_AUDIO_S32LSB, SDL_AUDIO_S32MSB, SDL_AUDIO_F32LSB, SDL_AUDIO_F32MSB, SDL_AUDIO_S16LSB, SDL_AUDIO_S16MSB, SDL_AUDIO_U8, SDL_AUDIO_S8 }, + { SDL_AUDIO_S32MSB, SDL_AUDIO_S32LSB, SDL_AUDIO_F32MSB, SDL_AUDIO_F32LSB, SDL_AUDIO_S16MSB, SDL_AUDIO_S16LSB, SDL_AUDIO_U8, SDL_AUDIO_S8 }, + { SDL_AUDIO_F32LSB, SDL_AUDIO_F32MSB, SDL_AUDIO_S32LSB, SDL_AUDIO_S32MSB, SDL_AUDIO_S16LSB, SDL_AUDIO_S16MSB, SDL_AUDIO_U8, SDL_AUDIO_S8 }, + { SDL_AUDIO_F32MSB, SDL_AUDIO_F32LSB, SDL_AUDIO_S32MSB, SDL_AUDIO_S32LSB, SDL_AUDIO_S16MSB, SDL_AUDIO_S16LSB, SDL_AUDIO_U8, SDL_AUDIO_S8 }, }; SDL_AudioFormat @@ -1556,7 +1556,7 @@ SDL_GetNextAudioFormat(void) Uint8 SDL_GetSilenceValueForFormat(const SDL_AudioFormat format) { - return (format == AUDIO_U8) ? 0x80 : 0x00; + return (format == SDL_AUDIO_U8) ? 0x80 : 0x00; } void SDL_CalculateAudioSpec(SDL_AudioSpec *spec) diff --git a/src/audio/SDL_audiocvt.c b/src/audio/SDL_audiocvt.c index 28f3b2038..ac77896f1 100644 --- a/src/audio/SDL_audiocvt.c +++ b/src/audio/SDL_audiocvt.c @@ -261,11 +261,11 @@ static void AudioConvertToFloat(float *dst, const void *src, int num_samples, SD SDL_assert( (SDL_AUDIO_BITSIZE(src_fmt) <= 8) || ((SDL_AUDIO_ISBIGENDIAN(src_fmt) == 0) == (SDL_BYTEORDER == SDL_LIL_ENDIAN)) ); /* This only deals with native byte order. */ switch (src_fmt & ~SDL_AUDIO_MASK_ENDIAN) { - case AUDIO_S8: SDL_Convert_S8_to_F32(dst, (const Sint8 *) src, num_samples); break; - case AUDIO_U8: SDL_Convert_U8_to_F32(dst, (const Uint8 *) src, num_samples); break; - case AUDIO_S16: SDL_Convert_S16_to_F32(dst, (const Sint16 *) src, num_samples); break; - case AUDIO_S32: SDL_Convert_S32_to_F32(dst, (const Sint32 *) src, num_samples); break; - case AUDIO_F32: if (dst != src) { SDL_memcpy(dst, src, num_samples * sizeof (float)); } break; /* oh well, just pass it through. */ + case SDL_AUDIO_S8: SDL_Convert_S8_to_F32(dst, (const Sint8 *) src, num_samples); break; + case SDL_AUDIO_U8: SDL_Convert_U8_to_F32(dst, (const Uint8 *) src, num_samples); break; + case SDL_AUDIO_S16: SDL_Convert_S16_to_F32(dst, (const Sint16 *) src, num_samples); break; + case SDL_AUDIO_S32: SDL_Convert_S32_to_F32(dst, (const Sint32 *) src, num_samples); break; + case SDL_AUDIO_F32: if (dst != src) { SDL_memcpy(dst, src, num_samples * sizeof (float)); } break; /* oh well, just pass it through. */ default: SDL_assert(!"Unexpected audio format!"); break; } } @@ -275,11 +275,11 @@ static void AudioConvertFromFloat(void *dst, const float *src, int num_samples, SDL_assert( (SDL_AUDIO_BITSIZE(dst_fmt) <= 8) || ((SDL_AUDIO_ISBIGENDIAN(dst_fmt) == 0) == (SDL_BYTEORDER == SDL_LIL_ENDIAN)) ); /* This only deals with native byte order. */ switch (dst_fmt & ~SDL_AUDIO_MASK_ENDIAN) { - case AUDIO_S8: SDL_Convert_F32_to_S8((Sint8 *) dst, src, num_samples); break; - case AUDIO_U8: SDL_Convert_F32_to_U8((Uint8 *) dst, src, num_samples); break; - case AUDIO_S16: SDL_Convert_F32_to_S16((Sint16 *) dst, src, num_samples); break; - case AUDIO_S32: SDL_Convert_F32_to_S32((Sint32 *) dst, src, num_samples); break; - case AUDIO_F32: if (dst != src) { SDL_memcpy(dst, src, num_samples * sizeof (float)); } break; /* oh well, just pass it through. */ + case SDL_AUDIO_S8: SDL_Convert_F32_to_S8((Sint8 *) dst, src, num_samples); break; + case SDL_AUDIO_U8: SDL_Convert_F32_to_U8((Uint8 *) dst, src, num_samples); break; + case SDL_AUDIO_S16: SDL_Convert_F32_to_S16((Sint16 *) dst, src, num_samples); break; + case SDL_AUDIO_S32: SDL_Convert_F32_to_S32((Sint32 *) dst, src, num_samples); break; + case SDL_AUDIO_F32: if (dst != src) { SDL_memcpy(dst, src, num_samples * sizeof (float)); } break; /* oh well, just pass it through. */ default: SDL_assert(!"Unexpected audio format!"); break; } } @@ -287,14 +287,14 @@ static void AudioConvertFromFloat(void *dst, const float *src, int num_samples, static SDL_bool SDL_IsSupportedAudioFormat(const SDL_AudioFormat fmt) { switch (fmt) { - case AUDIO_U8: - case AUDIO_S8: - case AUDIO_S16LSB: - case AUDIO_S16MSB: - case AUDIO_S32LSB: - case AUDIO_S32MSB: - case AUDIO_F32LSB: - case AUDIO_F32MSB: + case SDL_AUDIO_U8: + case SDL_AUDIO_S8: + case SDL_AUDIO_S16LSB: + case SDL_AUDIO_S16MSB: + case SDL_AUDIO_S32LSB: + case SDL_AUDIO_S32MSB: + case SDL_AUDIO_F32LSB: + case SDL_AUDIO_F32MSB: return SDL_TRUE; /* supported. */ default: @@ -472,7 +472,7 @@ struct SDL_AudioStream static int GetMemsetSilenceValue(const SDL_AudioFormat fmt) { - return (fmt == AUDIO_U8) ? 0x80 : 0x00; + return (fmt == SDL_AUDIO_U8) ? 0x80 : 0x00; } /* this assumes you're holding the stream's lock (or are still creating the stream). */ @@ -931,8 +931,8 @@ static int GetAudioStreamDataInternal(SDL_AudioStream *stream, void *buf, int le const int resampler_padding_bytes = resampler_padding_frames * src_sample_frame_size; SDL_assert(src_rate != dst_rate); SDL_assert(history_buffer_bytes >= resampler_padding_bytes); - ConvertAudio(resampler_padding_frames, history_buffer + (history_buffer_bytes - resampler_padding_bytes), src_format, src_channels, stream->left_padding, AUDIO_F32, pre_resample_channels); - ConvertAudio(resampler_padding_frames, future_buffer, src_format, src_channels, stream->right_padding, AUDIO_F32, pre_resample_channels); + ConvertAudio(resampler_padding_frames, history_buffer + (history_buffer_bytes - resampler_padding_bytes), src_format, src_channels, stream->left_padding, SDL_AUDIO_F32, pre_resample_channels); + ConvertAudio(resampler_padding_frames, future_buffer, src_format, src_channels, stream->right_padding, SDL_AUDIO_F32, pre_resample_channels); } /* slide in new data to the history buffer, shuffling out the oldest, for the next run, since we've already updated left_padding with current data. */ @@ -956,9 +956,9 @@ static int GetAudioStreamDataInternal(SDL_AudioStream *stream, void *buf, int le } /* Resampling! get the work buffer to float32 format, etc, in-place. */ - ConvertAudio(input_frames, workbuf, src_format, src_channels, workbuf, AUDIO_F32, pre_resample_channels); + ConvertAudio(input_frames, workbuf, src_format, src_channels, workbuf, SDL_AUDIO_F32, pre_resample_channels); - if ((dst_format == AUDIO_F32) && (dst_channels == pre_resample_channels)) { + if ((dst_format == SDL_AUDIO_F32) && (dst_channels == pre_resample_channels)) { resample_outbuf = (float *) buf; } else { const int input_bytes = input_frames * pre_resample_channels * sizeof (float); @@ -971,7 +971,7 @@ static int GetAudioStreamDataInternal(SDL_AudioStream *stream, void *buf, int le resample_outbuf, output_frames); /* Get us to the final format! */ - ConvertAudio(output_frames, resample_outbuf, AUDIO_F32, src_channels, buf, dst_format, dst_channels); + ConvertAudio(output_frames, resample_outbuf, SDL_AUDIO_F32, src_channels, buf, dst_format, dst_channels); return (int) (output_frames * dst_sample_frame_size); } diff --git a/src/audio/SDL_audiotypecvt.c b/src/audio/SDL_audiotypecvt.c index 6946f76db..aeb556cd2 100644 --- a/src/audio/SDL_audiotypecvt.c +++ b/src/audio/SDL_audiotypecvt.c @@ -49,7 +49,7 @@ #define AUDIOCVT_TOFLOAT_SCALAR(from, fromtype, equation) \ static void SDL_Convert_##from##_to_F32_Scalar(float *dst, const fromtype *src, int num_samples) { \ int i; \ - LOG_DEBUG_AUDIO_CONVERT("AUDIO_" #from, "AUDIO_F32"); \ + LOG_DEBUG_AUDIO_CONVERT(#from, "F32"); \ for (i = num_samples - 1; i >= 0; --i) { \ dst[i] = equation; \ } \ @@ -65,7 +65,7 @@ AUDIOCVT_TOFLOAT_SCALAR(S32, Sint32, ((float)(src[i] >> 8)) * DIVBY8388607) #define AUDIOCVT_FROMFLOAT_SCALAR(to, totype, clampmin, clampmax, equation) \ static void SDL_Convert_F32_to_##to##_Scalar(totype *dst, const float *src, int num_samples) { \ int i; \ - LOG_DEBUG_AUDIO_CONVERT("AUDIO_F32", "AUDIO_" #to); \ + LOG_DEBUG_AUDIO_CONVERT("F32", #to); \ for (i = 0; i < num_samples; i++) { \ const float sample = src[i]; \ if (sample >= 1.0f) { \ @@ -91,7 +91,7 @@ static void SDL_TARGETING("sse2") SDL_Convert_S8_to_F32_SSE2(float *dst, const S { int i; - LOG_DEBUG_AUDIO_CONVERT("AUDIO_S8", "AUDIO_F32 (using SSE2)"); + LOG_DEBUG_AUDIO_CONVERT("S8", "F32 (using SSE2)"); src += num_samples - 1; dst += num_samples - 1; @@ -151,7 +151,7 @@ static void SDL_TARGETING("sse2") SDL_Convert_U8_to_F32_SSE2(float *dst, const U { int i; - LOG_DEBUG_AUDIO_CONVERT("AUDIO_U8", "AUDIO_F32 (using SSE2)"); + LOG_DEBUG_AUDIO_CONVERT("U8", "F32 (using SSE2)"); src += num_samples - 1; dst += num_samples - 1; @@ -213,7 +213,7 @@ static void SDL_TARGETING("sse2") SDL_Convert_S16_to_F32_SSE2(float *dst, const { int i; - LOG_DEBUG_AUDIO_CONVERT("AUDIO_S16", "AUDIO_F32 (using SSE2)"); + LOG_DEBUG_AUDIO_CONVERT("S16", "F32 (using SSE2)"); src += num_samples - 1; dst += num_samples - 1; @@ -262,7 +262,7 @@ static void SDL_TARGETING("sse2") SDL_Convert_S32_to_F32_SSE2(float *dst, const { int i; - LOG_DEBUG_AUDIO_CONVERT("AUDIO_S32", "AUDIO_F32 (using SSE2)"); + LOG_DEBUG_AUDIO_CONVERT("S32", "F32 (using SSE2)"); /* Get dst aligned to 16 bytes */ for (i = num_samples; i && (((size_t)dst) & 15); --i, ++src, ++dst) { @@ -299,7 +299,7 @@ static void SDL_TARGETING("sse2") SDL_Convert_F32_to_S8_SSE2(Sint8 *dst, const f { int i; - LOG_DEBUG_AUDIO_CONVERT("AUDIO_F32", "AUDIO_S8 (using SSE2)"); + LOG_DEBUG_AUDIO_CONVERT("F32", "S8 (using SSE2)"); /* Get dst aligned to 16 bytes */ for (i = num_samples; i && (((size_t)dst) & 15); --i, ++src, ++dst) { @@ -355,7 +355,7 @@ static void SDL_TARGETING("sse2") SDL_Convert_F32_to_U8_SSE2(Uint8 *dst, const f { int i; - LOG_DEBUG_AUDIO_CONVERT("AUDIO_F32", "AUDIO_U8 (using SSE2)"); + LOG_DEBUG_AUDIO_CONVERT("F32", "U8 (using SSE2)"); /* Get dst aligned to 16 bytes */ for (i = num_samples; i && (((size_t)dst) & 15); --i, ++src, ++dst) { @@ -411,7 +411,7 @@ static void SDL_TARGETING("sse2") SDL_Convert_F32_to_S16_SSE2(Sint16 *dst, const { int i; - LOG_DEBUG_AUDIO_CONVERT("AUDIO_F32", "AUDIO_S16 (using SSE2)"); + LOG_DEBUG_AUDIO_CONVERT("F32", "S16 (using SSE2)"); /* Get dst aligned to 16 bytes */ for (i = num_samples; i && (((size_t)dst) & 15); --i, ++src, ++dst) { @@ -465,7 +465,7 @@ static void SDL_TARGETING("sse2") SDL_Convert_F32_to_S32_SSE2(Sint32 *dst, const { int i; - LOG_DEBUG_AUDIO_CONVERT("AUDIO_F32", "AUDIO_S32 (using SSE2)"); + LOG_DEBUG_AUDIO_CONVERT("F32", "S32 (using SSE2)"); /* Get dst aligned to 16 bytes */ for (i = num_samples; i && (((size_t)dst) & 15); --i, ++src, ++dst) { @@ -519,7 +519,7 @@ static void SDL_Convert_S8_to_F32_NEON(float *dst, const Sint8 *src, int num_sam { int i; - LOG_DEBUG_AUDIO_CONVERT("AUDIO_S8", "AUDIO_F32 (using NEON)"); + LOG_DEBUG_AUDIO_CONVERT("S8", "F32 (using NEON)"); src += num_samples - 1; dst += num_samples - 1; @@ -571,7 +571,7 @@ static void SDL_Convert_U8_to_F32_NEON(float *dst, const Uint8 *src, int num_sam { int i; - LOG_DEBUG_AUDIO_CONVERT("AUDIO_U8", "AUDIO_F32 (using NEON)"); + LOG_DEBUG_AUDIO_CONVERT("U8", "F32 (using NEON)"); src += num_samples - 1; dst += num_samples - 1; @@ -624,7 +624,7 @@ static void SDL_Convert_S16_to_F32_NEON(float *dst, const Sint16 *src, int num_s { int i; - LOG_DEBUG_AUDIO_CONVERT("AUDIO_S16", "AUDIO_F32 (using NEON)"); + LOG_DEBUG_AUDIO_CONVERT("S16", "F32 (using NEON)"); src += num_samples - 1; dst += num_samples - 1; @@ -669,7 +669,7 @@ static void SDL_Convert_S32_to_F32_NEON(float *dst, const Sint32 *src, int num_s { int i; - LOG_DEBUG_AUDIO_CONVERT("AUDIO_S32", "AUDIO_F32 (using NEON)"); + LOG_DEBUG_AUDIO_CONVERT("S32", "F32 (using NEON)"); /* Get dst aligned to 16 bytes */ for (i = num_samples; i && (((size_t)dst) & 15); --i, ++src, ++dst) { @@ -706,7 +706,7 @@ static void SDL_Convert_F32_to_S8_NEON(Sint8 *dst, const float *src, int num_sam { int i; - LOG_DEBUG_AUDIO_CONVERT("AUDIO_F32", "AUDIO_S8 (using NEON)"); + LOG_DEBUG_AUDIO_CONVERT("F32", "S8 (using NEON)"); /* Get dst aligned to 16 bytes */ for (i = num_samples; i && (((size_t)dst) & 15); --i, ++src, ++dst) { @@ -764,7 +764,7 @@ static void SDL_Convert_F32_to_U8_NEON(Uint8 *dst, const float *src, int num_sam { int i; - LOG_DEBUG_AUDIO_CONVERT("AUDIO_F32", "AUDIO_U8 (using NEON)"); + LOG_DEBUG_AUDIO_CONVERT("F32", "U8 (using NEON)"); /* Get dst aligned to 16 bytes */ for (i = num_samples; i && (((size_t)dst) & 15); --i, ++src, ++dst) { @@ -823,7 +823,7 @@ static void SDL_Convert_F32_to_S16_NEON(Sint16 *dst, const float *src, int num_s { int i; - LOG_DEBUG_AUDIO_CONVERT("AUDIO_F32", "AUDIO_S16 (using NEON)"); + LOG_DEBUG_AUDIO_CONVERT("F32", "S16 (using NEON)"); /* Get dst aligned to 16 bytes */ for (i = num_samples; i && (((size_t)dst) & 15); --i, ++src, ++dst) { @@ -877,7 +877,7 @@ static void SDL_Convert_F32_to_S32_NEON(Sint32 *dst, const float *src, int num_s { int i; - LOG_DEBUG_AUDIO_CONVERT("AUDIO_F32", "AUDIO_S32 (using NEON)"); + LOG_DEBUG_AUDIO_CONVERT("F32", "S32 (using NEON)"); /* Get dst aligned to 16 bytes */ for (i = num_samples; i && (((size_t)dst) & 15); --i, ++src, ++dst) { diff --git a/src/audio/SDL_mixer.c b/src/audio/SDL_mixer.c index 5cfc9b6b1..c4630ef02 100644 --- a/src/audio/SDL_mixer.c +++ b/src/audio/SDL_mixer.c @@ -93,7 +93,7 @@ int SDL_MixAudioFormat(Uint8 *dst, const Uint8 *src, SDL_AudioFormat format, switch (format) { - case AUDIO_U8: + case SDL_AUDIO_U8: { Uint8 src_sample; @@ -106,7 +106,7 @@ int SDL_MixAudioFormat(Uint8 *dst, const Uint8 *src, SDL_AudioFormat format, } } break; - case AUDIO_S8: + case SDL_AUDIO_S8: { Sint8 *dst8, *src8; Sint8 src_sample; @@ -131,7 +131,7 @@ int SDL_MixAudioFormat(Uint8 *dst, const Uint8 *src, SDL_AudioFormat format, } } break; - case AUDIO_S16LSB: + case SDL_AUDIO_S16LSB: { Sint16 src1, src2; int dst_sample; @@ -155,7 +155,7 @@ int SDL_MixAudioFormat(Uint8 *dst, const Uint8 *src, SDL_AudioFormat format, } } break; - case AUDIO_S16MSB: + case SDL_AUDIO_S16MSB: { Sint16 src1, src2; int dst_sample; @@ -179,7 +179,7 @@ int SDL_MixAudioFormat(Uint8 *dst, const Uint8 *src, SDL_AudioFormat format, } } break; - case AUDIO_S32LSB: + case SDL_AUDIO_S32LSB: { const Uint32 *src32 = (Uint32 *)src; Uint32 *dst32 = (Uint32 *)dst; @@ -204,7 +204,7 @@ int SDL_MixAudioFormat(Uint8 *dst, const Uint8 *src, SDL_AudioFormat format, } } break; - case AUDIO_S32MSB: + case SDL_AUDIO_S32MSB: { const Uint32 *src32 = (Uint32 *)src; Uint32 *dst32 = (Uint32 *)dst; @@ -229,7 +229,7 @@ int SDL_MixAudioFormat(Uint8 *dst, const Uint8 *src, SDL_AudioFormat format, } } break; - case AUDIO_F32LSB: + case SDL_AUDIO_F32LSB: { const float fmaxvolume = 1.0f / ((float)SDL_MIX_MAXVOLUME); const float fvolume = (float)volume; @@ -257,7 +257,7 @@ int SDL_MixAudioFormat(Uint8 *dst, const Uint8 *src, SDL_AudioFormat format, } } break; - case AUDIO_F32MSB: + case SDL_AUDIO_F32MSB: { const float fmaxvolume = 1.0f / ((float)SDL_MIX_MAXVOLUME); const float fvolume = (float)volume; diff --git a/src/audio/SDL_wave.c b/src/audio/SDL_wave.c index 9b2e8b79e..dc5baed40 100644 --- a/src/audio/SDL_wave.c +++ b/src/audio/SDL_wave.c @@ -2039,22 +2039,22 @@ static int WaveLoad(SDL_RWops *src, WaveFile *file, SDL_AudioSpec *spec, Uint8 * case ALAW_CODE: case MULAW_CODE: /* These can be easily stored in the byte order of the system. */ - spec->format = AUDIO_S16SYS; + spec->format = SDL_AUDIO_S16SYS; break; case IEEE_FLOAT_CODE: - spec->format = AUDIO_F32LSB; + spec->format = SDL_AUDIO_F32LSB; break; case PCM_CODE: switch (format->bitspersample) { case 8: - spec->format = AUDIO_U8; + spec->format = SDL_AUDIO_U8; break; case 16: - spec->format = AUDIO_S16LSB; + spec->format = SDL_AUDIO_S16LSB; break; case 24: /* Has been shifted to 32 bits. */ case 32: - spec->format = AUDIO_S32LSB; + spec->format = SDL_AUDIO_S32LSB; break; default: /* Just in case something unexpected happened in the checks. */ diff --git a/src/audio/aaudio/SDL_aaudio.c b/src/audio/aaudio/SDL_aaudio.c index ee3d8752c..ed8da7d63 100644 --- a/src/audio/aaudio/SDL_aaudio.c +++ b/src/audio/aaudio/SDL_aaudio.c @@ -98,9 +98,9 @@ static int aaudio_OpenDevice(_THIS, const char *devname) } { aaudio_format_t format = AAUDIO_FORMAT_PCM_FLOAT; - if (this->spec.format == AUDIO_S16SYS) { + if (this->spec.format == SDL_AUDIO_S16SYS) { format = AAUDIO_FORMAT_PCM_I16; - } else if (this->spec.format == AUDIO_S16SYS) { + } else if (this->spec.format == SDL_AUDIO_S16SYS) { format = AAUDIO_FORMAT_PCM_FLOAT; } ctx.AAudioStreamBuilder_setFormat(ctx.builder, format); @@ -123,9 +123,9 @@ static int aaudio_OpenDevice(_THIS, const char *devname) { aaudio_format_t fmt = ctx.AAudioStream_getFormat(private->stream); if (fmt == AAUDIO_FORMAT_PCM_I16) { - this->spec.format = AUDIO_S16SYS; + this->spec.format = SDL_AUDIO_S16SYS; } else if (fmt == AAUDIO_FORMAT_PCM_FLOAT) { - this->spec.format = AUDIO_F32SYS; + this->spec.format = SDL_AUDIO_F32SYS; } } diff --git a/src/audio/alsa/SDL_alsa_audio.c b/src/audio/alsa/SDL_alsa_audio.c index f95878653..6916a20c6 100644 --- a/src/audio/alsa/SDL_alsa_audio.c +++ b/src/audio/alsa/SDL_alsa_audio.c @@ -571,28 +571,28 @@ static int ALSA_OpenDevice(_THIS, const char *devname) /* Try for a closest match on audio format */ for (test_format = SDL_GetFirstAudioFormat(this->spec.format); test_format; test_format = SDL_GetNextAudioFormat()) { switch (test_format) { - case AUDIO_U8: + case SDL_AUDIO_U8: format = SND_PCM_FORMAT_U8; break; - case AUDIO_S8: + case SDL_AUDIO_S8: format = SND_PCM_FORMAT_S8; break; - case AUDIO_S16LSB: + case SDL_AUDIO_S16LSB: format = SND_PCM_FORMAT_S16_LE; break; - case AUDIO_S16MSB: + case SDL_AUDIO_S16MSB: format = SND_PCM_FORMAT_S16_BE; break; - case AUDIO_S32LSB: + case SDL_AUDIO_S32LSB: format = SND_PCM_FORMAT_S32_LE; break; - case AUDIO_S32MSB: + case SDL_AUDIO_S32MSB: format = SND_PCM_FORMAT_S32_BE; break; - case AUDIO_F32LSB: + case SDL_AUDIO_F32LSB: format = SND_PCM_FORMAT_FLOAT_LE; break; - case AUDIO_F32MSB: + case SDL_AUDIO_F32MSB: format = SND_PCM_FORMAT_FLOAT_BE; break; default: diff --git a/src/audio/android/SDL_androidaudio.c b/src/audio/android/SDL_androidaudio.c index 93ba21664..2aefd7b4a 100644 --- a/src/audio/android/SDL_androidaudio.c +++ b/src/audio/android/SDL_androidaudio.c @@ -64,9 +64,9 @@ static int ANDROIDAUDIO_OpenDevice(_THIS, const char *devname) } for (test_format = SDL_GetFirstAudioFormat(this->spec.format); test_format; test_format = SDL_GetNextAudioFormat()) { - if ((test_format == AUDIO_U8) || - (test_format == AUDIO_S16) || - (test_format == AUDIO_F32)) { + if ((test_format == SDL_AUDIO_U8) || + (test_format == SDL_AUDIO_S16) || + (test_format == SDL_AUDIO_F32)) { this->spec.format = test_format; break; } diff --git a/src/audio/coreaudio/SDL_coreaudio.m b/src/audio/coreaudio/SDL_coreaudio.m index 53ff5353c..daa1f8f88 100644 --- a/src/audio/coreaudio/SDL_coreaudio.m +++ b/src/audio/coreaudio/SDL_coreaudio.m @@ -1068,14 +1068,14 @@ static int COREAUDIO_OpenDevice(_THIS, const char *devname) for (test_format = SDL_GetFirstAudioFormat(this->spec.format); test_format; test_format = SDL_GetNextAudioFormat()) { /* CoreAudio handles most of SDL's formats natively. */ switch (test_format) { - case AUDIO_U8: - case AUDIO_S8: - case AUDIO_S16LSB: - case AUDIO_S16MSB: - case AUDIO_S32LSB: - case AUDIO_S32MSB: - case AUDIO_F32LSB: - case AUDIO_F32MSB: + case SDL_AUDIO_U8: + case SDL_AUDIO_S8: + case SDL_AUDIO_S16LSB: + case SDL_AUDIO_S16MSB: + case SDL_AUDIO_S32LSB: + case SDL_AUDIO_S32MSB: + case SDL_AUDIO_F32LSB: + case SDL_AUDIO_F32MSB: break; default: diff --git a/src/audio/directsound/SDL_directsound.c b/src/audio/directsound/SDL_directsound.c index 176e9e90b..65b517ecb 100644 --- a/src/audio/directsound/SDL_directsound.c +++ b/src/audio/directsound/SDL_directsound.c @@ -516,10 +516,10 @@ static int DSOUND_OpenDevice(_THIS, const char *devname) for (test_format = SDL_GetFirstAudioFormat(this->spec.format); test_format; test_format = SDL_GetNextAudioFormat()) { switch (test_format) { - case AUDIO_U8: - case AUDIO_S16: - case AUDIO_S32: - case AUDIO_F32: + case SDL_AUDIO_U8: + case SDL_AUDIO_S16: + case SDL_AUDIO_S32: + case SDL_AUDIO_F32: tried_format = SDL_TRUE; this->spec.format = test_format; diff --git a/src/audio/dsp/SDL_dspaudio.c b/src/audio/dsp/SDL_dspaudio.c index 31d91b73f..d76be31a4 100644 --- a/src/audio/dsp/SDL_dspaudio.c +++ b/src/audio/dsp/SDL_dspaudio.c @@ -119,17 +119,17 @@ static int DSP_OpenDevice(_THIS, const char *devname) fprintf(stderr, "Trying format 0x%4.4x\n", test_format); #endif switch (test_format) { - case AUDIO_U8: + case SDL_AUDIO_U8: if (value & AFMT_U8) { format = AFMT_U8; } break; - case AUDIO_S16LSB: + case SDL_AUDIO_S16LSB: if (value & AFMT_S16_LE) { format = AFMT_S16_LE; } break; - case AUDIO_S16MSB: + case SDL_AUDIO_S16MSB: if (value & AFMT_S16_BE) { format = AFMT_S16_BE; } @@ -139,7 +139,7 @@ static int DSP_OpenDevice(_THIS, const char *devname) * These formats are not used by any real life systems so they are not * needed here. */ - case AUDIO_S8: + case SDL_AUDIO_S8: if (value & AFMT_S8) { format = AFMT_S8; } diff --git a/src/audio/emscripten/SDL_emscriptenaudio.c b/src/audio/emscripten/SDL_emscriptenaudio.c index 75855a930..ac3f3306c 100644 --- a/src/audio/emscripten/SDL_emscriptenaudio.c +++ b/src/audio/emscripten/SDL_emscriptenaudio.c @@ -237,7 +237,7 @@ static int EMSCRIPTENAUDIO_OpenDevice(_THIS, const char *devname) for (test_format = SDL_GetFirstAudioFormat(this->spec.format); test_format; test_format = SDL_GetNextAudioFormat()) { switch (test_format) { - case AUDIO_F32: /* web audio only supports floats */ + case SDL_AUDIO_F32: /* web audio only supports floats */ break; default: continue; diff --git a/src/audio/haiku/SDL_haikuaudio.cc b/src/audio/haiku/SDL_haikuaudio.cc index ccc353aad..e21ff0363 100644 --- a/src/audio/haiku/SDL_haikuaudio.cc +++ b/src/audio/haiku/SDL_haikuaudio.cc @@ -134,37 +134,37 @@ static int HAIKUAUDIO_OpenDevice(_THIS, const char *devname) format.channel_count = _this->spec.channels; /* !!! FIXME: support > 2? */ for (test_format = SDL_GetFirstAudioFormat(_this->spec.format); test_format; test_format = SDL_GetNextAudioFormat()) { switch (test_format) { - case AUDIO_S8: + case SDL_AUDIO_S8: format.format = media_raw_audio_format::B_AUDIO_CHAR; break; - case AUDIO_U8: + case SDL_AUDIO_U8: format.format = media_raw_audio_format::B_AUDIO_UCHAR; break; - case AUDIO_S16LSB: + case SDL_AUDIO_S16LSB: format.format = media_raw_audio_format::B_AUDIO_SHORT; break; - case AUDIO_S16MSB: + case SDL_AUDIO_S16MSB: format.format = media_raw_audio_format::B_AUDIO_SHORT; format.byte_order = B_MEDIA_BIG_ENDIAN; break; - case AUDIO_S32LSB: + case SDL_AUDIO_S32LSB: format.format = media_raw_audio_format::B_AUDIO_INT; break; - case AUDIO_S32MSB: + case SDL_AUDIO_S32MSB: format.format = media_raw_audio_format::B_AUDIO_INT; format.byte_order = B_MEDIA_BIG_ENDIAN; break; - case AUDIO_F32LSB: + case SDL_AUDIO_F32LSB: format.format = media_raw_audio_format::B_AUDIO_FLOAT; break; - case AUDIO_F32MSB: + case SDL_AUDIO_F32MSB: format.format = media_raw_audio_format::B_AUDIO_FLOAT; format.byte_order = B_MEDIA_BIG_ENDIAN; break; diff --git a/src/audio/jack/SDL_jackaudio.c b/src/audio/jack/SDL_jackaudio.c index 43916bbe5..b724de4e8 100644 --- a/src/audio/jack/SDL_jackaudio.c +++ b/src/audio/jack/SDL_jackaudio.c @@ -317,7 +317,7 @@ static int JACK_OpenDevice(_THIS, const char *devname) /* !!! FIXME: docs say about buffer size: "This size may change, clients that depend on it must register a bufsize_callback so they will be notified if it does." */ /* Jack pretty much demands what it wants. */ - this->spec.format = AUDIO_F32SYS; + this->spec.format = SDL_AUDIO_F32SYS; this->spec.freq = JACK_jack_get_sample_rate(client); this->spec.channels = channels; this->spec.samples = JACK_jack_get_buffer_size(client); diff --git a/src/audio/n3ds/SDL_n3dsaudio.c b/src/audio/n3ds/SDL_n3dsaudio.c index d03721583..075aa5e28 100644 --- a/src/audio/n3ds/SDL_n3dsaudio.c +++ b/src/audio/n3ds/SDL_n3dsaudio.c @@ -316,14 +316,14 @@ static int FindAudioFormat(_THIS) while (!found_valid_format && test_format) { this->spec.format = test_format; switch (test_format) { - case AUDIO_S8: + case SDL_AUDIO_S8: /* Signed 8-bit audio supported */ this->hidden->format = (this->spec.channels == 2) ? NDSP_FORMAT_STEREO_PCM8 : NDSP_FORMAT_MONO_PCM8; this->hidden->isSigned = 1; this->hidden->bytePerSample = this->spec.channels; found_valid_format = SDL_TRUE; break; - case AUDIO_S16: + case SDL_AUDIO_S16: /* Signed 16-bit audio supported */ this->hidden->format = (this->spec.channels == 2) ? NDSP_FORMAT_STEREO_PCM16 : NDSP_FORMAT_MONO_PCM16; this->hidden->isSigned = 1; diff --git a/src/audio/netbsd/SDL_netbsdaudio.c b/src/audio/netbsd/SDL_netbsdaudio.c index 13e333954..e9503f20b 100644 --- a/src/audio/netbsd/SDL_netbsdaudio.c +++ b/src/audio/netbsd/SDL_netbsdaudio.c @@ -237,22 +237,22 @@ static int NETBSDAUDIO_OpenDevice(_THIS, const char *devname) for (test_format = SDL_GetFirstAudioFormat(this->spec.format); test_format; test_format = SDL_GetNextAudioFormat()) { switch (test_format) { - case AUDIO_U8: + case SDL_AUDIO_U8: encoding = AUDIO_ENCODING_ULINEAR; break; - case AUDIO_S8: + case SDL_AUDIO_S8: encoding = AUDIO_ENCODING_SLINEAR; break; - case AUDIO_S16LSB: + case SDL_AUDIO_S16LSB: encoding = AUDIO_ENCODING_SLINEAR_LE; break; - case AUDIO_S16MSB: + case SDL_AUDIO_S16MSB: encoding = AUDIO_ENCODING_SLINEAR_BE; break; - case AUDIO_S32LSB: + case SDL_AUDIO_S32LSB: encoding = AUDIO_ENCODING_SLINEAR_LE; break; - case AUDIO_S32MSB: + case SDL_AUDIO_S32MSB: encoding = AUDIO_ENCODING_SLINEAR_BE; break; default: diff --git a/src/audio/openslES/SDL_openslES.c b/src/audio/openslES/SDL_openslES.c index 626df9420..58b475444 100644 --- a/src/audio/openslES/SDL_openslES.c +++ b/src/audio/openslES/SDL_openslES.c @@ -239,7 +239,7 @@ static int openslES_CreatePCMRecorder(_THIS) } /* Just go with signed 16-bit audio as it's the most compatible */ - this->spec.format = AUDIO_S16SYS; + this->spec.format = SDL_AUDIO_S16SYS; this->spec.channels = 1; /*this->spec.freq = SL_SAMPLINGRATE_16 / 1000;*/ @@ -427,12 +427,12 @@ static int openslES_CreatePCMPlayer(_THIS) if (!test_format) { /* Didn't find a compatible format : */ LOGI("No compatible audio format, using signed 16-bit audio"); - test_format = AUDIO_S16SYS; + test_format = SDL_AUDIO_S16SYS; } this->spec.format = test_format; } else { /* Just go with signed 16-bit audio as it's the most compatible */ - this->spec.format = AUDIO_S16SYS; + this->spec.format = SDL_AUDIO_S16SYS; } /* Update the fragment size as size in bytes */ diff --git a/src/audio/pipewire/SDL_pipewire.c b/src/audio/pipewire/SDL_pipewire.c index fff0a8b9a..c52946c51 100644 --- a/src/audio/pipewire/SDL_pipewire.c +++ b/src/audio/pipewire/SDL_pipewire.c @@ -716,7 +716,7 @@ static void registry_event_global_callback(void *object, uint32_t id, uint32_t p /* Begin setting the node properties */ io->id = id; io->is_capture = is_capture; - io->spec.format = AUDIO_F32; /* Pipewire uses floats internally, other formats require conversion. */ + io->spec.format = SDL_AUDIO_F32; /* Pipewire uses floats internally, other formats require conversion. */ io->name = io->buf; io->path = io->buf + desc_buffer_len; SDL_strlcpy(io->buf, node_desc, desc_buffer_len); @@ -909,28 +909,28 @@ static void initialize_spa_info(const SDL_AudioSpec *spec, struct spa_audio_info /* Pipewire natively supports all of SDL's sample formats */ switch (spec->format) { - case AUDIO_U8: + case SDL_AUDIO_U8: info->format = SPA_AUDIO_FORMAT_U8; break; - case AUDIO_S8: + case SDL_AUDIO_S8: info->format = SPA_AUDIO_FORMAT_S8; break; - case AUDIO_S16LSB: + case SDL_AUDIO_S16LSB: info->format = SPA_AUDIO_FORMAT_S16_LE; break; - case AUDIO_S16MSB: + case SDL_AUDIO_S16MSB: info->format = SPA_AUDIO_FORMAT_S16_BE; break; - case AUDIO_S32LSB: + case SDL_AUDIO_S32LSB: info->format = SPA_AUDIO_FORMAT_S32_LE; break; - case AUDIO_S32MSB: + case SDL_AUDIO_S32MSB: info->format = SPA_AUDIO_FORMAT_S32_BE; break; - case AUDIO_F32LSB: + case SDL_AUDIO_F32LSB: info->format = SPA_AUDIO_FORMAT_F32_LE; break; - case AUDIO_F32MSB: + case SDL_AUDIO_F32MSB: info->format = SPA_AUDIO_FORMAT_F32_BE; break; } diff --git a/src/audio/ps2/SDL_ps2audio.c b/src/audio/ps2/SDL_ps2audio.c index c2c258b05..9e588842a 100644 --- a/src/audio/ps2/SDL_ps2audio.c +++ b/src/audio/ps2/SDL_ps2audio.c @@ -63,11 +63,11 @@ static int PS2AUDIO_OpenDevice(_THIS, const char *devname) this->spec.samples = 512; this->spec.channels = this->spec.channels == 1 ? 1 : 2; - this->spec.format = this->spec.format == AUDIO_S8 ? AUDIO_S8 : AUDIO_S16; + this->spec.format = this->spec.format == SDL_AUDIO_S8 ? SDL_AUDIO_S8 : SDL_AUDIO_S16; SDL_CalculateAudioSpec(&this->spec); - format.bits = this->spec.format == AUDIO_S8 ? 8 : 16; + format.bits = this->spec.format == SDL_AUDIO_S8 ? 8 : 16; format.freq = this->spec.freq; format.channels = this->spec.channels; diff --git a/src/audio/psp/SDL_pspaudio.c b/src/audio/psp/SDL_pspaudio.c index 247d1fc56..f3cadd70b 100644 --- a/src/audio/psp/SDL_pspaudio.c +++ b/src/audio/psp/SDL_pspaudio.c @@ -55,7 +55,7 @@ static int PSPAUDIO_OpenDevice(_THIS, const char *devname) SDL_zerop(this->hidden); /* device only natively supports S16LSB */ - this->spec.format = AUDIO_S16LSB; + this->spec.format = SDL_AUDIO_S16LSB; /* PSP has some limitations with the Audio. It fully supports 44.1KHz (Mono & Stereo), however with frequencies differents than 44.1KHz, it just supports Stereo, diff --git a/src/audio/pulseaudio/SDL_pulseaudio.c b/src/audio/pulseaudio/SDL_pulseaudio.c index 6c5f9a417..56e90d07b 100644 --- a/src/audio/pulseaudio/SDL_pulseaudio.c +++ b/src/audio/pulseaudio/SDL_pulseaudio.c @@ -541,25 +541,25 @@ static int PULSEAUDIO_OpenDevice(_THIS, const char *devname) fprintf(stderr, "Trying format 0x%4.4x\n", test_format); #endif switch (test_format) { - case AUDIO_U8: + case SDL_AUDIO_U8: format = PA_SAMPLE_U8; break; - case AUDIO_S16LSB: + case SDL_AUDIO_S16LSB: format = PA_SAMPLE_S16LE; break; - case AUDIO_S16MSB: + case SDL_AUDIO_S16MSB: format = PA_SAMPLE_S16BE; break; - case AUDIO_S32LSB: + case SDL_AUDIO_S32LSB: format = PA_SAMPLE_S32LE; break; - case AUDIO_S32MSB: + case SDL_AUDIO_S32MSB: format = PA_SAMPLE_S32BE; break; - case AUDIO_F32LSB: + case SDL_AUDIO_F32LSB: format = PA_SAMPLE_FLOAT32LE; break; - case AUDIO_F32MSB: + case SDL_AUDIO_F32MSB: format = PA_SAMPLE_FLOAT32BE; break; default: @@ -671,19 +671,19 @@ static SDL_AudioFormat PulseFormatToSDLFormat(pa_sample_format_t format) { switch (format) { case PA_SAMPLE_U8: - return AUDIO_U8; + return SDL_AUDIO_U8; case PA_SAMPLE_S16LE: - return AUDIO_S16LSB; + return SDL_AUDIO_S16LSB; case PA_SAMPLE_S16BE: - return AUDIO_S16MSB; + return SDL_AUDIO_S16MSB; case PA_SAMPLE_S32LE: - return AUDIO_S32LSB; + return SDL_AUDIO_S32LSB; case PA_SAMPLE_S32BE: - return AUDIO_S32MSB; + return SDL_AUDIO_S32MSB; case PA_SAMPLE_FLOAT32LE: - return AUDIO_F32LSB; + return SDL_AUDIO_F32LSB; case PA_SAMPLE_FLOAT32BE: - return AUDIO_F32MSB; + return SDL_AUDIO_F32MSB; default: return 0; } diff --git a/src/audio/qnx/SDL_qsa_audio.c b/src/audio/qnx/SDL_qsa_audio.c index 61767e881..9501fc2c9 100644 --- a/src/audio/qnx/SDL_qsa_audio.c +++ b/src/audio/qnx/SDL_qsa_audio.c @@ -319,49 +319,49 @@ QSA_OpenDevice(_THIS, const char *devname) for (test_format = SDL_GetFirstAudioFormat(this->spec.format); !found;) { /* if match found set format to equivalent QSA format */ switch (test_format) { - case AUDIO_U8: + case SDL_AUDIO_U8: { format = SND_PCM_SFMT_U8; found = 1; } break; - case AUDIO_S8: + case SDL_AUDIO_S8: { format = SND_PCM_SFMT_S8; found = 1; } break; - case AUDIO_S16LSB: + case SDL_AUDIO_S16LSB: { format = SND_PCM_SFMT_S16_LE; found = 1; } break; - case AUDIO_S16MSB: + case SDL_AUDIO_S16MSB: { format = SND_PCM_SFMT_S16_BE; found = 1; } break; - case AUDIO_S32LSB: + case SDL_AUDIO_S32LSB: { format = SND_PCM_SFMT_S32_LE; found = 1; } break; - case AUDIO_S32MSB: + case SDL_AUDIO_S32MSB: { format = SND_PCM_SFMT_S32_BE; found = 1; } break; - case AUDIO_F32LSB: + case SDL_AUDIO_F32LSB: { format = SND_PCM_SFMT_FLOAT_LE; found = 1; } break; - case AUDIO_F32MSB: + case SDL_AUDIO_F32MSB: { format = SND_PCM_SFMT_FLOAT_BE; found = 1; diff --git a/src/audio/sndio/SDL_sndioaudio.c b/src/audio/sndio/SDL_sndioaudio.c index 424b5969d..23a7f3704 100644 --- a/src/audio/sndio/SDL_sndioaudio.c +++ b/src/audio/sndio/SDL_sndioaudio.c @@ -284,17 +284,17 @@ static int SNDIO_OpenDevice(_THIS, const char *devname) } if ((par.bps == 4) && (par.sig) && (par.le)) { - this->spec.format = AUDIO_S32LSB; + this->spec.format = SDL_AUDIO_S32LSB; } else if ((par.bps == 4) && (par.sig) && (!par.le)) { - this->spec.format = AUDIO_S32MSB; + this->spec.format = SDL_AUDIO_S32MSB; } else if ((par.bps == 2) && (par.sig) && (par.le)) { - this->spec.format = AUDIO_S16LSB; + this->spec.format = SDL_AUDIO_S16LSB; } else if ((par.bps == 2) && (par.sig) && (!par.le)) { - this->spec.format = AUDIO_S16MSB; + this->spec.format = SDL_AUDIO_S16MSB; } else if ((par.bps == 1) && (par.sig)) { - this->spec.format = AUDIO_S8; + this->spec.format = SDL_AUDIO_S8; } else if ((par.bps == 1) && (!par.sig)) { - this->spec.format = AUDIO_U8; + this->spec.format = SDL_AUDIO_U8; } else { return SDL_SetError("sndio: Got unsupported hardware audio format."); } diff --git a/src/audio/vita/SDL_vitaaudio.c b/src/audio/vita/SDL_vitaaudio.c index b39f303f9..401c397d0 100644 --- a/src/audio/vita/SDL_vitaaudio.c +++ b/src/audio/vita/SDL_vitaaudio.c @@ -70,7 +70,7 @@ static int VITAAUD_OpenDevice(_THIS, const char *devname) SDL_memset(this->hidden, 0, sizeof(*this->hidden)); for (test_format = SDL_GetFirstAudioFormat(this->spec.format); test_format; test_format = SDL_GetNextAudioFormat()) { - if (test_format == AUDIO_S16LSB) { + if (test_format == SDL_AUDIO_S16LSB) { this->spec.format = test_format; break; } diff --git a/src/audio/wasapi/SDL_wasapi_winrt.cpp b/src/audio/wasapi/SDL_wasapi_winrt.cpp index c9aa4f3b4..0c1b94673 100644 --- a/src/audio/wasapi/SDL_wasapi_winrt.cpp +++ b/src/audio/wasapi/SDL_wasapi_winrt.cpp @@ -345,19 +345,19 @@ extern "C" SDL_AudioFormat WaveFormatToSDLFormat(WAVEFORMATEX *waveformat) { if ((waveformat->wFormatTag == WAVE_FORMAT_IEEE_FLOAT) && (waveformat->wBitsPerSample == 32)) { - return AUDIO_F32SYS; + return SDL_AUDIO_F32SYS; } else if ((waveformat->wFormatTag == WAVE_FORMAT_PCM) && (waveformat->wBitsPerSample == 16)) { - return AUDIO_S16SYS; + return SDL_AUDIO_S16SYS; } else if ((waveformat->wFormatTag == WAVE_FORMAT_PCM) && (waveformat->wBitsPerSample == 32)) { - return AUDIO_S32SYS; + return SDL_AUDIO_S32SYS; } else if (waveformat->wFormatTag == WAVE_FORMAT_EXTENSIBLE) { const WAVEFORMATEXTENSIBLE *ext = (const WAVEFORMATEXTENSIBLE *)waveformat; if ((SDL_memcmp(&ext->SubFormat, &SDL_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, sizeof(GUID)) == 0) && (waveformat->wBitsPerSample == 32)) { - return AUDIO_F32SYS; + return SDL_AUDIO_F32SYS; } else if ((SDL_memcmp(&ext->SubFormat, &SDL_KSDATAFORMAT_SUBTYPE_PCM, sizeof(GUID)) == 0) && (waveformat->wBitsPerSample == 16)) { - return AUDIO_S16SYS; + return SDL_AUDIO_S16SYS; } else if ((SDL_memcmp(&ext->SubFormat, &SDL_KSDATAFORMAT_SUBTYPE_PCM, sizeof(GUID)) == 0) && (waveformat->wBitsPerSample == 32)) { - return AUDIO_S32SYS; + return SDL_AUDIO_S32SYS; } } return 0; diff --git a/src/core/android/SDL_android.c b/src/core/android/SDL_android.c index 937723a70..028bd1fba 100644 --- a/src/core/android/SDL_android.c +++ b/src/core/android/SDL_android.c @@ -1541,13 +1541,13 @@ int Android_JNI_OpenAudioDevice(int iscapture, int device_id, SDL_AudioSpec *spe JNIEnv *env = Android_JNI_GetEnv(); switch (spec->format) { - case AUDIO_U8: + case SDL_AUDIO_U8: audioformat = ENCODING_PCM_8BIT; break; - case AUDIO_S16: + case SDL_AUDIO_S16: audioformat = ENCODING_PCM_16BIT; break; - case AUDIO_F32: + case SDL_AUDIO_F32: audioformat = ENCODING_PCM_FLOAT; break; default: @@ -1575,13 +1575,13 @@ int Android_JNI_OpenAudioDevice(int iscapture, int device_id, SDL_AudioSpec *spe audioformat = resultElements[1]; switch (audioformat) { case ENCODING_PCM_8BIT: - spec->format = AUDIO_U8; + spec->format = SDL_AUDIO_U8; break; case ENCODING_PCM_16BIT: - spec->format = AUDIO_S16; + spec->format = SDL_AUDIO_S16; break; case ENCODING_PCM_FLOAT: - spec->format = AUDIO_F32; + spec->format = SDL_AUDIO_F32; break; default: return SDL_SetError("Unexpected audio format from Java: %d\n", audioformat); diff --git a/src/core/windows/SDL_immdevice.c b/src/core/windows/SDL_immdevice.c index df0a5d0f9..c83615468 100644 --- a/src/core/windows/SDL_immdevice.c +++ b/src/core/windows/SDL_immdevice.c @@ -509,19 +509,19 @@ SDL_AudioFormat WaveFormatToSDLFormat(WAVEFORMATEX *waveformat) { if ((waveformat->wFormatTag == WAVE_FORMAT_IEEE_FLOAT) && (waveformat->wBitsPerSample == 32)) { - return AUDIO_F32SYS; + return SDL_AUDIO_F32SYS; } else if ((waveformat->wFormatTag == WAVE_FORMAT_PCM) && (waveformat->wBitsPerSample == 16)) { - return AUDIO_S16SYS; + return SDL_AUDIO_S16SYS; } else if ((waveformat->wFormatTag == WAVE_FORMAT_PCM) && (waveformat->wBitsPerSample == 32)) { - return AUDIO_S32SYS; + return SDL_AUDIO_S32SYS; } else if (waveformat->wFormatTag == WAVE_FORMAT_EXTENSIBLE) { const WAVEFORMATEXTENSIBLE *ext = (const WAVEFORMATEXTENSIBLE *)waveformat; if ((SDL_memcmp(&ext->SubFormat, &SDL_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, sizeof(GUID)) == 0) && (waveformat->wBitsPerSample == 32)) { - return AUDIO_F32SYS; + return SDL_AUDIO_F32SYS; } else if ((SDL_memcmp(&ext->SubFormat, &SDL_KSDATAFORMAT_SUBTYPE_PCM, sizeof(GUID)) == 0) && (waveformat->wBitsPerSample == 16)) { - return AUDIO_S16SYS; + return SDL_AUDIO_S16SYS; } else if ((SDL_memcmp(&ext->SubFormat, &SDL_KSDATAFORMAT_SUBTYPE_PCM, sizeof(GUID)) == 0) && (waveformat->wBitsPerSample == 32)) { - return AUDIO_S32SYS; + return SDL_AUDIO_S32SYS; } } return 0; diff --git a/src/test/SDL_test_common.c b/src/test/SDL_test_common.c index 806c5fb04..a21df7483 100644 --- a/src/test/SDL_test_common.c +++ b/src/test/SDL_test_common.c @@ -96,7 +96,7 @@ SDLTest_CommonCreateState(char **argv, Uint32 flags) state->logical_scale_mode = SDL_SCALEMODE_LINEAR; state->num_windows = 1; state->audiospec.freq = 22050; - state->audiospec.format = AUDIO_S16; + state->audiospec.format = SDL_AUDIO_S16; state->audiospec.channels = 2; state->audiospec.samples = 2048; @@ -584,23 +584,23 @@ int SDLTest_CommonArg(SDLTest_CommonState *state, int index) return -1; } if (SDL_strcasecmp(argv[index], "U8") == 0) { - state->audiospec.format = AUDIO_U8; + state->audiospec.format = SDL_AUDIO_U8; return 2; } if (SDL_strcasecmp(argv[index], "S8") == 0) { - state->audiospec.format = AUDIO_S8; + state->audiospec.format = SDL_AUDIO_S8; return 2; } if (SDL_strcasecmp(argv[index], "S16") == 0) { - state->audiospec.format = AUDIO_S16; + state->audiospec.format = SDL_AUDIO_S16; return 2; } if (SDL_strcasecmp(argv[index], "S16LE") == 0) { - state->audiospec.format = AUDIO_S16LSB; + state->audiospec.format = SDL_AUDIO_S16LSB; return 2; } if (SDL_strcasecmp(argv[index], "S16BE") == 0) { - state->audiospec.format = AUDIO_S16MSB; + state->audiospec.format = SDL_AUDIO_S16MSB; return 2; } diff --git a/test/testaudiocapture.c b/test/testaudiocapture.c index 241938532..01c267608 100644 --- a/test/testaudiocapture.c +++ b/test/testaudiocapture.c @@ -152,7 +152,7 @@ int main(int argc, char **argv) SDL_zero(wanted); wanted.freq = 44100; - wanted.format = AUDIO_F32SYS; + wanted.format = SDL_AUDIO_F32SYS; wanted.channels = 1; wanted.samples = 4096; wanted.callback = NULL; diff --git a/test/testautomation_audio.c b/test/testautomation_audio.c index 2f0b35290..9cd98a859 100644 --- a/test/testautomation_audio.c +++ b/test/testautomation_audio.c @@ -174,7 +174,7 @@ static int audio_initOpenCloseQuitAudio(void *arg) case 0: /* Set standard desired spec */ desired.freq = 22050; - desired.format = AUDIO_S16SYS; + desired.format = SDL_AUDIO_S16SYS; desired.channels = 2; desired.samples = 4096; desired.callback = audio_testCallback; @@ -183,7 +183,7 @@ static int audio_initOpenCloseQuitAudio(void *arg) case 1: /* Set custom desired spec */ desired.freq = 48000; - desired.format = AUDIO_F32SYS; + desired.format = SDL_AUDIO_F32SYS; desired.channels = 2; desired.samples = 2048; desired.callback = audio_testCallback; @@ -267,7 +267,7 @@ static int audio_pauseUnpauseAudio(void *arg) case 0: /* Set standard desired spec */ desired.freq = 22050; - desired.format = AUDIO_S16SYS; + desired.format = SDL_AUDIO_S16SYS; desired.channels = 2; desired.samples = 4096; desired.callback = audio_testCallback; @@ -277,7 +277,7 @@ static int audio_pauseUnpauseAudio(void *arg) case 1: /* Set custom desired spec */ desired.freq = 48000; - desired.format = AUDIO_F32SYS; + desired.format = SDL_AUDIO_F32SYS; desired.channels = 2; desired.samples = 2048; desired.callback = audio_testCallback; @@ -504,12 +504,12 @@ static int audio_printCurrentAudioDriver(void *arg) } /* Definition of all formats, channels, and frequencies used to test audio conversions */ -static SDL_AudioFormat g_audioFormats[] = { AUDIO_S8, AUDIO_U8, AUDIO_S16LSB, AUDIO_S16MSB, AUDIO_S16SYS, AUDIO_S16, - AUDIO_S32LSB, AUDIO_S32MSB, AUDIO_S32SYS, AUDIO_S32, - AUDIO_F32LSB, AUDIO_F32MSB, AUDIO_F32SYS, AUDIO_F32 }; -static const char *g_audioFormatsVerbose[] = { "AUDIO_S8", "AUDIO_U8", "AUDIO_S16LSB", "AUDIO_S16MSB", "AUDIO_S16SYS", "AUDIO_S16", - "AUDIO_S32LSB", "AUDIO_S32MSB", "AUDIO_S32SYS", "AUDIO_S32", - "AUDIO_F32LSB", "AUDIO_F32MSB", "AUDIO_F32SYS", "AUDIO_F32" }; +static SDL_AudioFormat g_audioFormats[] = { SDL_AUDIO_S8, SDL_AUDIO_U8, SDL_AUDIO_S16LSB, SDL_AUDIO_S16MSB, SDL_AUDIO_S16SYS, SDL_AUDIO_S16, + SDL_AUDIO_S32LSB, SDL_AUDIO_S32MSB, SDL_AUDIO_S32SYS, SDL_AUDIO_S32, + SDL_AUDIO_F32LSB, SDL_AUDIO_F32MSB, SDL_AUDIO_F32SYS, SDL_AUDIO_F32 }; +static const char *g_audioFormatsVerbose[] = { "SDL_AUDIO_S8", "SDL_AUDIO_U8", "SDL_AUDIO_S16LSB", "SDL_AUDIO_S16MSB", "SDL_AUDIO_S16SYS", "SDL_AUDIO_S16", + "SDL_AUDIO_S32LSB", "SDL_AUDIO_S32MSB", "SDL_AUDIO_S32SYS", "SDL_AUDIO_S32", + "SDL_AUDIO_F32LSB", "SDL_AUDIO_F32MSB", "SDL_AUDIO_F32SYS", "SDL_AUDIO_F32" }; static const int g_numAudioFormats = SDL_arraysize(g_audioFormats); static Uint8 g_audioChannels[] = { 1, 2, 4, 6 }; static const int g_numAudioChannels = SDL_arraysize(g_audioChannels); @@ -529,7 +529,7 @@ static int audio_buildAudioStream(void *arg) int i, ii, j, jj, k, kk; /* No conversion needed */ - spec1.format = AUDIO_S16LSB; + spec1.format = SDL_AUDIO_S16LSB; spec1.channels = 2; spec1.freq = 22050; stream = SDL_CreateAudioStream(spec1.format, spec1.channels, spec1.freq, @@ -539,10 +539,10 @@ static int audio_buildAudioStream(void *arg) SDL_DestroyAudioStream(stream); /* Typical conversion */ - spec1.format = AUDIO_S8; + spec1.format = SDL_AUDIO_S8; spec1.channels = 1; spec1.freq = 22050; - spec2.format = AUDIO_S16LSB; + spec2.format = SDL_AUDIO_S16LSB; spec2.channels = 2; spec2.freq = 44100; stream = SDL_CreateAudioStream(spec1.format, spec1.channels, spec1.freq, @@ -596,10 +596,10 @@ static int audio_buildAudioStreamNegative(void *arg) char message[256]; /* Valid format */ - spec1.format = AUDIO_S8; + spec1.format = SDL_AUDIO_S8; spec1.channels = 1; spec1.freq = 22050; - spec2.format = AUDIO_S16LSB; + spec2.format = SDL_AUDIO_S16LSB; spec2.channels = 2; spec2.freq = 44100; @@ -609,10 +609,10 @@ static int audio_buildAudioStreamNegative(void *arg) /* Invalid conversions */ for (i = 1; i < 64; i++) { /* Valid format to start with */ - spec1.format = AUDIO_S8; + spec1.format = SDL_AUDIO_S8; spec1.channels = 1; spec1.freq = 22050; - spec2.format = AUDIO_S16LSB; + spec2.format = SDL_AUDIO_S16LSB; spec2.channels = 2; spec2.freq = 44100; @@ -710,7 +710,7 @@ static int audio_openCloseAndGetAudioStatus(void *arg) /* Set standard desired spec */ desired.freq = 22050; - desired.format = AUDIO_S16SYS; + desired.format = SDL_AUDIO_S16SYS; desired.channels = 2; desired.samples = 4096; desired.callback = audio_testCallback; @@ -770,7 +770,7 @@ static int audio_lockUnlockOpenAudioDevice(void *arg) /* Set standard desired spec */ desired.freq = 22050; - desired.format = AUDIO_S16SYS; + desired.format = SDL_AUDIO_S16SYS; desired.channels = 2; desired.samples = 4096; desired.callback = audio_testCallback; @@ -958,7 +958,7 @@ static int audio_openCloseAudioDeviceConnected(void *arg) /* Set standard desired spec */ desired.freq = 22050; - desired.format = AUDIO_S16SYS; + desired.format = SDL_AUDIO_S16SYS; desired.channels = 2; desired.samples = 4096; desired.callback = audio_testCallback; @@ -1056,8 +1056,8 @@ 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); - stream = SDL_CreateAudioStream(AUDIO_F32, 1, spec->rate_in, AUDIO_F32, 1, spec->rate_out); - SDLTest_AssertPass("Call to SDL_CreateAudioStream(AUDIO_F32, 1, %i, AUDIO_F32, 1, %i)", spec->rate_in, spec->rate_out); + stream = SDL_CreateAudioStream(SDL_AUDIO_F32, 1, spec->rate_in, SDL_AUDIO_F32, 1, spec->rate_out); + SDLTest_AssertPass("Call to SDL_CreateAudioStream(SDL_AUDIO_F32, 1, %i, SDL_AUDIO_F32, 1, %i)", spec->rate_in, spec->rate_out); SDLTest_AssertCheck(stream != NULL, "Expected SDL_CreateAudioStream to succeed."); if (stream == NULL) { return TEST_ABORTED; diff --git a/test/testsurround.c b/test/testsurround.c index 1addf59c5..f4060b28f 100644 --- a/test/testsurround.c +++ b/test/testsurround.c @@ -180,7 +180,7 @@ int main(int argc, char *argv[]) } spec.freq = SAMPLE_RATE_HZ; - spec.format = AUDIO_S16SYS; + spec.format = SDL_AUDIO_S16SYS; spec.samples = 4096; spec.callback = fill_buffer;