SDL_audiotypecvt.c File Reference
`#include "../SDL_internal.h"`
`#include "SDL_audio.h"`
`#include "SDL_audio_c.h"`
`#include "SDL_cpuinfo.h"`
`#include "SDL_assert.h"`
Include dependency graph for SDL_audiotypecvt.c:

Go to the source code of this file.

## Macros

#define | HAVE_NEON_INTRINSICS 0
#define | NEED_SCALAR_CONVERTER_FALLBACKS 1
#define | DIVBY128 0.0078125f
#define | DIVBY32768 0.000030517578125f
#define | DIVBY2147483648 0.00000000046566128730773926
#define | SET_CONVERTER_FUNCS(fntype)

## Functions

static void | SDL_Convert_S8_to_F32_Scalar (SDL_AudioCVT *cvt, SDL_AudioFormat format)
static void | SDL_Convert_U8_to_F32_Scalar (SDL_AudioCVT *cvt, SDL_AudioFormat format)
static void | SDL_Convert_S16_to_F32_Scalar (SDL_AudioCVT *cvt, SDL_AudioFormat format)
static void | SDL_Convert_U16_to_F32_Scalar (SDL_AudioCVT *cvt, SDL_AudioFormat format)
static void | SDL_Convert_S32_to_F32_Scalar (SDL_AudioCVT *cvt, SDL_AudioFormat format)
static void | SDL_Convert_F32_to_S8_Scalar (SDL_AudioCVT *cvt, SDL_AudioFormat format)
static void | SDL_Convert_F32_to_U8_Scalar (SDL_AudioCVT *cvt, SDL_AudioFormat format)
static void | SDL_Convert_F32_to_S16_Scalar (SDL_AudioCVT *cvt, SDL_AudioFormat format)
static void | SDL_Convert_F32_to_U16_Scalar (SDL_AudioCVT *cvt, SDL_AudioFormat format)
static void | SDL_Convert_F32_to_S32_Scalar (SDL_AudioCVT *cvt, SDL_AudioFormat format)
void | SDL_ChooseAudioConverters (void)

## Variables

SDL_AudioFilter | SDL_Convert_S8_to_F32 = NULL
SDL_AudioFilter | SDL_Convert_U8_to_F32 = NULL
SDL_AudioFilter | SDL_Convert_S16_to_F32 = NULL
SDL_AudioFilter | SDL_Convert_U16_to_F32 = NULL
SDL_AudioFilter | SDL_Convert_S32_to_F32 = NULL
SDL_AudioFilter | SDL_Convert_F32_to_S8 = NULL
SDL_AudioFilter | SDL_Convert_F32_to_U8 = NULL
SDL_AudioFilter | SDL_Convert_F32_to_S16 = NULL
SDL_AudioFilter | SDL_Convert_F32_to_U16 = NULL
SDL_AudioFilter | SDL_Convert_F32_to_S32 = NULL

## Macro Definition Documentation

## DIVBY128

#define DIVBY128 0.0078125f

Definition at line 63 of file SDL_audiotypecvt.c.

Referenced by SDL_Convert_F32_to_S32_Scalar(), SDL_Convert_S8_to_F32_Scalar(), and SDL_Convert_U8_to_F32_Scalar().

## DIVBY2147483648

#define DIVBY2147483648 0.00000000046566128730773926

Definition at line 65 of file SDL_audiotypecvt.c.

Referenced by SDL_Convert_F32_to_S32_Scalar(), and SDL_Convert_S32_to_F32_Scalar().

## DIVBY32768

#define DIVBY32768 0.000030517578125f

Definition at line 64 of file SDL_audiotypecvt.c.

Referenced by SDL_Convert_F32_to_S32_Scalar(), SDL_Convert_S16_to_F32_Scalar(), and SDL_Convert_U16_to_F32_Scalar().

## HAVE_NEON_INTRINSICS

#define HAVE_NEON_INTRINSICS 0

