Audio types have the same naming convention as other SDL endian types, e.g. [S|U][BITS][LE|BE]

Native endian types have no LE/BE suffix
This commit is contained in:
Sam Lantinga 2023-09-04 09:17:29 -07:00
parent 36b5f3e35c
commit 233789b0d1
28 changed files with 258 additions and 224 deletions

View File

@ -2591,51 +2591,51 @@ typedef SDL_cond, SDL_Condition;
@@ @@
@@ @@
- AUDIO_F32 - AUDIO_F32
+ SDL_AUDIO_F32 + SDL_AUDIO_F32LE
@@ @@
@@ @@
- AUDIO_F32LSB - AUDIO_F32LSB
+ SDL_AUDIO_F32LSB + SDL_AUDIO_F32LE
@@ @@
@@ @@
- AUDIO_F32MSB - AUDIO_F32MSB
+ SDL_AUDIO_F32MSB + SDL_AUDIO_F32BE
@@ @@
@@ @@
- AUDIO_F32SYS - AUDIO_F32SYS
+ SDL_AUDIO_F32SYS + SDL_AUDIO_F32
@@ @@
@@ @@
- AUDIO_S16 - AUDIO_S16
+ SDL_AUDIO_S16 + SDL_AUDIO_S16LE
@@ @@
@@ @@
- AUDIO_S16LSB - AUDIO_S16LSB
+ SDL_AUDIO_S16LSB + SDL_AUDIO_S16LE
@@ @@
@@ @@
- AUDIO_S16MSB - AUDIO_S16MSB
+ SDL_AUDIO_S16MSB + SDL_AUDIO_S16BE
@@ @@
@@ @@
- AUDIO_S16SYS - AUDIO_S16SYS
+ SDL_AUDIO_S16SYS + SDL_AUDIO_S16
@@ @@
@@ @@
- AUDIO_S32 - AUDIO_S32
+ SDL_AUDIO_S32 + SDL_AUDIO_S32LE
@@ @@
@@ @@
- AUDIO_S32LSB - AUDIO_S32LSB
+ SDL_AUDIO_S32LSB + SDL_AUDIO_S32LE
@@ @@
@@ @@
- AUDIO_S32MSB - AUDIO_S32MSB
+ SDL_AUDIO_S32MSB + SDL_AUDIO_S32BE
@@ @@
@@ @@
- AUDIO_S32SYS - AUDIO_S32SYS
+ SDL_AUDIO_S32SYS + SDL_AUDIO_S32
@@ @@
@@ @@
- AUDIO_S8 - AUDIO_S8

View File

@ -255,18 +255,18 @@ The following functions have been removed:
* SDL_GetQueuedAudioSize() * SDL_GetQueuedAudioSize()
The following symbols have been renamed: The following symbols have been renamed:
* AUDIO_F32 => SDL_AUDIO_F32 * AUDIO_F32 => SDL_AUDIO_F32LE
* AUDIO_F32LSB => SDL_AUDIO_F32LSB * AUDIO_F32LSB => SDL_AUDIO_F32LE
* AUDIO_F32MSB => SDL_AUDIO_F32MSB * AUDIO_F32MSB => SDL_AUDIO_F32BE
* AUDIO_F32SYS => SDL_AUDIO_F32SYS * AUDIO_F32SYS => SDL_AUDIO_F32
* AUDIO_S16 => SDL_AUDIO_S16 * AUDIO_S16 => SDL_AUDIO_S16LE
* AUDIO_S16LSB => SDL_AUDIO_S16LSB * AUDIO_S16LSB => SDL_AUDIO_S16LE
* AUDIO_S16MSB => SDL_AUDIO_S16MSB * AUDIO_S16MSB => SDL_AUDIO_S16BE
* AUDIO_S16SYS => SDL_AUDIO_S16SYS * AUDIO_S16SYS => SDL_AUDIO_S16
* AUDIO_S32 => SDL_AUDIO_S32 * AUDIO_S32 => SDL_AUDIO_S32LE
* AUDIO_S32LSB => SDL_AUDIO_S32LSB * AUDIO_S32LSB => SDL_AUDIO_S32LE
* AUDIO_S32MSB => SDL_AUDIO_S32MSB * AUDIO_S32MSB => SDL_AUDIO_S32BE
* AUDIO_S32SYS => SDL_AUDIO_S32SYS * AUDIO_S32SYS => SDL_AUDIO_S32
* AUDIO_S8 => SDL_AUDIO_S8 * AUDIO_S8 => SDL_AUDIO_S8
* AUDIO_U8 => SDL_AUDIO_U8 * AUDIO_U8 => SDL_AUDIO_U8

View File

@ -80,15 +80,17 @@ typedef Uint16 SDL_AudioFormat;
/* @{ */ /* @{ */
#define SDL_AUDIO_MASK_BITSIZE (0xFF) #define SDL_AUDIO_MASK_BITSIZE (0xFF)
#define SDL_AUDIO_MASK_DATATYPE (1<<8) #define SDL_AUDIO_MASK_FLOAT (1<<8)
#define SDL_AUDIO_MASK_ENDIAN (1<<12) #define SDL_AUDIO_MASK_LIL_ENDIAN (1<<12)
#define SDL_AUDIO_MASK_BIG_ENDIAN (1<<13)
#define SDL_AUDIO_MASK_ENDIAN (SDL_AUDIO_MASK_BIG_ENDIAN|SDL_AUDIO_MASK_LIL_ENDIAN)
#define SDL_AUDIO_MASK_SIGNED (1<<15) #define SDL_AUDIO_MASK_SIGNED (1<<15)
#define SDL_AUDIO_BITSIZE(x) (x & SDL_AUDIO_MASK_BITSIZE) #define SDL_AUDIO_BITSIZE(x) ((x) & SDL_AUDIO_MASK_BITSIZE)
#define SDL_AUDIO_ISFLOAT(x) (x & SDL_AUDIO_MASK_DATATYPE) #define SDL_AUDIO_ISFLOAT(x) ((x) & SDL_AUDIO_MASK_FLOAT)
#define SDL_AUDIO_ISBIGENDIAN(x) (x & SDL_AUDIO_MASK_ENDIAN) #define SDL_AUDIO_ISBIGENDIAN(x) (((x) & SDL_AUDIO_MASK_ENDIAN) == SDL_AUDIO_MASK_BIG_ENDIAN)
#define SDL_AUDIO_ISSIGNED(x) (x & SDL_AUDIO_MASK_SIGNED) #define SDL_AUDIO_ISLITTLEENDIAN(x) (((x) & SDL_AUDIO_MASK_ENDIAN) == SDL_AUDIO_MASK_LIL_ENDIAN)
#define SDL_AUDIO_ISSIGNED(x) ((x) & SDL_AUDIO_MASK_SIGNED)
#define SDL_AUDIO_ISINT(x) (!SDL_AUDIO_ISFLOAT(x)) #define SDL_AUDIO_ISINT(x) (!SDL_AUDIO_ISFLOAT(x))
#define SDL_AUDIO_ISLITTLEENDIAN(x) (!SDL_AUDIO_ISBIGENDIAN(x))
#define SDL_AUDIO_ISUNSIGNED(x) (!SDL_AUDIO_ISSIGNED(x)) #define SDL_AUDIO_ISUNSIGNED(x) (!SDL_AUDIO_ISSIGNED(x))
/** /**
@ -99,27 +101,24 @@ typedef Uint16 SDL_AudioFormat;
/* @{ */ /* @{ */
#define SDL_AUDIO_U8 0x0008 /**< Unsigned 8-bit samples */ #define SDL_AUDIO_U8 0x0008 /**< Unsigned 8-bit samples */
#define SDL_AUDIO_S8 0x8008 /**< Signed 8-bit samples */ #define SDL_AUDIO_S8 0x8008 /**< Signed 8-bit samples */
#define SDL_AUDIO_S16LSB 0x8010 /**< Signed 16-bit samples */ #define SDL_AUDIO_S16LE 0x9010 /**< Signed 16-bit samples */
#define SDL_AUDIO_S16MSB 0x9010 /**< As above, but big-endian byte order */ #define SDL_AUDIO_S16BE 0xA010 /**< As above, but big-endian byte order */
#define SDL_AUDIO_S16 SDL_AUDIO_S16LSB
/* @} */ /* @} */
/** /**
* \name int32 support * \name int32 support
*/ */
/* @{ */ /* @{ */
#define SDL_AUDIO_S32LSB 0x8020 /**< 32-bit integer samples */ #define SDL_AUDIO_S32LE 0x9020 /**< 32-bit integer samples */
#define SDL_AUDIO_S32MSB 0x9020 /**< As above, but big-endian byte order */ #define SDL_AUDIO_S32BE 0xA020 /**< As above, but big-endian byte order */
#define SDL_AUDIO_S32 SDL_AUDIO_S32LSB
/* @} */ /* @} */
/** /**
* \name float32 support * \name float32 support
*/ */
/* @{ */ /* @{ */
#define SDL_AUDIO_F32LSB 0x8120 /**< 32-bit floating point samples */ #define SDL_AUDIO_F32LE 0x9120 /**< 32-bit floating point samples */
#define SDL_AUDIO_F32MSB 0x9120 /**< As above, but big-endian byte order */ #define SDL_AUDIO_F32BE 0xA120 /**< As above, but big-endian byte order */
#define SDL_AUDIO_F32 SDL_AUDIO_F32LSB
/* @} */ /* @} */
/** /**
@ -127,13 +126,13 @@ typedef Uint16 SDL_AudioFormat;
*/ */
/* @{ */ /* @{ */
#if SDL_BYTEORDER == SDL_LIL_ENDIAN #if SDL_BYTEORDER == SDL_LIL_ENDIAN
#define SDL_AUDIO_S16SYS SDL_AUDIO_S16LSB #define SDL_AUDIO_S16 SDL_AUDIO_S16LE
#define SDL_AUDIO_S32SYS SDL_AUDIO_S32LSB #define SDL_AUDIO_S32 SDL_AUDIO_S32LE
#define SDL_AUDIO_F32SYS SDL_AUDIO_F32LSB #define SDL_AUDIO_F32 SDL_AUDIO_F32LE
#else #else
#define SDL_AUDIO_S16SYS SDL_AUDIO_S16MSB #define SDL_AUDIO_S16 SDL_AUDIO_S16BE
#define SDL_AUDIO_S32SYS SDL_AUDIO_S32MSB #define SDL_AUDIO_S32 SDL_AUDIO_S32BE
#define SDL_AUDIO_F32SYS SDL_AUDIO_F32MSB #define SDL_AUDIO_F32 SDL_AUDIO_F32BE
#endif #endif
/* @} */ /* @} */

