mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-08-26 16:41:36 +00:00
Use consistent style for pointer declarations and casts
This commit is contained in:
@@ -280,7 +280,7 @@ void ConvertAudio(int num_frames,
|
||||
|
||||
// swizzle input to "standard" format if necessary.
|
||||
if (src_map) {
|
||||
void* buf = scratch ? scratch : dst; // use scratch if available, since it has to be big enough to hold src, unless it's NULL, then dst has to be.
|
||||
void *buf = scratch ? scratch : dst; // use scratch if available, since it has to be big enough to hold src, unless it's NULL, then dst has to be.
|
||||
SwizzleAudio(num_frames, buf, src, src_channels, src_map, src_format);
|
||||
src = buf;
|
||||
}
|
||||
@@ -318,7 +318,7 @@ void ConvertAudio(int num_frames,
|
||||
|
||||
// get us to float format.
|
||||
if (srcconvert) {
|
||||
void* buf = (channelconvert || dstconvert) ? scratch : dst;
|
||||
void *buf = (channelconvert || dstconvert) ? scratch : dst;
|
||||
ConvertAudioToFloat((float *) buf, src, num_frames * src_channels, src_format);
|
||||
src = buf;
|
||||
}
|
||||
@@ -368,7 +368,7 @@ void ConvertAudio(int num_frames,
|
||||
channel_converter = override;
|
||||
}
|
||||
|
||||
void* buf = dstconvert ? scratch : dst;
|
||||
void *buf = dstconvert ? scratch : dst;
|
||||
channel_converter((float *) buf, (const float *) src, num_frames);
|
||||
src = buf;
|
||||
}
|
||||
@@ -399,7 +399,7 @@ static int CalculateMaxFrameSize(SDL_AudioFormat src_format, int src_channels, S
|
||||
return max_format_size * max_channels;
|
||||
}
|
||||
|
||||
static Sint64 GetAudioStreamResampleRate(SDL_AudioStream* stream, int src_freq, Sint64 resample_offset)
|
||||
static Sint64 GetAudioStreamResampleRate(SDL_AudioStream *stream, int src_freq, Sint64 resample_offset)
|
||||
{
|
||||
src_freq = (int)((float)src_freq * stream->freq_ratio);
|
||||
|
||||
@@ -778,9 +778,9 @@ static bool CheckAudioStreamIsFullySetup(SDL_AudioStream *stream)
|
||||
}
|
||||
|
||||
// you MUST hold `stream->lock` when calling this, and validate your parameters!
|
||||
static bool PutAudioStreamBufferInternal(SDL_AudioStream *stream, const SDL_AudioSpec *spec, const int *chmap, const void *buf, int len, SDL_ReleaseAudioBufferCallback callback, void* userdata)
|
||||
static bool PutAudioStreamBufferInternal(SDL_AudioStream *stream, const SDL_AudioSpec *spec, const int *chmap, const void *buf, int len, SDL_ReleaseAudioBufferCallback callback, void *userdata)
|
||||
{
|
||||
SDL_AudioTrack* track = NULL;
|
||||
SDL_AudioTrack *track = NULL;
|
||||
|
||||
if (callback) {
|
||||
track = SDL_CreateAudioTrack(stream->queue, spec, chmap, (Uint8 *)buf, len, len, callback, userdata);
|
||||
@@ -809,7 +809,7 @@ static bool PutAudioStreamBufferInternal(SDL_AudioStream *stream, const SDL_Audi
|
||||
return retval;
|
||||
}
|
||||
|
||||
static bool PutAudioStreamBuffer(SDL_AudioStream *stream, const void *buf, int len, SDL_ReleaseAudioBufferCallback callback, void* userdata)
|
||||
static bool PutAudioStreamBuffer(SDL_AudioStream *stream, const void *buf, int len, SDL_ReleaseAudioBufferCallback callback, void *userdata)
|
||||
{
|
||||
#if DEBUG_AUDIOSTREAM
|
||||
SDL_Log("AUDIOSTREAM: wants to put %d bytes", len);
|
||||
@@ -836,7 +836,7 @@ static bool PutAudioStreamBuffer(SDL_AudioStream *stream, const void *buf, int l
|
||||
|
||||
static void SDLCALL FreeAllocatedAudioBuffer(void *userdata, const void *buf, int len)
|
||||
{
|
||||
SDL_free((void*) buf);
|
||||
SDL_free((void *)buf);
|
||||
}
|
||||
|
||||
bool SDL_PutAudioStreamData(SDL_AudioStream *stream, const void *buf, int len)
|
||||
@@ -1081,8 +1081,8 @@ static Uint8 *EnsureAudioStreamWorkBufferSize(SDL_AudioStream *stream, size_t ne
|
||||
return ptr;
|
||||
}
|
||||
|
||||
static Sint64 NextAudioStreamIter(SDL_AudioStream* stream, void** inout_iter,
|
||||
Sint64* inout_resample_offset, SDL_AudioSpec* out_spec, int **out_chmap, bool* out_flushed)
|
||||
static Sint64 NextAudioStreamIter(SDL_AudioStream *stream, void **inout_iter,
|
||||
Sint64 *inout_resample_offset, SDL_AudioSpec *out_spec, int **out_chmap, bool *out_flushed)
|
||||
{
|
||||
SDL_AudioSpec spec;
|
||||
bool flushed;
|
||||
@@ -1136,9 +1136,9 @@ static Sint64 NextAudioStreamIter(SDL_AudioStream* stream, void** inout_iter,
|
||||
return output_frames;
|
||||
}
|
||||
|
||||
static Sint64 GetAudioStreamAvailableFrames(SDL_AudioStream* stream, Sint64* out_resample_offset)
|
||||
static Sint64 GetAudioStreamAvailableFrames(SDL_AudioStream *stream, Sint64 *out_resample_offset)
|
||||
{
|
||||
void* iter = SDL_BeginAudioQueueIter(stream->queue);
|
||||
void *iter = SDL_BeginAudioQueueIter(stream->queue);
|
||||
|
||||
Sint64 resample_offset = stream->resample_offset;
|
||||
Sint64 output_frames = 0;
|
||||
@@ -1160,9 +1160,9 @@ static Sint64 GetAudioStreamAvailableFrames(SDL_AudioStream* stream, Sint64* out
|
||||
return output_frames;
|
||||
}
|
||||
|
||||
static Sint64 GetAudioStreamHead(SDL_AudioStream* stream, SDL_AudioSpec* out_spec, int **out_chmap, bool* out_flushed)
|
||||
static Sint64 GetAudioStreamHead(SDL_AudioStream *stream, SDL_AudioSpec *out_spec, int **out_chmap, bool *out_flushed)
|
||||
{
|
||||
void* iter = SDL_BeginAudioQueueIter(stream->queue);
|
||||
void *iter = SDL_BeginAudioQueueIter(stream->queue);
|
||||
|
||||
if (!iter) {
|
||||
SDL_zerop(out_spec);
|
||||
@@ -1178,8 +1178,8 @@ static Sint64 GetAudioStreamHead(SDL_AudioStream* stream, SDL_AudioSpec* out_spe
|
||||
// Enough input data MUST be available!
|
||||
static bool GetAudioStreamDataInternal(SDL_AudioStream *stream, void *buf, int output_frames, float gain)
|
||||
{
|
||||
const SDL_AudioSpec* src_spec = &stream->input_spec;
|
||||
const SDL_AudioSpec* dst_spec = &stream->dst_spec;
|
||||
const SDL_AudioSpec *src_spec = &stream->input_spec;
|
||||
const SDL_AudioSpec *dst_spec = &stream->dst_spec;
|
||||
|
||||
const SDL_AudioFormat src_format = src_spec->format;
|
||||
const int src_channels = src_spec->channels;
|
||||
@@ -1199,7 +1199,7 @@ static bool GetAudioStreamDataInternal(SDL_AudioStream *stream, void *buf, int o
|
||||
|
||||
// Not resampling? It's an easy conversion (and maybe not even that!)
|
||||
if (resample_rate == 0) {
|
||||
Uint8* work_buffer = NULL;
|
||||
Uint8 *work_buffer = NULL;
|
||||
|
||||
// Ensure we have enough scratch space for any conversions
|
||||
if ((src_format != dst_format) || (src_channels != dst_channels) || (gain != 1.0f)) {
|
||||
@@ -1269,7 +1269,7 @@ static bool GetAudioStreamDataInternal(SDL_AudioStream *stream, void *buf, int o
|
||||
work_buffer_capacity += resample_bytes;
|
||||
}
|
||||
|
||||
Uint8* work_buffer = EnsureAudioStreamWorkBufferSize(stream, work_buffer_capacity);
|
||||
Uint8 *work_buffer = EnsureAudioStreamWorkBufferSize(stream, work_buffer_capacity);
|
||||
|
||||
if (!work_buffer) {
|
||||
return false;
|
||||
@@ -1281,7 +1281,7 @@ static bool GetAudioStreamDataInternal(SDL_AudioStream *stream, void *buf, int o
|
||||
const float postresample_gain = (input_frames > output_frames) ? gain : 1.0f;
|
||||
|
||||
// (dst channel map is NULL because we'll do the final swizzle on ConvertAudio after resample.)
|
||||
const Uint8* input_buffer = SDL_ReadFromAudioQueue(stream->queue,
|
||||
const Uint8 *input_buffer = SDL_ReadFromAudioQueue(stream->queue,
|
||||
NULL, resample_format, resample_channels, NULL,
|
||||
padding_frames, input_frames, padding_frames, work_buffer, preresample_gain);
|
||||
|
||||
@@ -1292,11 +1292,11 @@ static bool GetAudioStreamDataInternal(SDL_AudioStream *stream, void *buf, int o
|
||||
input_buffer += padding_frames * resample_frame_size;
|
||||
|
||||
// Decide where the resampled output goes
|
||||
void* resample_buffer = (resample_buffer_offset != -1) ? (work_buffer + resample_buffer_offset) : buf;
|
||||
void *resample_buffer = (resample_buffer_offset != -1) ? (work_buffer + resample_buffer_offset) : buf;
|
||||
|
||||
SDL_ResampleAudio(resample_channels,
|
||||
(const float *) input_buffer, input_frames,
|
||||
(float*) resample_buffer, output_frames,
|
||||
(const float *)input_buffer, input_frames,
|
||||
(float *)resample_buffer, output_frames,
|
||||
resample_rate, &stream->resample_offset);
|
||||
|
||||
// Convert to the final format, if necessary (src channel map is NULL because SDL_ReadFromAudioQueue already handled this).
|
||||
|
||||
@@ -185,7 +185,7 @@ static void SDL_Convert_F32_to_S32_Scalar(Sint32 *dst, const float *src, int num
|
||||
|
||||
#undef SIGNMASK
|
||||
|
||||
static void SDL_Convert_Swap16_Scalar(Uint16* dst, const Uint16* src, int num_samples)
|
||||
static void SDL_Convert_Swap16_Scalar(Uint16 *dst, const Uint16 *src, int num_samples)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -194,7 +194,7 @@ static void SDL_Convert_Swap16_Scalar(Uint16* dst, const Uint16* src, int num_sa
|
||||
}
|
||||
}
|
||||
|
||||
static void SDL_Convert_Swap32_Scalar(Uint32* dst, const Uint32* src, int num_samples)
|
||||
static void SDL_Convert_Swap32_Scalar(Uint32 *dst, const Uint32 *src, int num_samples)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -375,7 +375,7 @@ static void SDL_TARGETING("sse2") SDL_Convert_F32_to_S8_SSE2(Sint8 *dst, const f
|
||||
|
||||
const __m128i bytes = _mm_packus_epi16(shorts0, shorts1);
|
||||
|
||||
_mm_store_si128((__m128i*)&dst[i], bytes);
|
||||
_mm_store_si128((__m128i *)&dst[i], bytes);
|
||||
})
|
||||
}
|
||||
|
||||
@@ -409,7 +409,7 @@ static void SDL_TARGETING("sse2") SDL_Convert_F32_to_U8_SSE2(Uint8 *dst, const f
|
||||
|
||||
const __m128i bytes = _mm_packus_epi16(shorts0, shorts1);
|
||||
|
||||
_mm_store_si128((__m128i*)&dst[i], bytes);
|
||||
_mm_store_si128((__m128i *)&dst[i], bytes);
|
||||
})
|
||||
}
|
||||
|
||||
@@ -441,8 +441,8 @@ static void SDL_TARGETING("sse2") SDL_Convert_F32_to_S16_SSE2(Sint16 *dst, const
|
||||
const __m128i shorts0 = _mm_packs_epi32(ints0, ints1);
|
||||
const __m128i shorts1 = _mm_packs_epi32(ints2, ints3);
|
||||
|
||||
_mm_store_si128((__m128i*)&dst[i], shorts0);
|
||||
_mm_store_si128((__m128i*)&dst[i + 8], shorts1);
|
||||
_mm_store_si128((__m128i *)&dst[i], shorts0);
|
||||
_mm_store_si128((__m128i *)&dst[i + 8], shorts1);
|
||||
})
|
||||
}
|
||||
|
||||
@@ -477,55 +477,55 @@ static void SDL_TARGETING("sse2") SDL_Convert_F32_to_S32_SSE2(Sint32 *dst, const
|
||||
const __m128i ints2 = _mm_xor_si128(_mm_cvttps_epi32(values3), _mm_castps_si128(_mm_cmpge_ps(values3, limit)));
|
||||
const __m128i ints3 = _mm_xor_si128(_mm_cvttps_epi32(values4), _mm_castps_si128(_mm_cmpge_ps(values4, limit)));
|
||||
|
||||
_mm_store_si128((__m128i*)&dst[i], ints0);
|
||||
_mm_store_si128((__m128i*)&dst[i + 4], ints1);
|
||||
_mm_store_si128((__m128i*)&dst[i + 8], ints2);
|
||||
_mm_store_si128((__m128i*)&dst[i + 12], ints3);
|
||||
_mm_store_si128((__m128i *)&dst[i], ints0);
|
||||
_mm_store_si128((__m128i *)&dst[i + 4], ints1);
|
||||
_mm_store_si128((__m128i *)&dst[i + 8], ints2);
|
||||
_mm_store_si128((__m128i *)&dst[i + 12], ints3);
|
||||
})
|
||||
}
|
||||
#endif
|
||||
|
||||
// FIXME: SDL doesn't have SSSE3 detection, so use the next one up
|
||||
#ifdef SDL_SSE4_1_INTRINSICS
|
||||
static void SDL_TARGETING("ssse3") SDL_Convert_Swap16_SSSE3(Uint16* dst, const Uint16* src, int num_samples)
|
||||
static void SDL_TARGETING("ssse3") SDL_Convert_Swap16_SSSE3(Uint16 *dst, const Uint16 *src, int num_samples)
|
||||
{
|
||||
const __m128i shuffle = _mm_set_epi8(14, 15, 12, 13, 10, 11, 8, 9, 6, 7, 4, 5, 2, 3, 0, 1);
|
||||
|
||||
CONVERT_16_FWD({
|
||||
dst[i] = SDL_Swap16(src[i]);
|
||||
}, {
|
||||
__m128i ints0 = _mm_loadu_si128((const __m128i*)&src[i]);
|
||||
__m128i ints1 = _mm_loadu_si128((const __m128i*)&src[i + 8]);
|
||||
__m128i ints0 = _mm_loadu_si128((const __m128i *)&src[i]);
|
||||
__m128i ints1 = _mm_loadu_si128((const __m128i *)&src[i + 8]);
|
||||
|
||||
ints0 = _mm_shuffle_epi8(ints0, shuffle);
|
||||
ints1 = _mm_shuffle_epi8(ints1, shuffle);
|
||||
|
||||
_mm_store_si128((__m128i*)&dst[i], ints0);
|
||||
_mm_store_si128((__m128i*)&dst[i + 8], ints1);
|
||||
_mm_store_si128((__m128i *)&dst[i], ints0);
|
||||
_mm_store_si128((__m128i *)&dst[i + 8], ints1);
|
||||
})
|
||||
}
|
||||
|
||||
static void SDL_TARGETING("ssse3") SDL_Convert_Swap32_SSSE3(Uint32* dst, const Uint32* src, int num_samples)
|
||||
static void SDL_TARGETING("ssse3") SDL_Convert_Swap32_SSSE3(Uint32 *dst, const Uint32 *src, int num_samples)
|
||||
{
|
||||
const __m128i shuffle = _mm_set_epi8(12, 13, 14, 15, 8, 9, 10, 11, 4, 5, 6, 7, 0, 1, 2, 3);
|
||||
|
||||
CONVERT_16_FWD({
|
||||
dst[i] = SDL_Swap32(src[i]);
|
||||
}, {
|
||||
__m128i ints0 = _mm_loadu_si128((const __m128i*)&src[i]);
|
||||
__m128i ints1 = _mm_loadu_si128((const __m128i*)&src[i + 4]);
|
||||
__m128i ints2 = _mm_loadu_si128((const __m128i*)&src[i + 8]);
|
||||
__m128i ints3 = _mm_loadu_si128((const __m128i*)&src[i + 12]);
|
||||
__m128i ints0 = _mm_loadu_si128((const __m128i *)&src[i]);
|
||||
__m128i ints1 = _mm_loadu_si128((const __m128i *)&src[i + 4]);
|
||||
__m128i ints2 = _mm_loadu_si128((const __m128i *)&src[i + 8]);
|
||||
__m128i ints3 = _mm_loadu_si128((const __m128i *)&src[i + 12]);
|
||||
|
||||
ints0 = _mm_shuffle_epi8(ints0, shuffle);
|
||||
ints1 = _mm_shuffle_epi8(ints1, shuffle);
|
||||
ints2 = _mm_shuffle_epi8(ints2, shuffle);
|
||||
ints3 = _mm_shuffle_epi8(ints3, shuffle);
|
||||
|
||||
_mm_store_si128((__m128i*)&dst[i], ints0);
|
||||
_mm_store_si128((__m128i*)&dst[i + 4], ints1);
|
||||
_mm_store_si128((__m128i*)&dst[i + 8], ints2);
|
||||
_mm_store_si128((__m128i*)&dst[i + 12], ints3);
|
||||
_mm_store_si128((__m128i *)&dst[i], ints0);
|
||||
_mm_store_si128((__m128i *)&dst[i + 4], ints1);
|
||||
_mm_store_si128((__m128i *)&dst[i + 8], ints2);
|
||||
_mm_store_si128((__m128i *)&dst[i + 12], ints3);
|
||||
})
|
||||
}
|
||||
#endif
|
||||
@@ -774,41 +774,41 @@ static void SDL_Convert_F32_to_S32_NEON(Sint32 *dst, const float *src, int num_s
|
||||
fesetenv(&fenv);
|
||||
}
|
||||
|
||||
static void SDL_Convert_Swap16_NEON(Uint16* dst, const Uint16* src, int num_samples)
|
||||
static void SDL_Convert_Swap16_NEON(Uint16 *dst, const Uint16 *src, int num_samples)
|
||||
{
|
||||
CONVERT_16_FWD({
|
||||
dst[i] = SDL_Swap16(src[i]);
|
||||
}, {
|
||||
uint8x16_t ints0 = vld1q_u8((const Uint8*)&src[i]);
|
||||
uint8x16_t ints1 = vld1q_u8((const Uint8*)&src[i + 8]);
|
||||
uint8x16_t ints0 = vld1q_u8((const Uint8 *)&src[i]);
|
||||
uint8x16_t ints1 = vld1q_u8((const Uint8 *)&src[i + 8]);
|
||||
|
||||
ints0 = vrev16q_u8(ints0);
|
||||
ints1 = vrev16q_u8(ints1);
|
||||
|
||||
vst1q_u8((Uint8*)&dst[i], ints0);
|
||||
vst1q_u8((Uint8*)&dst[i + 8], ints1);
|
||||
vst1q_u8((Uint8 *)&dst[i], ints0);
|
||||
vst1q_u8((Uint8 *)&dst[i + 8], ints1);
|
||||
})
|
||||
}
|
||||
|
||||
static void SDL_Convert_Swap32_NEON(Uint32* dst, const Uint32* src, int num_samples)
|
||||
static void SDL_Convert_Swap32_NEON(Uint32 *dst, const Uint32 *src, int num_samples)
|
||||
{
|
||||
CONVERT_16_FWD({
|
||||
dst[i] = SDL_Swap32(src[i]);
|
||||
}, {
|
||||
uint8x16_t ints0 = vld1q_u8((const Uint8*)&src[i]);
|
||||
uint8x16_t ints1 = vld1q_u8((const Uint8*)&src[i + 4]);
|
||||
uint8x16_t ints2 = vld1q_u8((const Uint8*)&src[i + 8]);
|
||||
uint8x16_t ints3 = vld1q_u8((const Uint8*)&src[i + 12]);
|
||||
uint8x16_t ints0 = vld1q_u8((const Uint8 *)&src[i]);
|
||||
uint8x16_t ints1 = vld1q_u8((const Uint8 *)&src[i + 4]);
|
||||
uint8x16_t ints2 = vld1q_u8((const Uint8 *)&src[i + 8]);
|
||||
uint8x16_t ints3 = vld1q_u8((const Uint8 *)&src[i + 12]);
|
||||
|
||||
ints0 = vrev32q_u8(ints0);
|
||||
ints1 = vrev32q_u8(ints1);
|
||||
ints2 = vrev32q_u8(ints2);
|
||||
ints3 = vrev32q_u8(ints3);
|
||||
|
||||
vst1q_u8((Uint8*)&dst[i], ints0);
|
||||
vst1q_u8((Uint8*)&dst[i + 4], ints1);
|
||||
vst1q_u8((Uint8*)&dst[i + 8], ints2);
|
||||
vst1q_u8((Uint8*)&dst[i + 12], ints3);
|
||||
vst1q_u8((Uint8 *)&dst[i], ints0);
|
||||
vst1q_u8((Uint8 *)&dst[i + 4], ints1);
|
||||
vst1q_u8((Uint8 *)&dst[i + 8], ints2);
|
||||
vst1q_u8((Uint8 *)&dst[i + 12], ints3);
|
||||
})
|
||||
}
|
||||
|
||||
@@ -839,8 +839,8 @@ static void (*SDL_Convert_F32_to_U8)(Uint8 *dst, const float *src, int num_sampl
|
||||
static void (*SDL_Convert_F32_to_S16)(Sint16 *dst, const float *src, int num_samples) = NULL;
|
||||
static void (*SDL_Convert_F32_to_S32)(Sint32 *dst, const float *src, int num_samples) = NULL;
|
||||
|
||||
static void (*SDL_Convert_Swap16)(Uint16* dst, const Uint16* src, int num_samples) = NULL;
|
||||
static void (*SDL_Convert_Swap32)(Uint32* dst, const Uint32* src, int num_samples) = NULL;
|
||||
static void (*SDL_Convert_Swap16)(Uint16 *dst, const Uint16 *src, int num_samples) = NULL;
|
||||
static void (*SDL_Convert_Swap32)(Uint32 *dst, const Uint32 *src, int num_samples) = NULL;
|
||||
|
||||
void ConvertAudioToFloat(float *dst, const void *src, int num_samples, SDL_AudioFormat src_fmt)
|
||||
{
|
||||
@@ -858,7 +858,7 @@ void ConvertAudioToFloat(float *dst, const void *src, int num_samples, SDL_Audio
|
||||
break;
|
||||
|
||||
case SDL_AUDIO_S16 ^ SDL_AUDIO_MASK_BIG_ENDIAN:
|
||||
SDL_Convert_Swap16((Uint16*) dst, (const Uint16*) src, num_samples);
|
||||
SDL_Convert_Swap16((Uint16 *)dst, (const Uint16 *)src, num_samples);
|
||||
SDL_Convert_S16_to_F32(dst, (const Sint16 *) dst, num_samples);
|
||||
break;
|
||||
|
||||
@@ -867,12 +867,12 @@ void ConvertAudioToFloat(float *dst, const void *src, int num_samples, SDL_Audio
|
||||
break;
|
||||
|
||||
case SDL_AUDIO_S32 ^ SDL_AUDIO_MASK_BIG_ENDIAN:
|
||||
SDL_Convert_Swap32((Uint32*) dst, (const Uint32*) src, num_samples);
|
||||
SDL_Convert_Swap32((Uint32 *)dst, (const Uint32 *)src, num_samples);
|
||||
SDL_Convert_S32_to_F32(dst, (const Sint32 *) dst, num_samples);
|
||||
break;
|
||||
|
||||
case SDL_AUDIO_F32 ^ SDL_AUDIO_MASK_BIG_ENDIAN:
|
||||
SDL_Convert_Swap32((Uint32*) dst, (const Uint32*) src, num_samples);
|
||||
SDL_Convert_Swap32((Uint32 *)dst, (const Uint32 *)src, num_samples);
|
||||
break;
|
||||
|
||||
default: SDL_assert(!"Unexpected audio format!"); break;
|
||||
@@ -896,7 +896,7 @@ void ConvertAudioFromFloat(void *dst, const float *src, int num_samples, SDL_Aud
|
||||
|
||||
case SDL_AUDIO_S16 ^ SDL_AUDIO_MASK_BIG_ENDIAN:
|
||||
SDL_Convert_F32_to_S16((Sint16 *) dst, src, num_samples);
|
||||
SDL_Convert_Swap16((Uint16*) dst, (const Uint16*) dst, num_samples);
|
||||
SDL_Convert_Swap16((Uint16 *)dst, (const Uint16 *)dst, num_samples);
|
||||
break;
|
||||
|
||||
case SDL_AUDIO_S32:
|
||||
@@ -905,22 +905,22 @@ void ConvertAudioFromFloat(void *dst, const float *src, int num_samples, SDL_Aud
|
||||
|
||||
case SDL_AUDIO_S32 ^ SDL_AUDIO_MASK_BIG_ENDIAN:
|
||||
SDL_Convert_F32_to_S32((Sint32 *) dst, src, num_samples);
|
||||
SDL_Convert_Swap32((Uint32*) dst, (const Uint32*) dst, num_samples);
|
||||
SDL_Convert_Swap32((Uint32 *)dst, (const Uint32 *)dst, num_samples);
|
||||
break;
|
||||
|
||||
case SDL_AUDIO_F32 ^ SDL_AUDIO_MASK_BIG_ENDIAN:
|
||||
SDL_Convert_Swap32((Uint32*) dst, (const Uint32*) src, num_samples);
|
||||
SDL_Convert_Swap32((Uint32 *)dst, (const Uint32 *)src, num_samples);
|
||||
break;
|
||||
|
||||
default: SDL_assert(!"Unexpected audio format!"); break;
|
||||
}
|
||||
}
|
||||
|
||||
void ConvertAudioSwapEndian(void* dst, const void* src, int num_samples, int bitsize)
|
||||
void ConvertAudioSwapEndian(void *dst, const void *src, int num_samples, int bitsize)
|
||||
{
|
||||
switch (bitsize) {
|
||||
case 16: SDL_Convert_Swap16((Uint16*) dst, (const Uint16*) src, num_samples); break;
|
||||
case 32: SDL_Convert_Swap32((Uint32*) dst, (const Uint32*) src, num_samples); break;
|
||||
case 16: SDL_Convert_Swap16((Uint16 *)dst, (const Uint16 *)src, num_samples); break;
|
||||
case 32: SDL_Convert_Swap32((Uint32 *)dst, (const Uint32 *)src, num_samples); break;
|
||||
default: SDL_assert(!"Unexpected audio format!"); break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ extern void SDL_AudioThreadFinalize(SDL_AudioDevice *device);
|
||||
|
||||
extern void ConvertAudioToFloat(float *dst, const void *src, int num_samples, SDL_AudioFormat src_fmt);
|
||||
extern void ConvertAudioFromFloat(void *dst, const float *src, int num_samples, SDL_AudioFormat dst_fmt);
|
||||
extern void ConvertAudioSwapEndian(void* dst, const void* src, int num_samples, int bitsize);
|
||||
extern void ConvertAudioSwapEndian(void *dst, const void *src, int num_samples, int bitsize);
|
||||
|
||||
extern bool SDL_ChannelMapIsDefault(const int *map, int channels);
|
||||
extern bool SDL_ChannelMapIsBogus(const int *map, int channels);
|
||||
@@ -121,7 +121,7 @@ extern bool SDL_ChannelMapIsBogus(const int *map, int channels);
|
||||
extern void ConvertAudio(int num_frames,
|
||||
const void *src, SDL_AudioFormat src_format, int src_channels, const int *src_map,
|
||||
void *dst, SDL_AudioFormat dst_format, int dst_channels, const int *dst_map,
|
||||
void* scratch, float gain);
|
||||
void *scratch, float gain);
|
||||
|
||||
// Compare two SDL_AudioSpecs, return true if they match exactly.
|
||||
// Using SDL_memcmp directly isn't safe, since potential padding might not be initialized.
|
||||
@@ -201,7 +201,7 @@ struct SDL_AudioQueue; // forward decl.
|
||||
|
||||
struct SDL_AudioStream
|
||||
{
|
||||
SDL_Mutex* lock;
|
||||
SDL_Mutex *lock;
|
||||
|
||||
SDL_PropertiesID props;
|
||||
|
||||
@@ -217,7 +217,7 @@ struct SDL_AudioStream
|
||||
float freq_ratio;
|
||||
float gain;
|
||||
|
||||
struct SDL_AudioQueue* queue;
|
||||
struct SDL_AudioQueue *queue;
|
||||
|
||||
SDL_AudioSpec input_spec; // The spec of input data currently being processed
|
||||
int *input_chmap;
|
||||
|
||||
@@ -87,7 +87,7 @@ static int (*ALSA_snd_device_name_free_hint)(void **);
|
||||
static snd_pcm_sframes_t (*ALSA_snd_pcm_avail)(snd_pcm_t *);
|
||||
static size_t (*ALSA_snd_ctl_card_info_sizeof)(void);
|
||||
static size_t (*ALSA_snd_pcm_info_sizeof)(void);
|
||||
static int (*ALSA_snd_card_next)(int*);
|
||||
static int (*ALSA_snd_card_next)(int *);
|
||||
static int (*ALSA_snd_ctl_open)(snd_ctl_t **,const char *,int);
|
||||
static int (*ALSA_snd_ctl_close)(snd_ctl_t *);
|
||||
static int (*ALSA_snd_ctl_card_info)(snd_ctl_t *, snd_ctl_card_info_t *);
|
||||
@@ -670,7 +670,7 @@ static void swizzle_map_compute(const struct ALSA_pcm_cfg_ctx *ctx, int *swizzle
|
||||
static int alsa_chmap_install(struct ALSA_pcm_cfg_ctx *ctx, const unsigned int *chmap)
|
||||
{
|
||||
bool isstack;
|
||||
snd_pcm_chmap_t *chmap_to_install = (snd_pcm_chmap_t*)SDL_small_alloc(unsigned int, 1 + ctx->chans_n, &isstack);
|
||||
snd_pcm_chmap_t *chmap_to_install = (snd_pcm_chmap_t *)SDL_small_alloc(unsigned int, 1 + ctx->chans_n, &isstack);
|
||||
if (!chmap_to_install) {
|
||||
return -1;
|
||||
}
|
||||
@@ -1214,7 +1214,7 @@ static int hotplug_device_process(snd_ctl_t *ctl, snd_ctl_card_info_t *ctl_card_
|
||||
unsigned int subdev_idx = 0;
|
||||
const bool recording = direction == SND_PCM_STREAM_CAPTURE ? true : false; // used for the unicity of the device
|
||||
bool isstack;
|
||||
snd_pcm_info_t *pcm_info = (snd_pcm_info_t*)SDL_small_alloc(Uint8, ALSA_snd_pcm_info_sizeof(), &isstack);
|
||||
snd_pcm_info_t *pcm_info = (snd_pcm_info_t *)SDL_small_alloc(Uint8, ALSA_snd_pcm_info_sizeof(), &isstack);
|
||||
SDL_memset(pcm_info, 0, ALSA_snd_pcm_info_sizeof());
|
||||
|
||||
while (true) {
|
||||
@@ -1453,10 +1453,10 @@ static void ALSA_DetectDevices(SDL_AudioDevice **default_playback, SDL_AudioDevi
|
||||
bool has_default_playback = false, has_default_recording = false;
|
||||
ALSA_HotplugIteration(&has_default_playback, &has_default_recording); // run once now before a thread continues to check.
|
||||
if (has_default_playback) {
|
||||
*default_playback = SDL_AddAudioDevice(/*recording=*/false, "ALSA default playback device", NULL, (void*)&default_playback_handle);
|
||||
*default_playback = SDL_AddAudioDevice(/*recording=*/false, "ALSA default playback device", NULL, (void *)&default_playback_handle);
|
||||
}
|
||||
if (has_default_recording) {
|
||||
*default_recording = SDL_AddAudioDevice(/*recording=*/true, "ALSA default recording device", NULL, (void*)&default_recording_handle);
|
||||
*default_recording = SDL_AddAudioDevice(/*recording=*/true, "ALSA default recording device", NULL, (void *)&default_recording_handle);
|
||||
}
|
||||
|
||||
#if SDL_ALSA_HOTPLUG_THREAD
|
||||
|
||||
@@ -56,7 +56,7 @@ static bool EMSCRIPTENAUDIO_PlayDevice(SDL_AudioDevice *device, const Uint8 *buf
|
||||
}
|
||||
|
||||
for (var j = 0; j < $1; ++j) {
|
||||
channelData[j] = HEAPF32[buf + (j*numChannels + c)];
|
||||
channelData[j] = HEAPF32[buf + (j * numChannels + c)];
|
||||
}
|
||||
}
|
||||
}, buffer, buffer_size / framelen);
|
||||
|
||||
@@ -546,7 +546,7 @@ static void node_event_info(void *object, const struct pw_node_info *info)
|
||||
|
||||
// Need to parse the parameters to get the sample rate
|
||||
for (i = 0; i < info->n_params; ++i) {
|
||||
pw_node_enum_params((struct pw_node*)node->proxy, 0, info->params[i].id, 0, 0, NULL);
|
||||
pw_node_enum_params((struct pw_node *)node->proxy, 0, info->params[i].id, 0, 0, NULL);
|
||||
}
|
||||
|
||||
hotplug_core_sync(node);
|
||||
|
||||
@@ -750,7 +750,7 @@ static bool mgmtthrtask_PrepDevice(void *userdata)
|
||||
// Try querying IAudioClient3 if sharemode is AUDCLNT_SHAREMODE_SHARED
|
||||
if (sharemode == AUDCLNT_SHAREMODE_SHARED) {
|
||||
IAudioClient3 *client3 = NULL;
|
||||
ret = IAudioClient_QueryInterface(client, &SDL_IID_IAudioClient3, (void**)&client3);
|
||||
ret = IAudioClient_QueryInterface(client, &SDL_IID_IAudioClient3, (void **)&client3);
|
||||
if (SUCCEEDED(ret)) {
|
||||
UINT32 default_period_in_frames = 0;
|
||||
UINT32 fundamental_period_in_frames = 0;
|
||||
|
||||
Reference in New Issue
Block a user