Definition at line 29 of file SDL_audiotypecvt.c.

## NEED_SCALAR_CONVERTER_FALLBACKS

#define NEED_SCALAR_CONVERTER_FALLBACKS 1

Definition at line 47 of file SDL_audiotypecvt.c.

## SET_CONVERTER_FUNCS

#define SET_CONVERTER_FUNCS | ( |  | fntype | ) |

Value:
SDL_Convert_S8_to_F32 = SDL_Convert_S8_to_F32_##fntype; \
SDL_Convert_U8_to_F32 = SDL_Convert_U8_to_F32_##fntype; \
SDL_Convert_S16_to_F32 = SDL_Convert_S16_to_F32_##fntype; \
SDL_Convert_U16_to_F32 = SDL_Convert_U16_to_F32_##fntype; \
SDL_Convert_S32_to_F32 = SDL_Convert_S32_to_F32_##fntype; \
SDL_Convert_F32_to_S8 = SDL_Convert_F32_to_S8_##fntype; \
SDL_Convert_F32_to_U8 = SDL_Convert_F32_to_U8_##fntype; \
SDL_Convert_F32_to_S16 = SDL_Convert_F32_to_S16_##fntype; \
SDL_Convert_F32_to_U16 = SDL_Convert_F32_to_U16_##fntype; \
SDL_Convert_F32_to_S32 = SDL_Convert_F32_to_S32_##fntype; \
converters_chosen = SDL_TRUE
SDL_TRUE
Definition: SDL_stdinc.h:142
fntype
int(* fntype)(const char *)
Definition: testloadso.c:22
SDL_Convert_S8_to_F32
SDL_AudioFilter SDL_Convert_S8_to_F32
Definition: SDL_audiotypecvt.c:51

Referenced by SDL_ChooseAudioConverters().

## Function Documentation

## SDL_ChooseAudioConverters()

void SDL_ChooseAudioConverters | ( | void |  | ) |

Definition at line 792 of file SDL_audiotypecvt.c.

References SDL_assert, SDL_FALSE, SDL_HasSSE2, SDL_TRUE, and SET_CONVERTER_FUNCS.

Referenced by SDL_BuildAudioCVT().

{
static SDL_bool converters_chosen = SDL_FALSE;
if (converters_chosen) {
return;
}
#define SET_CONVERTER_FUNCS(fntype) \
SDL_Convert_S8_to_F32 = SDL_Convert_S8_to_F32_##fntype; \
SDL_Convert_U8_to_F32 = SDL_Convert_U8_to_F32_##fntype; \
SDL_Convert_S16_to_F32 = SDL_Convert_S16_to_F32_##fntype; \
SDL_Convert_U16_to_F32 = SDL_Convert_U16_to_F32_##fntype; \
SDL_Convert_S32_to_F32 = SDL_Convert_S32_to_F32_##fntype; \
SDL_Convert_F32_to_S8 = SDL_Convert_F32_to_S8_##fntype; \
SDL_Convert_F32_to_U8 = SDL_Convert_F32_to_U8_##fntype; \
SDL_Convert_F32_to_S16 = SDL_Convert_F32_to_S16_##fntype; \
SDL_Convert_F32_to_U16 = SDL_Convert_F32_to_U16_##fntype; \
SDL_Convert_F32_to_S32 = SDL_Convert_F32_to_S32_##fntype; \
converters_chosen = SDL_TRUE
#if HAVE_SSE2_INTRINSICS
if (SDL_HasSSE2()) {
SET_CONVERTER_FUNCS(SSE2);
return;
}
#endif
#if NEED_SCALAR_CONVERTER_FALLBACKS
SET_CONVERTER_FUNCS(Scalar);
#endif
#undef SET_CONVERTER_FUNCS
SDL_assert(converters_chosen == SDL_TRUE);
}
SDL_TRUE
Definition: SDL_stdinc.h:142
SDL_FALSE
Definition: SDL_stdinc.h:141
SDL_assert
#define SDL_assert(condition)
Definition: SDL_assert.h:169
SDL_bool
SDL_bool
Definition: SDL_stdinc.h:139
SDL_HasSSE2
#define SDL_HasSSE2
Definition: SDL_dynapi_overrides.h:108
SET_CONVERTER_FUNCS
#define SET_CONVERTER_FUNCS(fntype)

