Added SDL prefix AUDIO_* constants

main
Brick 2023-05-02 13:00:28 +01:00 committed by Sam Lantinga
parent 1ee2832326
commit 079ae065f1
35 changed files with 327 additions and 227 deletions

View File

@ -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

View File

@ -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 `<SDL3/SDL_intrin.h>` and are no longer automatically included in SDL.h.

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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);
}

View File

@ -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) {

View File

@ -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;

View File

@ -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. */

View File

@ -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;
}
}

View File

@ -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:

View File

@ -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;
}

View File

@ -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:

View File

@ -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;

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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:

View File

@ -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 */

View File

@ -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;
}

View File

@ -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;

View File

@ -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,

View File

@ -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;
}

View File

@ -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;

View File

@ -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.");
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

View File

@ -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;