View File

@ -43,18 +43,18 @@
#define SDL_atomic_t SDL_AtomicInt #define SDL_atomic_t SDL_AtomicInt
/* ##SDL_audio.h */ /* ##SDL_audio.h */
#define AUDIO_F32 SDL_AUDIO_F32 #define AUDIO_F32 SDL_AUDIO_F32LE
#define AUDIO_F32LSB SDL_AUDIO_F32LSB #define AUDIO_F32LSB SDL_AUDIO_F32LE
#define AUDIO_F32MSB SDL_AUDIO_F32MSB #define AUDIO_F32MSB SDL_AUDIO_F32BE
#define AUDIO_F32SYS SDL_AUDIO_F32SYS #define AUDIO_F32SYS SDL_AUDIO_F32
#define AUDIO_S16 SDL_AUDIO_S16 #define AUDIO_S16 SDL_AUDIO_S16LE
#define AUDIO_S16LSB SDL_AUDIO_S16LSB #define AUDIO_S16LSB SDL_AUDIO_S16LE
#define AUDIO_S16MSB SDL_AUDIO_S16MSB #define AUDIO_S16MSB SDL_AUDIO_S16BE
#define AUDIO_S16SYS SDL_AUDIO_S16SYS #define AUDIO_S16SYS SDL_AUDIO_S16
#define AUDIO_S32 SDL_AUDIO_S32 #define AUDIO_S32 SDL_AUDIO_S32LE
#define AUDIO_S32LSB SDL_AUDIO_S32LSB #define AUDIO_S32LSB SDL_AUDIO_S32LE
#define AUDIO_S32MSB SDL_AUDIO_S32MSB #define AUDIO_S32MSB SDL_AUDIO_S32BE
#define AUDIO_S32SYS SDL_AUDIO_S32SYS #define AUDIO_S32SYS SDL_AUDIO_S32
#define AUDIO_S8 SDL_AUDIO_S8 #define AUDIO_S8 SDL_AUDIO_S8
#define AUDIO_U8 SDL_AUDIO_U8 #define AUDIO_U8 SDL_AUDIO_U8
#define SDL_AudioStreamAvailable SDL_GetAudioStreamAvailable #define SDL_AudioStreamAvailable SDL_GetAudioStreamAvailable
@ -494,18 +494,18 @@
#elif !defined(SDL_DISABLE_OLD_NAMES) #elif !defined(SDL_DISABLE_OLD_NAMES)
/* ##SDL_audio.h */ /* ##SDL_audio.h */
#define AUDIO_F32 AUDIO_F32_renamed_SDL_AUDIO_F32 #define AUDIO_F32 AUDIO_F32_renamed_SDL_AUDIO_F32LE
#define AUDIO_F32LSB AUDIO_F32LSB_renamed_SDL_AUDIO_F32LSB #define AUDIO_F32LSB AUDIO_F32LSB_renamed_SDL_AUDIO_F32LE
#define AUDIO_F32MSB AUDIO_F32MSB_renamed_SDL_AUDIO_F32MSB #define AUDIO_F32MSB AUDIO_F32MSB_renamed_SDL_AUDIO_F32BE
#define AUDIO_F32SYS AUDIO_F32SYS_renamed_SDL_AUDIO_F32SYS #define AUDIO_F32SYS AUDIO_F32SYS_renamed_SDL_AUDIO_F32
#define AUDIO_S16 AUDIO_S16_renamed_SDL_AUDIO_S16 #define AUDIO_S16 AUDIO_S16_renamed_SDL_AUDIO_S16LE
#define AUDIO_S16LSB AUDIO_S16LSB_renamed_SDL_AUDIO_S16LSB #define AUDIO_S16LSB AUDIO_S16LSB_renamed_SDL_AUDIO_S16LE
#define AUDIO_S16MSB AUDIO_S16MSB_renamed_SDL_AUDIO_S16MSB #define AUDIO_S16MSB AUDIO_S16MSB_renamed_SDL_AUDIO_S16BE
#define AUDIO_S16SYS AUDIO_S16SYS_renamed_SDL_AUDIO_S16SYS #define AUDIO_S16SYS AUDIO_S16SYS_renamed_SDL_AUDIO_S16
#define AUDIO_S32 AUDIO_S32_renamed_SDL_AUDIO_S32 #define AUDIO_S32 AUDIO_S32_renamed_SDL_AUDIO_S32LE
#define AUDIO_S32LSB AUDIO_S32LSB_renamed_SDL_AUDIO_S32LSB #define AUDIO_S32LSB AUDIO_S32LSB_renamed_SDL_AUDIO_S32LE
#define AUDIO_S32MSB AUDIO_S32MSB_renamed_SDL_AUDIO_S32MSB #define AUDIO_S32MSB AUDIO_S32MSB_renamed_SDL_AUDIO_S32BE
#define AUDIO_S32SYS AUDIO_S32SYS_renamed_SDL_AUDIO_S32SYS #define AUDIO_S32SYS AUDIO_S32SYS_renamed_SDL_AUDIO_S32
#define AUDIO_S8 AUDIO_S8_renamed_SDL_AUDIO_S8 #define AUDIO_S8 AUDIO_S8_renamed_SDL_AUDIO_S8
#define AUDIO_U8 AUDIO_U8_renamed_SDL_AUDIO_U8 #define AUDIO_U8 AUDIO_U8_renamed_SDL_AUDIO_U8
#define SDL_AudioStreamAvailable SDL_AudioStreamAvailable_renamed_SDL_GetAudioStreamAvailable #define SDL_AudioStreamAvailable SDL_AudioStreamAvailable_renamed_SDL_GetAudioStreamAvailable

View File