## SDL_Convert_F32_to_S16_Scalar()

static void SDL_Convert_F32_to_S16_Scalar | ( | SDL_AudioCVT * | cvt,
|  | SDL_AudioFormat | format
| ) |  |

static

Definition at line 216 of file SDL_audiotypecvt.c.

References AUDIO_S16SYS, SDL_AudioCVT::buf, SDL_AudioCVT::filter_index, SDL_AudioCVT::filters, i, SDL_AudioCVT::len_cvt, LOG_DEBUG_CONVERT, and SDLCALL.

{
const float *src = (const float *) cvt->buf;
Sint16 *dst = (Sint16 *) cvt->buf;
int i;
LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S16");
for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
const float sample = *src;
if (sample > 1.0f) {
*dst = 32767;
} else if (sample < -1.0f) {
*dst = -32767;
} else {
*dst = (Sint16)(sample * 32767.0f);
}
}
cvt->len_cvt /= 2;
if (cvt->filters[++cvt->filter_index]) {
cvt->filters[cvt->filter_index](cvt, AUDIO_S16SYS);
}
}
LOG_DEBUG_CONVERT
#define LOG_DEBUG_CONVERT(from, to)
Definition: SDL_audio_c.h:34
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
SDL_AudioCVT::buf
Uint8 * buf
Definition: SDL_audio.h:231
SDL_AudioCVT::filter_index
int filter_index
Definition: SDL_audio.h:237
f
GLfloat f
Definition: SDL_opengl_glext.h:1870
src
GLenum src
Definition: SDL_opengl_glext.h:1737
AUDIO_S16SYS
#define AUDIO_S16SYS
Definition: SDL_audio.h:123
SDL_AudioCVT::filters
SDL_AudioFilter filters[SDL_AUDIOCVT_MAX_FILTERS+1]
Definition: SDL_audio.h:236
i
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:50
SDL_AudioCVT::len_cvt
int len_cvt
Definition: SDL_audio.h:233
Sint16
int16_t Sint16
Definition: SDL_stdinc.h:163

## SDL_Convert_F32_to_S32_Scalar()

static void SDL_Convert_F32_to_S32_Scalar | ( | SDL_AudioCVT * | cvt,
|  | SDL_AudioFormat | format
| ) |  |

static

Definition at line 268 of file SDL_audiotypecvt.c.

References AUDIO_F32SYS, AUDIO_S16SYS, AUDIO_S32SYS, AUDIO_S8, AUDIO_U16SYS, AUDIO_U8, SDL_AudioCVT::buf, DIVBY128, DIVBY2147483648, DIVBY32768, SDL_AudioCVT::filter_index, SDL_AudioCVT::filters, i, SDL_AudioCVT::len_cvt, LOG_DEBUG_CONVERT, SDL_assert, SDLCALL, and zero.

{
const float *src = (const float *) cvt->buf;
Sint32 *dst = (Sint32 *) cvt->buf;
int i;
LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S32");
for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
const float sample = *src;
if (sample > 1.0f) {
*dst = 2147483647;
} else if (sample < -1.0f) {
*dst = -2147483647;
} else {
*dst = (Sint32)((double)sample * 2147483647.0);
}
}
if (cvt->filters[++cvt->filter_index]) {
cvt->filters[cvt->filter_index](cvt, AUDIO_S32SYS);
}
}
LOG_DEBUG_CONVERT
#define LOG_DEBUG_CONVERT(from, to)
Definition: SDL_audio_c.h:34
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
SDL_AudioCVT::buf
Uint8 * buf
Definition: SDL_audio.h:231
SDL_AudioCVT::filter_index
int filter_index
Definition: SDL_audio.h:237
f
GLfloat f
Definition: SDL_opengl_glext.h:1870
src
GLenum src
Definition: SDL_opengl_glext.h:1737
SDL_AudioCVT::filters
SDL_AudioFilter filters[SDL_AUDIOCVT_MAX_FILTERS+1]
Definition: SDL_audio.h:236
Sint32
int32_t Sint32
Definition: SDL_stdinc.h:175
i
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:50
SDL_AudioCVT::len_cvt
int len_cvt
Definition: SDL_audio.h:233
AUDIO_S32SYS
#define AUDIO_S32SYS
Definition: SDL_audio.h:124

## SDL_Convert_F32_to_S8_Scalar()

static void SDL_Convert_F32_to_S8_Scalar | ( | SDL_AudioCVT * | cvt,
|  | SDL_AudioFormat | format
| ) |  |

static

Definition at line 164 of file SDL_audiotypecvt.c.

References AUDIO_S8, SDL_AudioCVT::buf, SDL_AudioCVT::filter_index, SDL_AudioCVT::filters, i, SDL_AudioCVT::len_cvt, LOG_DEBUG_CONVERT, and SDLCALL.

{
const float *src = (const float *) cvt->buf;
Sint8 *dst = (Sint8 *) cvt->buf;
int i;
LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S8");
for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
const float sample = *src;
if (sample > 1.0f) {
*dst = 127;
} else if (sample < -1.0f) {
*dst = -127;
} else {
*dst = (Sint8)(sample * 127.0f);
}
}
cvt->len_cvt /= 4;
if (cvt->filters[++cvt->filter_index]) {
cvt->filters[cvt->filter_index](cvt, AUDIO_S8);
}
}
LOG_DEBUG_CONVERT
#define LOG_DEBUG_CONVERT(from, to)
Definition: SDL_audio_c.h:34
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
SDL_AudioCVT::buf
Uint8 * buf
Definition: SDL_audio.h:231
SDL_AudioCVT::filter_index
int filter_index
Definition: SDL_audio.h:237
f
GLfloat f
Definition: SDL_opengl_glext.h:1870
src
GLenum src
Definition: SDL_opengl_glext.h:1737
SDL_AudioCVT::filters
SDL_AudioFilter filters[SDL_AUDIOCVT_MAX_FILTERS+1]
Definition: SDL_audio.h:236
Sint8
int8_t Sint8
Definition: SDL_stdinc.h:151
i
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:50
SDL_AudioCVT::len_cvt
int len_cvt
Definition: SDL_audio.h:233
AUDIO_S8
#define AUDIO_S8
Definition: SDL_audio.h:90

## SDL_Convert_F32_to_U16_Scalar()

static void SDL_Convert_F32_to_U16_Scalar | ( | SDL_AudioCVT * | cvt,
|  | SDL_AudioFormat | format
| ) |  |

static

Definition at line 242 of file SDL_audiotypecvt.c.

References AUDIO_U16SYS, SDL_AudioCVT::buf, SDL_AudioCVT::filter_index, SDL_AudioCVT::filters, i, SDL_AudioCVT::len_cvt, LOG_DEBUG_CONVERT, and SDLCALL.