@ -765,17 +765,17 @@ SDL_bool SDL_OutputAudioThreadIterate(SDL_AudioDevice *device)
case MIXSTRATEGY_MIX: { case MIXSTRATEGY_MIX: {
//SDL_Log("MIX STRATEGY: MIX"); //SDL_Log("MIX STRATEGY: MIX");
float *mix_buffer = (float *) ((device->spec.format == SDL_AUDIO_F32SYS) ? device_buffer : device->mix_buffer); float *mix_buffer = (float *) ((device->spec.format == SDL_AUDIO_F32) ? device_buffer : device->mix_buffer);
const int needed_samples = buffer_size / (SDL_AUDIO_BITSIZE(device->spec.format) / 8); const int needed_samples = buffer_size / (SDL_AUDIO_BITSIZE(device->spec.format) / 8);
const int work_buffer_size = needed_samples * sizeof (float); const int work_buffer_size = needed_samples * sizeof (float);
SDL_AudioSpec outspec; SDL_AudioSpec outspec;
SDL_assert(work_buffer_size <= device->work_buffer_size); SDL_assert(work_buffer_size <= device->work_buffer_size);
outspec.format = SDL_AUDIO_F32SYS; outspec.format = SDL_AUDIO_F32;
outspec.channels = device->spec.channels; outspec.channels = device->spec.channels;
outspec.freq = device->spec.freq; outspec.freq = device->spec.freq;
outspec.format = SDL_AUDIO_F32SYS; outspec.format = SDL_AUDIO_F32;
SDL_memset(mix_buffer, '\0', buffer_size); // start with silence. SDL_memset(mix_buffer, '\0', buffer_size); // start with silence.
@ -795,7 +795,7 @@ SDL_bool SDL_OutputAudioThreadIterate(SDL_AudioDevice *device)
retval = SDL_FALSE; retval = SDL_FALSE;
break; break;
} else if (br > 0) { // it's okay if we get less than requested, we mix what we have. } else if (br > 0) { // it's okay if we get less than requested, we mix what we have.
if (SDL_MixAudioFormat((Uint8 *) mix_buffer, device->work_buffer, SDL_AUDIO_F32SYS, br, SDL_MIX_MAXVOLUME) < 0) { // !!! FIXME: allow streams to specify gain? if (SDL_MixAudioFormat((Uint8 *) mix_buffer, device->work_buffer, SDL_AUDIO_F32, br, SDL_MIX_MAXVOLUME) < 0) { // !!! FIXME: allow streams to specify gain?
SDL_assert(!"This shouldn't happen."); SDL_assert(!"This shouldn't happen.");
retval = SDL_FALSE; // uh...? retval = SDL_FALSE; // uh...?
break; break;
@ -806,8 +806,8 @@ SDL_bool SDL_OutputAudioThreadIterate(SDL_AudioDevice *device)
if (((Uint8 *) mix_buffer) != device_buffer) { if (((Uint8 *) mix_buffer) != device_buffer) {
// !!! FIXME: we can't promise the device buf is aligned/padded for SIMD. // !!! FIXME: we can't promise the device buf is aligned/padded for SIMD.
//ConvertAudio(needed_samples * device->spec.channels, mix_buffer, SDL_AUDIO_F32SYS, device->spec.channels, device_buffer, device->spec.format, device->spec.channels, device->work_buffer); //ConvertAudio(needed_samples * device->spec.channels, mix_buffer, SDL_AUDIO_F32, device->spec.channels, device_buffer, device->spec.format, device->spec.channels, device->work_buffer);
ConvertAudio(needed_samples / device->spec.channels, mix_buffer, SDL_AUDIO_F32SYS, device->spec.channels, device->work_buffer, device->spec.format, device->spec.channels, NULL); ConvertAudio(needed_samples / device->spec.channels, mix_buffer, SDL_AUDIO_F32, device->spec.channels, device->work_buffer, device->spec.format, device->spec.channels, NULL);
SDL_memcpy(device_buffer, device->work_buffer, buffer_size); SDL_memcpy(device_buffer, device->work_buffer, buffer_size);
} }
break; break;
@ -1208,16 +1208,14 @@ static SDL_AudioFormat ParseAudioFormatString(const char *string)
#define CHECK_FMT_STRING(x) if (SDL_strcmp(string, #x) == 0) { return SDL_AUDIO_##x; } #define CHECK_FMT_STRING(x) if (SDL_strcmp(string, #x) == 0) { return SDL_AUDIO_##x; }
CHECK_FMT_STRING(U8); CHECK_FMT_STRING(U8);
CHECK_FMT_STRING(S8); CHECK_FMT_STRING(S8);
CHECK_FMT_STRING(S16LSB); CHECK_FMT_STRING(S16LE);
CHECK_FMT_STRING(S16MSB); CHECK_FMT_STRING(S16BE);
CHECK_FMT_STRING(S16); CHECK_FMT_STRING(S16);
CHECK_FMT_STRING(S32LSB); CHECK_FMT_STRING(S32LE);
CHECK_FMT_STRING(S32MSB); CHECK_FMT_STRING(S32BE);
CHECK_FMT_STRING(S32SYS);
CHECK_FMT_STRING(S32); CHECK_FMT_STRING(S32);
CHECK_FMT_STRING(F32LSB); CHECK_FMT_STRING(F32LE);
CHECK_FMT_STRING(F32MSB); CHECK_FMT_STRING(F32BE);
CHECK_FMT_STRING(F32SYS);
CHECK_FMT_STRING(F32); CHECK_FMT_STRING(F32);
#undef CHECK_FMT_STRING #undef CHECK_FMT_STRING
} }
@ -1315,7 +1313,7 @@ static int OpenPhysicalAudioDevice(SDL_AudioDevice *device, const SDL_AudioSpec
return SDL_OutOfMemory(); return SDL_OutOfMemory();
} }
if (device->spec.format != SDL_AUDIO_F32SYS) { if (device->spec.format != SDL_AUDIO_F32) {
device->mix_buffer = (Uint8 *)SDL_aligned_alloc(SDL_SIMDGetAlignment(), device->work_buffer_size); device->mix_buffer = (Uint8 *)SDL_aligned_alloc(SDL_SIMDGetAlignment(), device->work_buffer_size);
if (device->mix_buffer == NULL) { if (device->mix_buffer == NULL) {
ClosePhysicalAudioDevice(device); ClosePhysicalAudioDevice(device);
@ -1660,14 +1658,14 @@ SDL_AudioStream *SDL_OpenAudioDeviceStream(SDL_AudioDeviceID devid, const SDL_Au
#define NUM_FORMATS 8 #define NUM_FORMATS 8
static const SDL_AudioFormat format_list[NUM_FORMATS][NUM_FORMATS + 1] = { static const SDL_AudioFormat format_list[NUM_FORMATS][NUM_FORMATS + 1] = {
{ SDL_AUDIO_U8, SDL_AUDIO_S8, SDL_AUDIO_S16LSB, SDL_AUDIO_S16MSB, SDL_AUDIO_S32LSB, SDL_AUDIO_S32MSB, SDL_AUDIO_F32LSB, SDL_AUDIO_F32MSB, 0 }, { SDL_AUDIO_U8, SDL_AUDIO_S8, SDL_AUDIO_S16LE, SDL_AUDIO_S16BE, SDL_AUDIO_S32LE, SDL_AUDIO_S32BE, SDL_AUDIO_F32LE, SDL_AUDIO_F32BE, 0 },
{ SDL_AUDIO_S8, SDL_AUDIO_U8, SDL_AUDIO_S16LSB, SDL_AUDIO_S16MSB, SDL_AUDIO_S32LSB, SDL_AUDIO_S32MSB, SDL_AUDIO_F32LSB, SDL_AUDIO_F32MSB, 0 }, { SDL_AUDIO_S8, SDL_AUDIO_U8, SDL_AUDIO_S16LE, SDL_AUDIO_S16BE, SDL_AUDIO_S32LE, SDL_AUDIO_S32BE, SDL_AUDIO_F32LE, SDL_AUDIO_F32BE, 0 },
{ SDL_AUDIO_S16LSB, SDL_AUDIO_S16MSB, SDL_AUDIO_S32LSB, SDL_AUDIO_S32MSB, SDL_AUDIO_F32LSB, SDL_AUDIO_F32MSB, SDL_AUDIO_U8, SDL_AUDIO_S8, 0 }, { SDL_AUDIO_S16LE, SDL_AUDIO_S16BE, SDL_AUDIO_S32LE, SDL_AUDIO_S32BE, SDL_AUDIO_F32LE, SDL_AUDIO_F32BE, SDL_AUDIO_U8, SDL_AUDIO_S8, 0 },
{ SDL_AUDIO_S16MSB, SDL_AUDIO_S16LSB, SDL_AUDIO_S32MSB, SDL_AUDIO_S32LSB, SDL_AUDIO_F32MSB, SDL_AUDIO_F32LSB, SDL_AUDIO_U8, SDL_AUDIO_S8, 0 }, { SDL_AUDIO_S16BE, SDL_AUDIO_S16LE, SDL_AUDIO_S32BE, SDL_AUDIO_S32LE, SDL_AUDIO_F32BE, SDL_AUDIO_F32LE, SDL_AUDIO_U8, SDL_AUDIO_S8, 0 },
{ SDL_AUDIO_S32LSB, SDL_AUDIO_S32MSB, SDL_AUDIO_F32LSB, SDL_AUDIO_F32MSB, SDL_AUDIO_S16LSB, SDL_AUDIO_S16MSB, SDL_AUDIO_U8, SDL_AUDIO_S8, 0 }, { SDL_AUDIO_S32LE, SDL_AUDIO_S32BE, SDL_AUDIO_F32LE, SDL_AUDIO_F32BE, SDL_AUDIO_S16LE, SDL_AUDIO_S16BE, SDL_AUDIO_U8, SDL_AUDIO_S8, 0 },
{ SDL_AUDIO_S32MSB, SDL_AUDIO_S32LSB, SDL_AUDIO_F32MSB, SDL_AUDIO_F32LSB, SDL_AUDIO_S16MSB, SDL_AUDIO_S16LSB, SDL_AUDIO_U8, SDL_AUDIO_S8, 0 }, { SDL_AUDIO_S32BE, SDL_AUDIO_S32LE, SDL_AUDIO_F32BE, SDL_AUDIO_F32LE, SDL_AUDIO_S16BE, SDL_AUDIO_S16LE, SDL_AUDIO_U8, SDL_AUDIO_S8, 0 },
{ SDL_AUDIO_F32LSB, SDL_AUDIO_F32MSB, SDL_AUDIO_S32LSB, SDL_AUDIO_S32MSB, SDL_AUDIO_S16LSB, SDL_AUDIO_S16MSB, SDL_AUDIO_U8, SDL_AUDIO_S8, 0 }, { SDL_AUDIO_F32LE, SDL_AUDIO_F32BE, SDL_AUDIO_S32LE, SDL_AUDIO_S32BE, SDL_AUDIO_S16LE, SDL_AUDIO_S16BE, SDL_AUDIO_U8, SDL_AUDIO_S8, 0 },
{ SDL_AUDIO_F32MSB, SDL_AUDIO_F32LSB, SDL_AUDIO_S32MSB, SDL_AUDIO_S32LSB, SDL_AUDIO_S16MSB, SDL_AUDIO_S16LSB, SDL_AUDIO_U8, SDL_AUDIO_S8, 0 }, { SDL_AUDIO_F32BE, SDL_AUDIO_F32LE, SDL_AUDIO_S32BE, SDL_AUDIO_S32LE, SDL_AUDIO_S16BE, SDL_AUDIO_S16LE, SDL_AUDIO_U8, SDL_AUDIO_S8, 0 },
}; };
const SDL_AudioFormat *SDL_ClosestAudioFormats(SDL_AudioFormat format) const SDL_AudioFormat *SDL_ClosestAudioFormats(SDL_AudioFormat format)
@ -1826,7 +1824,7 @@ int SDL_AudioDeviceFormatChangedAlreadyLocked(SDL_AudioDevice *device, const SDL
SDL_aligned_free(device->mix_buffer); SDL_aligned_free(device->mix_buffer);
device->mix_buffer = NULL; device->mix_buffer = NULL;
if (device->spec.format != SDL_AUDIO_F32SYS) { if (device->spec.format != SDL_AUDIO_F32) {
device->mix_buffer = (Uint8 *)SDL_aligned_alloc(SDL_SIMDGetAlignment(), device->work_buffer_size); device->mix_buffer = (Uint8 *)SDL_aligned_alloc(SDL_SIMDGetAlignment(), device->work_buffer_size);
if (!device->mix_buffer) { if (!device->mix_buffer) {
kill_device = SDL_TRUE; kill_device = SDL_TRUE;

View File

@ -860,8 +860,8 @@ static void AudioConvertToFloat(float *dst, const void *src, int num_samples, SD
switch (src_fmt & ~SDL_AUDIO_MASK_ENDIAN) { switch (src_fmt & ~SDL_AUDIO_MASK_ENDIAN) {
case SDL_AUDIO_S8: SDL_Convert_S8_to_F32(dst, (const Sint8 *) src, num_samples); break; 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_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_S16 & ~SDL_AUDIO_MASK_ENDIAN): 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_S32 & ~SDL_AUDIO_MASK_ENDIAN): SDL_Convert_S32_to_F32(dst, (const Sint32 *) src, num_samples); break;
default: SDL_assert(!"Unexpected audio format!"); break; default: SDL_assert(!"Unexpected audio format!"); break;
} }
} }
@ -872,8 +872,8 @@ static void AudioConvertFromFloat(void *dst, const float *src, int num_samples,
switch (dst_fmt & ~SDL_AUDIO_MASK_ENDIAN) { switch (dst_fmt & ~SDL_AUDIO_MASK_ENDIAN) {
case SDL_AUDIO_S8: SDL_Convert_F32_to_S8((Sint8 *) dst, src, num_samples); break; 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_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_S16 & ~SDL_AUDIO_MASK_ENDIAN): 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_S32 & ~SDL_AUDIO_MASK_ENDIAN): SDL_Convert_F32_to_S32((Sint32 *) dst, src, num_samples); break;
default: SDL_assert(!"Unexpected audio format!"); break; default: SDL_assert(!"Unexpected audio format!"); break;
} }
} }
@ -883,12 +883,12 @@ static SDL_bool SDL_IsSupportedAudioFormat(const SDL_AudioFormat fmt)
switch (fmt) { switch (fmt) {
case SDL_AUDIO_U8: case SDL_AUDIO_U8:
case SDL_AUDIO_S8: case SDL_AUDIO_S8:
case SDL_AUDIO_S16LSB: case SDL_AUDIO_S16LE:
case SDL_AUDIO_S16MSB: case SDL_AUDIO_S16BE:
case SDL_AUDIO_S32LSB: case SDL_AUDIO_S32LE:
case SDL_AUDIO_S32MSB: case SDL_AUDIO_S32BE:
case SDL_AUDIO_F32LSB: case SDL_AUDIO_F32LE:
case SDL_AUDIO_F32MSB: case SDL_AUDIO_F32BE:
return SDL_TRUE; // supported. return SDL_TRUE; // supported.
default: default:
@ -1540,7 +1540,7 @@ static int GetAudioStreamDataInternal(SDL_AudioStream *stream, void *buf, int ou
// Check if we can resample directly into the output buffer. // Check if we can resample directly into the output buffer.
// Note, this is just to avoid extra copies. // Note, this is just to avoid extra copies.
// Some other formats may fit directly into the output buffer, but i'd rather process data in a SIMD-aligned buffer. // Some other formats may fit directly into the output buffer, but i'd rather process data in a SIMD-aligned buffer.
if ((dst_format != SDL_AUDIO_F32SYS) || (dst_channels != resample_channels)) { if ((dst_format != SDL_AUDIO_F32) || (dst_channels != resample_channels)) {
// Allocate space for converting the resampled output to the destination format // Allocate space for converting the resampled output to the destination format
int resample_convert_bytes = output_frames * max_frame_size; int resample_convert_bytes = output_frames * max_frame_size;
work_buffer_capacity = SDL_max(work_buffer_capacity, resample_convert_bytes); work_buffer_capacity = SDL_max(work_buffer_capacity, resample_convert_bytes);
@ -1597,7 +1597,7 @@ static int GetAudioStreamDataInternal(SDL_AudioStream *stream, void *buf, int ou
SDL_assert(work_buffer_frames == input_frames + (resampler_padding_frames * 2)); SDL_assert(work_buffer_frames == input_frames + (resampler_padding_frames * 2));
// Resampling! get the work buffer to float32 format, etc, in-place. // Resampling! get the work buffer to float32 format, etc, in-place.
ConvertAudio(work_buffer_frames, work_buffer, src_format, src_channels, work_buffer, SDL_AUDIO_F32SYS, resample_channels, NULL); ConvertAudio(work_buffer_frames, work_buffer, src_format, src_channels, work_buffer, SDL_AUDIO_F32, resample_channels, NULL);
// Update the work_buffer pointers based on the new frame size // Update the work_buffer pointers based on the new frame size
input_buffer = work_buffer + ((input_buffer - work_buffer) / src_frame_size * resample_frame_size); input_buffer = work_buffer + ((input_buffer - work_buffer) / src_frame_size * resample_frame_size);
@ -1614,7 +1614,7 @@ static int GetAudioStreamDataInternal(SDL_AudioStream *stream, void *buf, int ou
// Convert to the final format, if necessary // Convert to the final format, if necessary
if (buf != resample_buffer) { if (buf != resample_buffer) {
ConvertAudio(output_frames, resample_buffer, SDL_AUDIO_F32SYS, resample_channels, buf, dst_format, dst_channels, work_buffer); ConvertAudio(output_frames, resample_buffer, SDL_AUDIO_F32, resample_channels, buf, dst_format, dst_channels, work_buffer);
} }
return 0; return 0;

View File

@ -131,7 +131,7 @@ int SDL_MixAudioFormat(Uint8 *dst, const Uint8 *src, SDL_AudioFormat format,
} }
} break; } break;
case SDL_AUDIO_S16LSB: case SDL_AUDIO_S16LE:
{ {
Sint16 src1, src2; Sint16 src1, src2;
int dst_sample; int dst_sample;
@ -155,7 +155,7 @@ int SDL_MixAudioFormat(Uint8 *dst, const Uint8 *src, SDL_AudioFormat format,
} }
} break; } break;
case SDL_AUDIO_S16MSB: case SDL_AUDIO_S16BE:
{ {
Sint16 src1, src2; Sint16 src1, src2;
int dst_sample; int dst_sample;
@ -179,7 +179,7 @@ int SDL_MixAudioFormat(Uint8 *dst, const Uint8 *src, SDL_AudioFormat format,
} }
} break; } break;
case SDL_AUDIO_S32LSB: case SDL_AUDIO_S32LE:
{ {
const Uint32 *src32 = (Uint32 *)src; const Uint32 *src32 = (Uint32 *)src;
Uint32 *dst32 = (Uint32 *)dst; Uint32 *dst32 = (Uint32 *)dst;
@ -204,7 +204,7 @@ int SDL_MixAudioFormat(Uint8 *dst, const Uint8 *src, SDL_AudioFormat format,
} }
} break; } break;
case SDL_AUDIO_S32MSB: case SDL_AUDIO_S32BE:
{ {
const Uint32 *src32 = (Uint32 *)src; const Uint32 *src32 = (Uint32 *)src;
Uint32 *dst32 = (Uint32 *)dst; Uint32 *dst32 = (Uint32 *)dst;
@ -229,7 +229,7 @@ int SDL_MixAudioFormat(Uint8 *dst, const Uint8 *src, SDL_AudioFormat format,
} }
} break; } break;
case SDL_AUDIO_F32LSB: case SDL_AUDIO_F32LE:
{ {
const float fmaxvolume = 1.0f / ((float)SDL_MIX_MAXVOLUME); const float fmaxvolume = 1.0f / ((float)SDL_MIX_MAXVOLUME);
const float fvolume = (float)volume; const float fvolume = (float)volume;
@ -257,7 +257,7 @@ int SDL_MixAudioFormat(Uint8 *dst, const Uint8 *src, SDL_AudioFormat format,
} }
} break; } break;
case SDL_AUDIO_F32MSB: case SDL_AUDIO_F32BE:
{ {
const float fmaxvolume = 1.0f / ((float)SDL_MIX_MAXVOLUME); const float fmaxvolume = 1.0f / ((float)SDL_MIX_MAXVOLUME);
const float fvolume = (float)volume; const float fvolume = (float)volume;

View File

@ -2039,10 +2039,10 @@ static int WaveLoad(SDL_RWops *src, WaveFile *file, SDL_AudioSpec *spec, Uint8 *
case ALAW_CODE: case ALAW_CODE:
case MULAW_CODE: case MULAW_CODE:
/* These can be easily stored in the byte order of the system. */ /* These can be easily stored in the byte order of the system. */
spec->format = SDL_AUDIO_S16SYS; spec->format = SDL_AUDIO_S16;
break; break;
case IEEE_FLOAT_CODE: case IEEE_FLOAT_CODE:
spec->format = SDL_AUDIO_F32LSB; spec->format = SDL_AUDIO_F32LE;
break; break;
case PCM_CODE: case PCM_CODE:
switch (format->bitspersample) { switch (format->bitspersample) {
@ -2050,11 +2050,11 @@ static int WaveLoad(SDL_RWops *src, WaveFile *file, SDL_AudioSpec *spec, Uint8 *
spec->format = SDL_AUDIO_U8; spec->format = SDL_AUDIO_U8;
break; break;
case 16: case 16:
spec->format = SDL_AUDIO_S16LSB; spec->format = SDL_AUDIO_S16LE;
break; break;
case 24: /* Has been shifted to 32 bits. */ case 24: /* Has been shifted to 32 bits. */
case 32: case 32:
spec->format = SDL_AUDIO_S32LSB; spec->format = SDL_AUDIO_S32LE;
break; break;
default: default:
/* Just in case something unexpected happened in the checks. */ /* Just in case something unexpected happened in the checks. */

View File

@ -198,9 +198,9 @@ static int AAUDIO_OpenDevice(SDL_AudioDevice *device)
const aaudio_direction_t direction = (iscapture ? AAUDIO_DIRECTION_INPUT : AAUDIO_DIRECTION_OUTPUT); const aaudio_direction_t direction = (iscapture ? AAUDIO_DIRECTION_INPUT : AAUDIO_DIRECTION_OUTPUT);
ctx.AAudioStreamBuilder_setDirection(builder, direction); ctx.AAudioStreamBuilder_setDirection(builder, direction);
aaudio_format_t format; aaudio_format_t format;
if ((device->spec.format == SDL_AUDIO_S32SYS) && (SDL_GetAndroidSDKVersion() >= 31)) { if ((device->spec.format == SDL_AUDIO_S32) && (SDL_GetAndroidSDKVersion() >= 31)) {
format = AAUDIO_FORMAT_PCM_I32; format = AAUDIO_FORMAT_PCM_I32;
} else if (device->spec.format == SDL_AUDIO_F32SYS) { } else if (device->spec.format == SDL_AUDIO_F32) {
format = AAUDIO_FORMAT_PCM_FLOAT; format = AAUDIO_FORMAT_PCM_FLOAT;
} else { } else {
format = AAUDIO_FORMAT_PCM_I16; // sint16 is a safe bet for everything else. format = AAUDIO_FORMAT_PCM_I16; // sint16 is a safe bet for everything else.
@ -245,11 +245,11 @@ static int AAUDIO_OpenDevice(SDL_AudioDevice *device)
format = ctx.AAudioStream_getFormat(hidden->stream); format = ctx.AAudioStream_getFormat(hidden->stream);
if (format == AAUDIO_FORMAT_PCM_I16) { if (format == AAUDIO_FORMAT_PCM_I16) {
device->spec.format = SDL_AUDIO_S16SYS; device->spec.format = SDL_AUDIO_S16;
} else if (format == AAUDIO_FORMAT_PCM_I32) { } else if (format == AAUDIO_FORMAT_PCM_I32) {
device->spec.format = SDL_AUDIO_S32SYS; device->spec.format = SDL_AUDIO_S32;
} else if (format == AAUDIO_FORMAT_PCM_FLOAT) { } else if (format == AAUDIO_FORMAT_PCM_FLOAT) {
device->spec.format = SDL_AUDIO_F32SYS; device->spec.format = SDL_AUDIO_F32;
} else { } else {
return SDL_SetError("Got unexpected audio format %d from AAudioStream_getFormat", (int) format); return SDL_SetError("Got unexpected audio format %d from AAudioStream_getFormat", (int) format);
} }

View File

@ -565,22 +565,22 @@ static int ALSA_OpenDevice(SDL_AudioDevice *device)
case SDL_AUDIO_S8: case SDL_AUDIO_S8:
format = SND_PCM_FORMAT_S8; format = SND_PCM_FORMAT_S8;
break; break;
case SDL_AUDIO_S16LSB: case SDL_AUDIO_S16LE:
format = SND_PCM_FORMAT_S16_LE; format = SND_PCM_FORMAT_S16_LE;
break; break;
case SDL_AUDIO_S16MSB: case SDL_AUDIO_S16BE:
format = SND_PCM_FORMAT_S16_BE; format = SND_PCM_FORMAT_S16_BE;
break; break;
case SDL_AUDIO_S32LSB: case SDL_AUDIO_S32LE:
format = SND_PCM_FORMAT_S32_LE; format = SND_PCM_FORMAT_S32_LE;
break; break;
case SDL_AUDIO_S32MSB: case SDL_AUDIO_S32BE:
format = SND_PCM_FORMAT_S32_BE; format = SND_PCM_FORMAT_S32_BE;
break; break;
case SDL_AUDIO_F32LSB: case SDL_AUDIO_F32LE:
format = SND_PCM_FORMAT_FLOAT_LE; format = SND_PCM_FORMAT_FLOAT_LE;
break; break;
case SDL_AUDIO_F32MSB: case SDL_AUDIO_F32BE:
format = SND_PCM_FORMAT_FLOAT_BE; format = SND_PCM_FORMAT_FLOAT_BE;
break; break;
default: default:

View File

@ -876,12 +876,12 @@ static int COREAUDIO_OpenDevice(SDL_AudioDevice *device)
switch (test_format) { switch (test_format) {
case SDL_AUDIO_U8: case SDL_AUDIO_U8:
case SDL_AUDIO_S8: case SDL_AUDIO_S8:
case SDL_AUDIO_S16LSB: case SDL_AUDIO_S16LE:
case SDL_AUDIO_S16MSB: case SDL_AUDIO_S16BE:
case SDL_AUDIO_S32LSB: case SDL_AUDIO_S32LE:
case SDL_AUDIO_S32MSB: case SDL_AUDIO_S32BE:
case SDL_AUDIO_F32LSB: case SDL_AUDIO_F32LE:
case SDL_AUDIO_F32MSB: case SDL_AUDIO_F32BE:
break; break;
default: default:

View File

@ -111,12 +111,12 @@ static int DSP_OpenDevice(SDL_AudioDevice *device)
format = AFMT_U8; format = AFMT_U8;
} }
break; break;
case SDL_AUDIO_S16LSB: case SDL_AUDIO_S16LE:
if (value & AFMT_S16_LE) { if (value & AFMT_S16_LE) {
format = AFMT_S16_LE; format = AFMT_S16_LE;
} }
break; break;
case SDL_AUDIO_S16MSB: case SDL_AUDIO_S16BE:
if (value & AFMT_S16_BE) { if (value & AFMT_S16_BE) {
format = AFMT_S16_BE; format = AFMT_S16_BE;
} }

View File

@ -131,29 +131,29 @@ static int HAIKUAUDIO_OpenDevice(SDL_AudioDevice *device)
format.format = media_raw_audio_format::B_AUDIO_UCHAR; format.format = media_raw_audio_format::B_AUDIO_UCHAR;
break; break;
case SDL_AUDIO_S16LSB: case SDL_AUDIO_S16LE:
format.format = media_raw_audio_format::B_AUDIO_SHORT; format.format = media_raw_audio_format::B_AUDIO_SHORT;
break; break;
case SDL_AUDIO_S16MSB: case SDL_AUDIO_S16BE:
format.format = media_raw_audio_format::B_AUDIO_SHORT; format.format = media_raw_audio_format::B_AUDIO_SHORT;
format.byte_order = B_MEDIA_BIG_ENDIAN; format.byte_order = B_MEDIA_BIG_ENDIAN;
break; break;
case SDL_AUDIO_S32LSB: case SDL_AUDIO_S32LE:
format.format = media_raw_audio_format::B_AUDIO_INT; format.format = media_raw_audio_format::B_AUDIO_INT;
break; break;
case SDL_AUDIO_S32MSB: case SDL_AUDIO_S32BE:
format.format = media_raw_audio_format::B_AUDIO_INT; format.format = media_raw_audio_format::B_AUDIO_INT;
format.byte_order = B_MEDIA_BIG_ENDIAN; format.byte_order = B_MEDIA_BIG_ENDIAN;
break; break;
case SDL_AUDIO_F32LSB: case SDL_AUDIO_F32LE:
format.format = media_raw_audio_format::B_AUDIO_FLOAT; format.format = media_raw_audio_format::B_AUDIO_FLOAT;
break; break;
case SDL_AUDIO_F32MSB: case SDL_AUDIO_F32BE:
format.format = media_raw_audio_format::B_AUDIO_FLOAT; format.format = media_raw_audio_format::B_AUDIO_FLOAT;
format.byte_order = B_MEDIA_BIG_ENDIAN; format.byte_order = B_MEDIA_BIG_ENDIAN;
break; break;

View File

@ -309,7 +309,7 @@ static int JACK_OpenDevice(SDL_AudioDevice *device)
/* !!! 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." */ /* !!! 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. */ /* Jack pretty much demands what it wants. */
device->spec.format = SDL_AUDIO_F32SYS; device->spec.format = SDL_AUDIO_F32;
device->spec.freq = JACK_jack_get_sample_rate(client); device->spec.freq = JACK_jack_get_sample_rate(client);
device->spec.channels = channels; device->spec.channels = channels;
device->sample_frames = JACK_jack_get_buffer_size(client); device->sample_frames = JACK_jack_get_buffer_size(client);

View File

@ -248,16 +248,16 @@ static int NETBSDAUDIO_OpenDevice(SDL_AudioDevice *device)
case SDL_AUDIO_S8: case SDL_AUDIO_S8:
encoding = AUDIO_ENCODING_SLINEAR; encoding = AUDIO_ENCODING_SLINEAR;
break; break;
case SDL_AUDIO_S16LSB: case SDL_AUDIO_S16LE:
encoding = AUDIO_ENCODING_SLINEAR_LE; encoding = AUDIO_ENCODING_SLINEAR_LE;
break; break;
case SDL_AUDIO_S16MSB: case SDL_AUDIO_S16BE:
encoding = AUDIO_ENCODING_SLINEAR_BE; encoding = AUDIO_ENCODING_SLINEAR_BE;
break; break;
case SDL_AUDIO_S32LSB: case SDL_AUDIO_S32LE:
encoding = AUDIO_ENCODING_SLINEAR_LE; encoding = AUDIO_ENCODING_SLINEAR_LE;
break; break;
case SDL_AUDIO_S32MSB: case SDL_AUDIO_S32BE:
encoding = AUDIO_ENCODING_SLINEAR_BE; encoding = AUDIO_ENCODING_SLINEAR_BE;
break; break;
default: default:

View File

@ -248,7 +248,7 @@ static int openslES_CreatePCMRecorder(SDL_AudioDevice *device)
} }
// Just go with signed 16-bit audio as it's the most compatible // Just go with signed 16-bit audio as it's the most compatible
device->spec.format = SDL_AUDIO_S16SYS; device->spec.format = SDL_AUDIO_S16;
device->spec.channels = 1; device->spec.channels = 1;
//device->spec.freq = SL_SAMPLINGRATE_16 / 1000;*/ //device->spec.freq = SL_SAMPLINGRATE_16 / 1000;*/
@ -424,12 +424,12 @@ static int openslES_CreatePCMPlayer(SDL_AudioDevice *device)
if (!test_format) { if (!test_format) {
// Didn't find a compatible format : // Didn't find a compatible format :
LOGI("No compatible audio format, using signed 16-bit audio"); LOGI("No compatible audio format, using signed 16-bit audio");
test_format = SDL_AUDIO_S16SYS; test_format = SDL_AUDIO_S16;
} }
device->spec.format = test_format; device->spec.format = test_format;
} else { } else {
// Just go with signed 16-bit audio as it's the most compatible // Just go with signed 16-bit audio as it's the most compatible
device->spec.format = SDL_AUDIO_S16SYS; device->spec.format = SDL_AUDIO_S16;
} }
// Update the fragment size as size in bytes // Update the fragment size as size in bytes

View File

@ -898,22 +898,22 @@ static void initialize_spa_info(const SDL_AudioSpec *spec, struct spa_audio_info
case SDL_AUDIO_S8: case SDL_AUDIO_S8:
info->format = SPA_AUDIO_FORMAT_S8; info->format = SPA_AUDIO_FORMAT_S8;
break; break;
case SDL_AUDIO_S16LSB: case SDL_AUDIO_S16LE:
info->format = SPA_AUDIO_FORMAT_S16_LE; info->format = SPA_AUDIO_FORMAT_S16_LE;
break; break;
case SDL_AUDIO_S16MSB: case SDL_AUDIO_S16BE:
info->format = SPA_AUDIO_FORMAT_S16_BE; info->format = SPA_AUDIO_FORMAT_S16_BE;
break; break;
case SDL_AUDIO_S32LSB: case SDL_AUDIO_S32LE:
info->format = SPA_AUDIO_FORMAT_S32_LE; info->format = SPA_AUDIO_FORMAT_S32_LE;
break; break;
case SDL_AUDIO_S32MSB: case SDL_AUDIO_S32BE:
info->format = SPA_AUDIO_FORMAT_S32_BE; info->format = SPA_AUDIO_FORMAT_S32_BE;
break; break;
case SDL_AUDIO_F32LSB: case SDL_AUDIO_F32LE:
info->format = SPA_AUDIO_FORMAT_F32_LE; info->format = SPA_AUDIO_FORMAT_F32_LE;
break; break;
case SDL_AUDIO_F32MSB: case SDL_AUDIO_F32BE:
info->format = SPA_AUDIO_FORMAT_F32_BE; info->format = SPA_AUDIO_FORMAT_F32_BE;
break; break;
} }

View File

@ -47,7 +47,7 @@ static int PSPAUDIO_OpenDevice(SDL_AudioDevice *device)
} }
// device only natively supports S16LSB // device only natively supports S16LSB
device->spec.format = SDL_AUDIO_S16LSB; device->spec.format = SDL_AUDIO_S16LE;
/* PSP has some limitations with the Audio. It fully supports 44.1KHz (Mono & Stereo), /* PSP has some limitations with the Audio. It fully supports 44.1KHz (Mono & Stereo),
however with frequencies different than 44.1KHz, it just supports Stereo, however with frequencies different than 44.1KHz, it just supports Stereo,

View File

@ -606,22 +606,22 @@ static int PULSEAUDIO_OpenDevice(SDL_AudioDevice *device)
case SDL_AUDIO_U8: case SDL_AUDIO_U8:
format = PA_SAMPLE_U8; format = PA_SAMPLE_U8;
break; break;
case SDL_AUDIO_S16LSB: case SDL_AUDIO_S16LE:
format = PA_SAMPLE_S16LE; format = PA_SAMPLE_S16LE;
break; break;
case SDL_AUDIO_S16MSB: case SDL_AUDIO_S16BE:
format = PA_SAMPLE_S16BE; format = PA_SAMPLE_S16BE;
break; break;
case SDL_AUDIO_S32LSB: case SDL_AUDIO_S32LE:
format = PA_SAMPLE_S32LE; format = PA_SAMPLE_S32LE;
break; break;
case SDL_AUDIO_S32MSB: case SDL_AUDIO_S32BE:
format = PA_SAMPLE_S32BE; format = PA_SAMPLE_S32BE;
break; break;
case SDL_AUDIO_F32LSB: case SDL_AUDIO_F32LE:
format = PA_SAMPLE_FLOAT32LE; format = PA_SAMPLE_FLOAT32LE;
break; break;
case SDL_AUDIO_F32MSB: case SDL_AUDIO_F32BE:
format = PA_SAMPLE_FLOAT32BE; format = PA_SAMPLE_FLOAT32BE;
break; break;
default: default:
@ -723,17 +723,17 @@ static SDL_AudioFormat PulseFormatToSDLFormat(pa_sample_format_t format)
case PA_SAMPLE_U8: case PA_SAMPLE_U8:
return SDL_AUDIO_U8; return SDL_AUDIO_U8;
case PA_SAMPLE_S16LE: case PA_SAMPLE_S16LE:
return SDL_AUDIO_S16LSB; return SDL_AUDIO_S16LE;
case PA_SAMPLE_S16BE: case PA_SAMPLE_S16BE:
return SDL_AUDIO_S16MSB; return SDL_AUDIO_S16BE;
case PA_SAMPLE_S32LE: case PA_SAMPLE_S32LE:
return SDL_AUDIO_S32LSB; return SDL_AUDIO_S32LE;
case PA_SAMPLE_S32BE: case PA_SAMPLE_S32BE:
return SDL_AUDIO_S32MSB; return SDL_AUDIO_S32BE;
case PA_SAMPLE_FLOAT32LE: case PA_SAMPLE_FLOAT32LE:
return SDL_AUDIO_F32LSB; return SDL_AUDIO_F32LE;
case PA_SAMPLE_FLOAT32BE: case PA_SAMPLE_FLOAT32BE:
return SDL_AUDIO_F32MSB; return SDL_AUDIO_F32BE;
default: default:
return 0; return 0;
} }

View File

@ -309,7 +309,7 @@ static SDL_AudioFormat QnxFormatToSDLFormat(const int32_t qnxfmt)
#undef CHECKFMT #undef CHECKFMT
default: break; default: break;
} }
return SDL_AUDIO_S16SYS; // oh well. return SDL_AUDIO_S16; // oh well.
} }
static void QSA_DetectDevices(SDL_AudioDevice **default_output, SDL_AudioDevice **default_capture) static void QSA_DetectDevices(SDL_AudioDevice **default_output, SDL_AudioDevice **default_capture)

View File

@ -284,13 +284,13 @@ static int SNDIO_OpenDevice(SDL_AudioDevice *device)
} }
if ((par.bps == 4) && (par.sig) && (par.le)) { if ((par.bps == 4) && (par.sig) && (par.le)) {
device->spec.format = SDL_AUDIO_S32LSB; device->spec.format = SDL_AUDIO_S32LE;
} else if ((par.bps == 4) && (par.sig) && (!par.le)) { } else if ((par.bps == 4) && (par.sig) && (!par.le)) {
device->spec.format = SDL_AUDIO_S32MSB; device->spec.format = SDL_AUDIO_S32BE;
} else if ((par.bps == 2) && (par.sig) && (par.le)) { } else if ((par.bps == 2) && (par.sig) && (par.le)) {
device->spec.format = SDL_AUDIO_S16LSB; device->spec.format = SDL_AUDIO_S16LE;
} else if ((par.bps == 2) && (par.sig) && (!par.le)) { } else if ((par.bps == 2) && (par.sig) && (!par.le)) {
device->spec.format = SDL_AUDIO_S16MSB; device->spec.format = SDL_AUDIO_S16BE;
} else if ((par.bps == 1) && (par.sig)) { } else if ((par.bps == 1) && (par.sig)) {
device->spec.format = SDL_AUDIO_S8; device->spec.format = SDL_AUDIO_S8;
} else if ((par.bps == 1) && (!par.sig)) { } else if ((par.bps == 1) && (!par.sig)) {

View File

@ -71,7 +71,7 @@ static int VITAAUD_OpenDevice(SDL_AudioDevice *device)
closefmts = SDL_ClosestAudioFormats(device->spec.format); closefmts = SDL_ClosestAudioFormats(device->spec.format);
while ((test_format = *(closefmts++)) != 0) { while ((test_format = *(closefmts++)) != 0) {
if (test_format == SDL_AUDIO_S16LSB) { if (test_format == SDL_AUDIO_S16LE) {
device->spec.format = test_format; device->spec.format = test_format;
break; break;
} }

View File

@ -344,19 +344,19 @@ static const GUID SDL_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT = { 0x00000003, 0x0000, 0x
SDL_AudioFormat SDL_WaveFormatExToSDLFormat(WAVEFORMATEX *waveformat) SDL_AudioFormat SDL_WaveFormatExToSDLFormat(WAVEFORMATEX *waveformat)
{ {
if ((waveformat->wFormatTag == WAVE_FORMAT_IEEE_FLOAT) && (waveformat->wBitsPerSample == 32)) { if ((waveformat->wFormatTag == WAVE_FORMAT_IEEE_FLOAT) && (waveformat->wBitsPerSample == 32)) {
return SDL_AUDIO_F32SYS; return SDL_AUDIO_F32;
} else if ((waveformat->wFormatTag == WAVE_FORMAT_PCM) && (waveformat->wBitsPerSample == 16)) { } else if ((waveformat->wFormatTag == WAVE_FORMAT_PCM) && (waveformat->wBitsPerSample == 16)) {
return SDL_AUDIO_S16SYS; return SDL_AUDIO_S16;
} else if ((waveformat->wFormatTag == WAVE_FORMAT_PCM) && (waveformat->wBitsPerSample == 32)) { } else if ((waveformat->wFormatTag == WAVE_FORMAT_PCM) && (waveformat->wBitsPerSample == 32)) {
return SDL_AUDIO_S32SYS; return SDL_AUDIO_S32;
} else if (waveformat->wFormatTag == WAVE_FORMAT_EXTENSIBLE) { } else if (waveformat->wFormatTag == WAVE_FORMAT_EXTENSIBLE) {
const WAVEFORMATEXTENSIBLE *ext = (const WAVEFORMATEXTENSIBLE *)waveformat; const WAVEFORMATEXTENSIBLE *ext = (const WAVEFORMATEXTENSIBLE *)waveformat;
if ((SDL_memcmp(&ext->SubFormat, &SDL_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, sizeof(GUID)) == 0) && (waveformat->wBitsPerSample == 32)) { if ((SDL_memcmp(&ext->SubFormat, &SDL_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, sizeof(GUID)) == 0) && (waveformat->wBitsPerSample == 32)) {
return SDL_AUDIO_F32SYS; return SDL_AUDIO_F32;
} else if ((SDL_memcmp(&ext->SubFormat, &SDL_KSDATAFORMAT_SUBTYPE_PCM, sizeof(GUID)) == 0) && (waveformat->wBitsPerSample == 16)) { } else if ((SDL_memcmp(&ext->SubFormat, &SDL_KSDATAFORMAT_SUBTYPE_PCM, sizeof(GUID)) == 0) && (waveformat->wBitsPerSample == 16)) {
return SDL_AUDIO_S16SYS; return SDL_AUDIO_S16;
} else if ((SDL_memcmp(&ext->SubFormat, &SDL_KSDATAFORMAT_SUBTYPE_PCM, sizeof(GUID)) == 0) && (waveformat->wBitsPerSample == 32)) { } else if ((SDL_memcmp(&ext->SubFormat, &SDL_KSDATAFORMAT_SUBTYPE_PCM, sizeof(GUID)) == 0) && (waveformat->wBitsPerSample == 32)) {
return SDL_AUDIO_S32SYS; return SDL_AUDIO_S32;
} }
} }
return 0; return 0;

View File

@ -71,7 +71,7 @@ static const char *video_usage[] = {
/* !!! FIXME: Float32? Sint32? */ /* !!! FIXME: Float32? Sint32? */
static const char *audio_usage[] = { static const char *audio_usage[] = {
"[--audio driver]", "[--rate N]", "[--format U8|S8|S16|S16LE|S16BE]", "[--audio driver]", "[--rate N]", "[--format U8|S8|S16|S16LE|S16BE|S32|S32LE|S32BE|F32|F32LE|F32BE]",
"[--channels N]" "[--channels N]"
}; };
@ -630,16 +630,37 @@ int SDLTest_CommonArg(SDLTest_CommonState *state, int index)
return 2; return 2;
} }
if (SDL_strcasecmp(argv[index], "S16LE") == 0) { if (SDL_strcasecmp(argv[index], "S16LE") == 0) {
state->audio_format = SDL_AUDIO_S16LSB; state->audio_format = SDL_AUDIO_S16LE;
return 2; return 2;
} }
if (SDL_strcasecmp(argv[index], "S16BE") == 0) { if (SDL_strcasecmp(argv[index], "S16BE") == 0) {
state->audio_format = SDL_AUDIO_S16MSB; state->audio_format = SDL_AUDIO_S16BE;
return 2;
}
if (SDL_strcasecmp(argv[index], "S32") == 0) {
state->audio_format = SDL_AUDIO_S32;
return 2;
}
if (SDL_strcasecmp(argv[index], "S32LE") == 0) {
state->audio_format = SDL_AUDIO_S32LE;
return 2;
}
if (SDL_strcasecmp(argv[index], "S32BE") == 0) {
state->audio_format = SDL_AUDIO_S32BE;
return 2;
}
if (SDL_strcasecmp(argv[index], "F32") == 0) {
state->audio_format = SDL_AUDIO_F32;
return 2;
}
if (SDL_strcasecmp(argv[index], "F32LE") == 0) {
state->audio_format = SDL_AUDIO_F32LE;
return 2;
}
if (SDL_strcasecmp(argv[index], "F32BE") == 0) {
state->audio_format = SDL_AUDIO_F32BE;
return 2; return 2;
} }
/* !!! FIXME: Float32? Sint32? */
return -1; return -1;
} }
if (SDL_strcasecmp(argv[index], "--channels") == 0) { if (SDL_strcasecmp(argv[index], "--channels") == 0) {

View File

@ -416,12 +416,12 @@ static const char *AudioFmtToString(const SDL_AudioFormat fmt)
#define FMTCASE(x) case SDL_AUDIO_##x: return #x #define FMTCASE(x) case SDL_AUDIO_##x: return #x
FMTCASE(U8); FMTCASE(U8);
FMTCASE(S8); FMTCASE(S8);
FMTCASE(S16LSB); FMTCASE(S16LE);
FMTCASE(S16MSB); FMTCASE(S16BE);
FMTCASE(S32LSB); FMTCASE(S32LE);
FMTCASE(S32MSB); FMTCASE(S32BE);
FMTCASE(F32LSB); FMTCASE(F32LE);
FMTCASE(F32MSB); FMTCASE(F32BE);
#undef FMTCASE #undef FMTCASE
} }
return "?"; return "?";
@ -965,7 +965,7 @@ static void Loop(void)
case SDL_EVENT_AUDIO_DEVICE_ADDED: case SDL_EVENT_AUDIO_DEVICE_ADDED:
CreatePhysicalDeviceThing(event.adevice.which, event.adevice.iscapture); CreatePhysicalDeviceThing(event.adevice.which, event.adevice.iscapture);
break; break;
case SDL_EVENT_AUDIO_DEVICE_REMOVED: { case SDL_EVENT_AUDIO_DEVICE_REMOVED: {
const SDL_AudioDeviceID which = event.adevice.which; const SDL_AudioDeviceID which = event.adevice.which;
Thing *i, *next; Thing *i, *next;

View File

@ -180,12 +180,12 @@ static const char *AudioFmtToString(const SDL_AudioFormat fmt)
#define FMTCASE(x) case SDL_AUDIO_##x: return #x #define FMTCASE(x) case SDL_AUDIO_##x: return #x
FMTCASE(U8); FMTCASE(U8);
FMTCASE(S8); FMTCASE(S8);
FMTCASE(S16LSB); FMTCASE(S16LE);
FMTCASE(S16MSB); FMTCASE(S16BE);
FMTCASE(S32LSB); FMTCASE(S32LE);
FMTCASE(S32MSB); FMTCASE(S32BE);
FMTCASE(F32LSB); FMTCASE(F32LE);
FMTCASE(F32MSB); FMTCASE(F32BE);
#undef FMTCASE #undef FMTCASE
} }
return "?"; return "?";