{
const float *src = (const float *) cvt->buf;
Uint16 *dst = (Uint16 *) cvt->buf;
int i;
LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_U16");
for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
const float sample = *src;
if (sample > 1.0f) {
*dst = 65534;
} else if (sample < -1.0f) {
*dst = 0;
} else {
*dst = (Uint16)((sample + 1.0f) * 32767.0f);
}
}
cvt->len_cvt /= 2;
if (cvt->filters[++cvt->filter_index]) {
cvt->filters[cvt->filter_index](cvt, AUDIO_U16SYS);
}
}
LOG_DEBUG_CONVERT
#define LOG_DEBUG_CONVERT(from, to)
Definition: SDL_audio_c.h:34
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
SDL_AudioCVT::buf
Uint8 * buf
Definition: SDL_audio.h:231
SDL_AudioCVT::filter_index
int filter_index
Definition: SDL_audio.h:237
f
GLfloat f
Definition: SDL_opengl_glext.h:1870
src
GLenum src
Definition: SDL_opengl_glext.h:1737
SDL_AudioCVT::filters
SDL_AudioFilter filters[SDL_AUDIOCVT_MAX_FILTERS+1]
Definition: SDL_audio.h:236
i
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:50
SDL_AudioCVT::len_cvt
int len_cvt
Definition: SDL_audio.h:233
Uint16
uint16_t Uint16
Definition: SDL_stdinc.h:169
AUDIO_U16SYS
#define AUDIO_U16SYS
Definition: SDL_audio.h:122

## SDL_Convert_F32_to_U8_Scalar()

static void SDL_Convert_F32_to_U8_Scalar | ( | SDL_AudioCVT * | cvt,
|  | SDL_AudioFormat | format
| ) |  |

static

Definition at line 190 of file SDL_audiotypecvt.c.

References AUDIO_U8, SDL_AudioCVT::buf, SDL_AudioCVT::filter_index, SDL_AudioCVT::filters, i, SDL_AudioCVT::len_cvt, LOG_DEBUG_CONVERT, and SDLCALL.

{
const float *src = (const float *) cvt->buf;
Uint8 *dst = (Uint8 *) cvt->buf;
int i;
LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_U8");
for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
const float sample = *src;
if (sample > 1.0f) {
*dst = 255;
} else if (sample < -1.0f) {
*dst = 0;
} else {
*dst = (Uint8)((sample + 1.0f) * 127.0f);
}
}
cvt->len_cvt /= 4;
if (cvt->filters[++cvt->filter_index]) {
cvt->filters[cvt->filter_index](cvt, AUDIO_U8);
}
}
LOG_DEBUG_CONVERT
#define LOG_DEBUG_CONVERT(from, to)
Definition: SDL_audio_c.h:34
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
SDL_AudioCVT::buf
Uint8 * buf
Definition: SDL_audio.h:231
SDL_AudioCVT::filter_index
int filter_index
Definition: SDL_audio.h:237
f
GLfloat f
Definition: SDL_opengl_glext.h:1870
src
GLenum src
Definition: SDL_opengl_glext.h:1737
AUDIO_U8
#define AUDIO_U8
Definition: SDL_audio.h:89
SDL_AudioCVT::filters
SDL_AudioFilter filters[SDL_AUDIOCVT_MAX_FILTERS+1]
Definition: SDL_audio.h:236
Uint8
uint8_t Uint8
Definition: SDL_stdinc.h:157
i
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:50
SDL_AudioCVT::len_cvt
int len_cvt
Definition: SDL_audio.h:233

## SDL_Convert_S16_to_F32_Scalar()

static void SDL_Convert_S16_to_F32_Scalar | ( | SDL_AudioCVT * | cvt,
|  | SDL_AudioFormat | format
| ) |  |

static

Definition at line 108 of file SDL_audiotypecvt.c.

References AUDIO_F32SYS, SDL_AudioCVT::buf, DIVBY32768, SDL_AudioCVT::filter_index, SDL_AudioCVT::filters, i, SDL_AudioCVT::len_cvt, LOG_DEBUG_CONVERT, and SDLCALL.