View File

@ -176,13 +176,13 @@ static int audio_initOpenCloseQuitAudio(void *arg)
case 0: case 0:
/* Set standard desired spec */ /* Set standard desired spec */
desired.freq = 22050; desired.freq = 22050;
desired.format = SDL_AUDIO_S16SYS; desired.format = SDL_AUDIO_S16;
desired.channels = 2; desired.channels = 2;
case 1: case 1:
/* Set custom desired spec */ /* Set custom desired spec */
desired.freq = 48000; desired.freq = 48000;
desired.format = SDL_AUDIO_F32SYS; desired.format = SDL_AUDIO_F32;
desired.channels = 2; desired.channels = 2;
break; break;
} }
@ -261,14 +261,14 @@ static int audio_pauseUnpauseAudio(void *arg)
case 0: case 0:
/* Set standard desired spec */ /* Set standard desired spec */
desired.freq = 22050; desired.freq = 22050;
desired.format = SDL_AUDIO_S16SYS; desired.format = SDL_AUDIO_S16;
desired.channels = 2; desired.channels = 2;
break; break;
case 1: case 1:
/* Set custom desired spec */ /* Set custom desired spec */
desired.freq = 48000; desired.freq = 48000;
desired.format = SDL_AUDIO_F32SYS; desired.format = SDL_AUDIO_F32;
desired.channels = 2; desired.channels = 2;
break; break;
} }
@ -441,18 +441,34 @@ static int audio_printCurrentAudioDriver(void *arg)
} }
/* Definition of all formats, channels, and frequencies used to test audio conversions */ /* Definition of all formats, channels, and frequencies used to test audio conversions */
static SDL_AudioFormat g_audioFormats[] = { SDL_AUDIO_S8, SDL_AUDIO_U8, SDL_AUDIO_S16LSB, SDL_AUDIO_S16MSB, SDL_AUDIO_S16SYS, SDL_AUDIO_S16, static SDL_AudioFormat g_audioFormats[] = {
SDL_AUDIO_S32LSB, SDL_AUDIO_S32MSB, SDL_AUDIO_S32SYS, SDL_AUDIO_S32, SDL_AUDIO_S8, SDL_AUDIO_U8,
SDL_AUDIO_F32LSB, SDL_AUDIO_F32MSB, SDL_AUDIO_F32SYS, SDL_AUDIO_F32 }; SDL_AUDIO_S16LE, SDL_AUDIO_S16BE, SDL_AUDIO_S16,
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_S32LE, SDL_AUDIO_S32BE, SDL_AUDIO_S32,
"SDL_AUDIO_S32LSB", "SDL_AUDIO_S32MSB", "SDL_AUDIO_S32SYS", "SDL_AUDIO_S32", SDL_AUDIO_F32LE, SDL_AUDIO_F32BE, SDL_AUDIO_F32
"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_S16LE", "SDL_AUDIO_S16BE", "SDL_AUDIO_S16",
"SDL_AUDIO_S32LE", "SDL_AUDIO_S32BE", "SDL_AUDIO_S32",
"SDL_AUDIO_F32LE", "SDL_AUDIO_F32BE", "SDL_AUDIO_F32"
};
static const int g_numAudioFormats = SDL_arraysize(g_audioFormats); static const int g_numAudioFormats = SDL_arraysize(g_audioFormats);
static Uint8 g_audioChannels[] = { 1, 2, 4, 6 }; static Uint8 g_audioChannels[] = { 1, 2, 4, 6 };
static const int g_numAudioChannels = SDL_arraysize(g_audioChannels); static const int g_numAudioChannels = SDL_arraysize(g_audioChannels);
static int g_audioFrequencies[] = { 11025, 22050, 44100, 48000 }; static int g_audioFrequencies[] = { 11025, 22050, 44100, 48000 };
static const int g_numAudioFrequencies = SDL_arraysize(g_audioFrequencies); static const int g_numAudioFrequencies = SDL_arraysize(g_audioFrequencies);
/* Verify the audio formats are laid out as expected */
SDL_COMPILE_TIME_ASSERT(SDL_AUDIO_U8_FORMAT, SDL_AUDIO_U8 == SDL_AUDIO_BITSIZE(8));
SDL_COMPILE_TIME_ASSERT(SDL_AUDIO_S8_FORMAT, SDL_AUDIO_S8 == (SDL_AUDIO_BITSIZE(8) | SDL_AUDIO_MASK_SIGNED));
SDL_COMPILE_TIME_ASSERT(SDL_AUDIO_S16LE_FORMAT, SDL_AUDIO_S16LE == (SDL_AUDIO_BITSIZE(16) | SDL_AUDIO_MASK_SIGNED | SDL_AUDIO_MASK_LIL_ENDIAN));
SDL_COMPILE_TIME_ASSERT(SDL_AUDIO_S16BE_FORMAT, SDL_AUDIO_S16BE == (SDL_AUDIO_BITSIZE(16) | SDL_AUDIO_MASK_SIGNED | SDL_AUDIO_MASK_BIG_ENDIAN));
SDL_COMPILE_TIME_ASSERT(SDL_AUDIO_S32LE_FORMAT, SDL_AUDIO_S32LE == (SDL_AUDIO_BITSIZE(32) | SDL_AUDIO_MASK_SIGNED | SDL_AUDIO_MASK_LIL_ENDIAN));
SDL_COMPILE_TIME_ASSERT(SDL_AUDIO_S32BE_FORMAT, SDL_AUDIO_S32BE == (SDL_AUDIO_BITSIZE(32) | SDL_AUDIO_MASK_SIGNED | SDL_AUDIO_MASK_BIG_ENDIAN));
SDL_COMPILE_TIME_ASSERT(SDL_AUDIO_F32LE_FORMAT, SDL_AUDIO_F32LE == (SDL_AUDIO_BITSIZE(32) | SDL_AUDIO_MASK_FLOAT | SDL_AUDIO_MASK_SIGNED | SDL_AUDIO_MASK_LIL_ENDIAN));
SDL_COMPILE_TIME_ASSERT(SDL_AUDIO_F32BE_FORMAT, SDL_AUDIO_F32BE == (SDL_AUDIO_BITSIZE(32) | SDL_AUDIO_MASK_FLOAT | SDL_AUDIO_MASK_SIGNED | SDL_AUDIO_MASK_BIG_ENDIAN));
/** /**
* \brief Builds various audio conversion structures * \brief Builds various audio conversion structures
* *
@ -466,7 +482,7 @@ static int audio_buildAudioStream(void *arg)
int i, ii, j, jj, k, kk; int i, ii, j, jj, k, kk;
/* No conversion needed */ /* No conversion needed */
spec1.format = SDL_AUDIO_S16LSB; spec1.format = SDL_AUDIO_S16LE;
spec1.channels = 2; spec1.channels = 2;
spec1.freq = 22050; spec1.freq = 22050;
stream = SDL_CreateAudioStream(&spec1, &spec1); stream = SDL_CreateAudioStream(&spec1, &spec1);
@ -478,7 +494,7 @@ static int audio_buildAudioStream(void *arg)
spec1.format = SDL_AUDIO_S8; spec1.format = SDL_AUDIO_S8;
spec1.channels = 1; spec1.channels = 1;
spec1.freq = 22050; spec1.freq = 22050;
spec2.format = SDL_AUDIO_S16LSB; spec2.format = SDL_AUDIO_S16LE;
spec2.channels = 2; spec2.channels = 2;
spec2.freq = 44100; spec2.freq = 44100;
stream = SDL_CreateAudioStream(&spec1, &spec2); stream = SDL_CreateAudioStream(&spec1, &spec2);
@ -533,7 +549,7 @@ static int audio_buildAudioStreamNegative(void *arg)
spec1.format = SDL_AUDIO_S8; spec1.format = SDL_AUDIO_S8;
spec1.channels = 1; spec1.channels = 1;
spec1.freq = 22050; spec1.freq = 22050;
spec2.format = SDL_AUDIO_S16LSB; spec2.format = SDL_AUDIO_S16LE;
spec2.channels = 2; spec2.channels = 2;
spec2.freq = 44100; spec2.freq = 44100;
@ -546,7 +562,7 @@ static int audio_buildAudioStreamNegative(void *arg)
spec1.format = SDL_AUDIO_S8; spec1.format = SDL_AUDIO_S8;
spec1.channels = 1; spec1.channels = 1;
spec1.freq = 22050; spec1.freq = 22050;
spec2.format = SDL_AUDIO_S16LSB; spec2.format = SDL_AUDIO_S16LE;
spec2.channels = 2; spec2.channels = 2;
spec2.freq = 44100; spec2.freq = 44100;
@ -842,14 +858,14 @@ static int audio_resampleLoss(void *arg)
SDLTest_AssertPass("Test resampling of %i s %i Hz %f phase sine wave from sampling rate of %i Hz to %i Hz", 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); spec->time, spec->freq, spec->phase, spec->rate_in, spec->rate_out);
tmpspec1.format = SDL_AUDIO_F32SYS; tmpspec1.format = SDL_AUDIO_F32;
tmpspec1.channels = num_channels; tmpspec1.channels = num_channels;
tmpspec1.freq = spec->rate_in; tmpspec1.freq = spec->rate_in;
tmpspec2.format = SDL_AUDIO_F32SYS; tmpspec2.format = SDL_AUDIO_F32;
tmpspec2.channels = num_channels; tmpspec2.channels = num_channels;
tmpspec2.freq = spec->rate_out; tmpspec2.freq = spec->rate_out;
stream = SDL_CreateAudioStream(&tmpspec1, &tmpspec2); stream = SDL_CreateAudioStream(&tmpspec1, &tmpspec2);
SDLTest_AssertPass("Call to SDL_CreateAudioStream(SDL_AUDIO_F32SYS, 1, %i, SDL_AUDIO_F32SYS, 1, %i)", spec->rate_in, 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."); SDLTest_AssertCheck(stream != NULL, "Expected SDL_CreateAudioStream to succeed.");
if (stream == NULL) { if (stream == NULL) {
return TEST_ABORTED; return TEST_ABORTED;
@ -929,7 +945,7 @@ static int audio_resampleLoss(void *arg)
signal_to_noise, spec->signal_to_noise); signal_to_noise, spec->signal_to_noise);
SDLTest_AssertCheck(max_error <= spec->max_error, "Maximum conversion error %f should be no more than %f.", SDLTest_AssertCheck(max_error <= spec->max_error, "Maximum conversion error %f should be no more than %f.",
max_error, spec->max_error); max_error, spec->max_error);
if (++num_channels > max_channels) { if (++num_channels > max_channels) {
num_channels = min_channels; num_channels = min_channels;
++spec_idx; ++spec_idx;
@ -946,7 +962,7 @@ static int audio_resampleLoss(void *arg)
*/ */
static int audio_convertAccuracy(void *arg) static int audio_convertAccuracy(void *arg)
{ {
static SDL_AudioFormat formats[] = { SDL_AUDIO_S8, SDL_AUDIO_U8, SDL_AUDIO_S16SYS, SDL_AUDIO_S32SYS }; static SDL_AudioFormat formats[] = { SDL_AUDIO_S8, SDL_AUDIO_U8, SDL_AUDIO_S16, SDL_AUDIO_S32 };
static const char* format_names[] = { "S8", "U8", "S16", "S32" }; static const char* format_names[] = { "S8", "U8", "S16", "S32" };
int src_num = 65537 + 2048 + 48 + 256 + 100000; int src_num = 65537 + 2048 + 48 + 256 + 100000;
@ -1020,7 +1036,7 @@ static int audio_convertAccuracy(void *arg)
float target_max_delta = (bits > 23) ? 0.0f : (1.0f / (float)(1 << bits)); float target_max_delta = (bits > 23) ? 0.0f : (1.0f / (float)(1 << bits));
float target_min_delta = -target_max_delta; float target_min_delta = -target_max_delta;
src_spec.format = SDL_AUDIO_F32SYS; src_spec.format = SDL_AUDIO_F32;
src_spec.channels = 1; src_spec.channels = 1;
src_spec.freq = 44100; src_spec.freq = 44100;
@ -1099,15 +1115,15 @@ static int audio_formatChange(void *arg)
double target_signal_to_noise = 75.0; double target_signal_to_noise = 75.0;
int sine_freq = 500; int sine_freq = 500;
spec1.format = SDL_AUDIO_F32SYS; spec1.format = SDL_AUDIO_F32;
spec1.channels = 1; spec1.channels = 1;
spec1.freq = 20000; spec1.freq = 20000;
spec2.format = SDL_AUDIO_F32SYS; spec2.format = SDL_AUDIO_F32;
spec2.channels = 1; spec2.channels = 1;
spec2.freq = 40000; spec2.freq = 40000;
spec3.format = SDL_AUDIO_F32SYS; spec3.format = SDL_AUDIO_F32;
spec3.channels = 1; spec3.channels = 1;
spec3.freq = 80000; spec3.freq = 80000;

View File

@ -205,7 +205,7 @@ int main(int argc, char *argv[])
SDL_Log(" (%d channels)\n", spec.channels); SDL_Log(" (%d channels)\n", spec.channels);
spec.freq = SAMPLE_RATE_HZ; spec.freq = SAMPLE_RATE_HZ;
spec.format = SDL_AUDIO_S16SYS; spec.format = SDL_AUDIO_S16;
/* These are used by the fill_buffer callback */ /* These are used by the fill_buffer callback */
total_channels = spec.channels; total_channels = spec.channels;