{
const Sint16 *src = ((const Sint16 *) (cvt->buf + cvt->len_cvt)) - 1;
float *dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
int i;
LOG_DEBUG_CONVERT("AUDIO_S16", "AUDIO_F32");
for (i = cvt->len_cvt / sizeof (Sint16); i; --i, --src, --dst) {
*dst = ((float) *src) * DIVBY32768;
}
cvt->len_cvt *= 2;
if (cvt->filters[++cvt->filter_index]) {
cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS);
}
}
LOG_DEBUG_CONVERT
#define LOG_DEBUG_CONVERT(from, to)
Definition: SDL_audio_c.h:34
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
SDL_AudioCVT::buf
Uint8 * buf
Definition: SDL_audio.h:231
SDL_AudioCVT::filter_index
int filter_index
Definition: SDL_audio.h:237
src
GLenum src
Definition: SDL_opengl_glext.h:1737
SDL_AudioCVT::filters
SDL_AudioFilter filters[SDL_AUDIOCVT_MAX_FILTERS+1]
Definition: SDL_audio.h:236
AUDIO_F32SYS
#define AUDIO_F32SYS
Definition: SDL_audio.h:125
i
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:50
SDL_AudioCVT::len_cvt
int len_cvt
Definition: SDL_audio.h:233
DIVBY32768
#define DIVBY32768
Definition: SDL_audiotypecvt.c:64
Sint16
int16_t Sint16
Definition: SDL_stdinc.h:163

## SDL_Convert_S32_to_F32_Scalar()

static void SDL_Convert_S32_to_F32_Scalar | ( | SDL_AudioCVT * | cvt,
|  | SDL_AudioFormat | format
| ) |  |

static

Definition at line 146 of file SDL_audiotypecvt.c.

References AUDIO_F32SYS, SDL_AudioCVT::buf, DIVBY2147483648, SDL_AudioCVT::filter_index, SDL_AudioCVT::filters, i, SDL_AudioCVT::len_cvt, LOG_DEBUG_CONVERT, and SDLCALL.

{
const Sint32 *src = (const Sint32 *) cvt->buf;
float *dst = (float *) cvt->buf;
int i;
LOG_DEBUG_CONVERT("AUDIO_S32", "AUDIO_F32");
for (i = cvt->len_cvt / sizeof (Sint32); i; --i, ++src, ++dst) {
*dst = (float) (((double) *src) * DIVBY2147483648);
}
if (cvt->filters[++cvt->filter_index]) {
cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS);
}
}
LOG_DEBUG_CONVERT
#define LOG_DEBUG_CONVERT(from, to)
Definition: SDL_audio_c.h:34
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
SDL_AudioCVT::buf
Uint8 * buf
Definition: SDL_audio.h:231
SDL_AudioCVT::filter_index
int filter_index
Definition: SDL_audio.h:237
src
GLenum src
Definition: SDL_opengl_glext.h:1737
SDL_AudioCVT::filters
SDL_AudioFilter filters[SDL_AUDIOCVT_MAX_FILTERS+1]
Definition: SDL_audio.h:236
AUDIO_F32SYS
#define AUDIO_F32SYS
Definition: SDL_audio.h:125
Sint32
int32_t Sint32
Definition: SDL_stdinc.h:175
i
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:50
SDL_AudioCVT::len_cvt
int len_cvt
Definition: SDL_audio.h:233
DIVBY2147483648
#define DIVBY2147483648
Definition: SDL_audiotypecvt.c:65

## SDL_Convert_S8_to_F32_Scalar()

static void SDL_Convert_S8_to_F32_Scalar | ( | SDL_AudioCVT * | cvt,
|  | SDL_AudioFormat | format
| ) |  |

static

Definition at line 70 of file SDL_audiotypecvt.c.

References AUDIO_F32SYS, SDL_AudioCVT::buf, DIVBY128, SDL_AudioCVT::filter_index, SDL_AudioCVT::filters, i, SDL_AudioCVT::len_cvt, LOG_DEBUG_CONVERT, and SDLCALL.

{
const Sint8 *src = ((const Sint8 *) (cvt->buf + cvt->len_cvt)) - 1;
float *dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1;
int i;
LOG_DEBUG_CONVERT("AUDIO_S8", "AUDIO_F32");
for (i = cvt->len_cvt; i; --i, --src, --dst) {
*dst = ((float) *src) * DIVBY128;
}
cvt->len_cvt *= 4;
if (cvt->filters[++cvt->filter_index]) {
cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS);
}
}
LOG_DEBUG_CONVERT
#define LOG_DEBUG_CONVERT(from, to)
Definition: SDL_audio_c.h:34
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
SDL_AudioCVT::buf
Uint8 * buf
Definition: SDL_audio.h:231
SDL_AudioCVT::filter_index
int filter_index
Definition: SDL_audio.h:237
src
GLenum src
Definition: SDL_opengl_glext.h:1737
SDL_AudioCVT::filters
SDL_AudioFilter filters[SDL_AUDIOCVT_MAX_FILTERS+1]
Definition: SDL_audio.h:236
AUDIO_F32SYS
#define AUDIO_F32SYS
Definition: SDL_audio.h:125
Sint8
int8_t Sint8
Definition: SDL_stdinc.h:151
i
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:50
SDL_AudioCVT::len_cvt
int len_cvt
Definition: SDL_audio.h:233
DIVBY128
#define DIVBY128
Definition: SDL_audiotypecvt.c:63

## SDL_Convert_U16_to_F32_Scalar()

static void SDL_Convert_U16_to_F32_Scalar | ( | SDL_AudioCVT * | cvt,
|  | SDL_AudioFormat | format
| ) |  |

static

Definition at line 127 of file SDL_audiotypecvt.c.

References AUDIO_F32SYS, SDL_AudioCVT::buf, DIVBY32768, SDL_AudioCVT::filter_index, SDL_AudioCVT::filters, i, SDL_AudioCVT::len_cvt, LOG_DEBUG_CONVERT, and SDLCALL.

{
const Uint16 *src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1;
float *dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1;
int i;
LOG_DEBUG_CONVERT("AUDIO_U16", "AUDIO_F32");
for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
*dst = (((float) *src) * DIVBY32768) - 1.0f;
}
cvt->len_cvt *= 2;
if (cvt->filters[++cvt->filter_index]) {
cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS);
}
}
LOG_DEBUG_CONVERT
#define LOG_DEBUG_CONVERT(from, to)
Definition: SDL_audio_c.h:34
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
SDL_AudioCVT::buf
Uint8 * buf
Definition: SDL_audio.h:231
SDL_AudioCVT::filter_index
int filter_index
Definition: SDL_audio.h:237
f
GLfloat f
Definition: SDL_opengl_glext.h:1870
src
GLenum src
Definition: SDL_opengl_glext.h:1737
SDL_AudioCVT::filters
SDL_AudioFilter filters[SDL_AUDIOCVT_MAX_FILTERS+1]
Definition: SDL_audio.h:236
AUDIO_F32SYS
#define AUDIO_F32SYS
Definition: SDL_audio.h:125
i
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:50
SDL_AudioCVT::len_cvt
int len_cvt
Definition: SDL_audio.h:233
Uint16
uint16_t Uint16
Definition: SDL_stdinc.h:169
DIVBY32768
#define DIVBY32768
Definition: SDL_audiotypecvt.c:64

## SDL_Convert_U8_to_F32_Scalar()

static void SDL_Convert_U8_to_F32_Scalar | ( | SDL_AudioCVT * | cvt,
|  | SDL_AudioFormat | format
| ) |  |

static

Definition at line 89 of file SDL_audiotypecvt.c.

References AUDIO_F32SYS, SDL_AudioCVT::buf, DIVBY128, SDL_AudioCVT::filter_index, SDL_AudioCVT::filters, i, SDL_AudioCVT::len_cvt, LOG_DEBUG_CONVERT, and SDLCALL.

{
const Uint8 *src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1;
float *dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1;
int i;
LOG_DEBUG_CONVERT("AUDIO_U8", "AUDIO_F32");
for (i = cvt->len_cvt; i; --i, --src, --dst) {
*dst = (((float) *src) * DIVBY128) - 1.0f;
}
cvt->len_cvt *= 4;
if (cvt->filters[++cvt->filter_index]) {
cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS);
}
}
LOG_DEBUG_CONVERT
#define LOG_DEBUG_CONVERT(from, to)
Definition: SDL_audio_c.h:34
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
SDL_AudioCVT::buf
Uint8 * buf
Definition: SDL_audio.h:231
SDL_AudioCVT::filter_index
int filter_index
Definition: SDL_audio.h:237
f
GLfloat f
Definition: SDL_opengl_glext.h:1870
src
GLenum src
Definition: SDL_opengl_glext.h:1737
SDL_AudioCVT::filters
SDL_AudioFilter filters[SDL_AUDIOCVT_MAX_FILTERS+1]
Definition: SDL_audio.h:236
AUDIO_F32SYS
#define AUDIO_F32SYS
Definition: SDL_audio.h:125
Uint8
uint8_t Uint8
Definition: SDL_stdinc.h:157
i
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:50
SDL_AudioCVT::len_cvt
int len_cvt
Definition: SDL_audio.h:233
DIVBY128
#define DIVBY128
Definition: SDL_audiotypecvt.c:63

## Variable Documentation

## SDL_Convert_F32_to_S16

SDL_AudioFilter SDL_Convert_F32_to_S16 = NULL

Definition at line 58 of file SDL_audiotypecvt.c.

Referenced by SDL_BuildAudioTypeCVTFromFloat().

## SDL_Convert_F32_to_S32

SDL_AudioFilter SDL_Convert_F32_to_S32 = NULL

Definition at line 60 of file SDL_audiotypecvt.c.

Referenced by SDL_BuildAudioTypeCVTFromFloat().

## SDL_Convert_F32_to_S8

SDL_AudioFilter SDL_Convert_F32_to_S8 = NULL

Definition at line 56 of file SDL_audiotypecvt.c.

Referenced by SDL_BuildAudioTypeCVTFromFloat().

## SDL_Convert_F32_to_U16

SDL_AudioFilter SDL_Convert_F32_to_U16 = NULL

Definition at line 59 of file SDL_audiotypecvt.c.

Referenced by SDL_BuildAudioTypeCVTFromFloat().

## SDL_Convert_F32_to_U8

SDL_AudioFilter SDL_Convert_F32_to_U8 = NULL

Definition at line 57 of file SDL_audiotypecvt.c.

Referenced by SDL_BuildAudioTypeCVTFromFloat().

## SDL_Convert_S16_to_F32

SDL_AudioFilter SDL_Convert_S16_to_F32 = NULL

Definition at line 53 of file SDL_audiotypecvt.c.

Referenced by SDL_BuildAudioTypeCVTToFloat().

## SDL_Convert_S32_to_F32

SDL_AudioFilter SDL_Convert_S32_to_F32 = NULL

Definition at line 55 of file SDL_audiotypecvt.c.

Referenced by SDL_BuildAudioTypeCVTToFloat().

## SDL_Convert_S8_to_F32

SDL_AudioFilter SDL_Convert_S8_to_F32 = NULL

Definition at line 51 of file SDL_audiotypecvt.c.

Referenced by SDL_BuildAudioTypeCVTToFloat().

## SDL_Convert_U16_to_F32

SDL_AudioFilter SDL_Convert_U16_to_F32 = NULL

Definition at line 54 of file SDL_audiotypecvt.c.

Referenced by SDL_BuildAudioTypeCVTToFloat().

## SDL_Convert_U8_to_F32

SDL_AudioFilter SDL_Convert_U8_to_F32 = NULL

Definition at line 52 of file SDL_audiotypecvt.c.

Referenced by SDL_BuildAudioTypeCVTToFloat().