SDL
2.0
|
Go to the source code of this file.
Data Structures | |
struct | MS_ADPCM_decodestate |
struct | MS_ADPCM_decoder |
struct | IMA_ADPCM_decodestate |
struct | IMA_ADPCM_decoder |
Functions | |
static int | ReadChunk (SDL_RWops *src, Chunk *chunk) |
static int | InitMS_ADPCM (WaveFMT *format, int length) |
static Sint32 | MS_ADPCM_nibble (struct MS_ADPCM_decodestate *state, Uint8 nybble, Sint16 *coeff) |
static int | MS_ADPCM_decode (Uint8 **audio_buf, Uint32 *audio_len) |
static int | InitIMA_ADPCM (WaveFMT *format, int length) |
static Sint32 | IMA_ADPCM_nibble (struct IMA_ADPCM_decodestate *state, Uint8 nybble) |
static void | Fill_IMA_ADPCM_block (Uint8 *decoded, Uint8 *encoded, int channel, int numchannels, struct IMA_ADPCM_decodestate *state) |
static int | IMA_ADPCM_decode (Uint8 **audio_buf, Uint32 *audio_len) |
static int | ConvertSint24ToSint32 (Uint8 **audio_buf, Uint32 *audio_len) |
SDL_AudioSpec * | SDL_LoadWAV_RW (SDL_RWops *src, int freesrc, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len) |
void | SDL_FreeWAV (Uint8 *audio_buf) |
Variables | |
static struct MS_ADPCM_decoder | MS_ADPCM_state |
static struct IMA_ADPCM_decoder | IMA_ADPCM_state |
static const Uint8 | extensible_pcm_guid [16] = { 1, 0, 0, 0, 0, 0, 16, 0, 128, 0, 0, 170, 0, 56, 155, 113 } |
static const Uint8 | extensible_ieee_guid [16] = { 3, 0, 0, 0, 0, 0, 16, 0, 128, 0, 0, 170, 0, 56, 155, 113 } |
Definition at line 419 of file SDL_wave.c.
References i, SDL_OutOfMemory, and SDL_realloc.
Referenced by SDL_LoadWAV_RW().
|
static |
Definition at line 320 of file SDL_wave.c.
References i, and IMA_ADPCM_nibble().
Referenced by IMA_ADPCM_decode().
Definition at line 349 of file SDL_wave.c.
References WaveFMT::blockalign, WaveFMT::channels, Fill_IMA_ADPCM_block(), IMA_ADPCM_state, IMA_ADPCM_decodestate::index, NULL, IMA_ADPCM_decodestate::sample, SDL_arraysize, SDL_free, SDL_malloc, SDL_OutOfMemory, SDL_SetError, state, IMA_ADPCM_decoder::state, IMA_ADPCM_decoder::wavefmt, and IMA_ADPCM_decoder::wSamplesPerBlock.
Referenced by SDL_LoadWAV_RW().
|
static |
Definition at line 265 of file SDL_wave.c.
References IMA_ADPCM_decodestate::index, and IMA_ADPCM_decodestate::sample.
Referenced by Fill_IMA_ADPCM_block().
|
static |
Definition at line 238 of file SDL_wave.c.
References WaveFMT::bitspersample, WaveFMT::blockalign, WaveFMT::byterate, WaveFMT::channels, WaveFMT::encoding, WaveFMT::frequency, IMA_ADPCM_state, SDL_SetError, SDL_SwapLE16, SDL_SwapLE32, IMA_ADPCM_decoder::wavefmt, and IMA_ADPCM_decoder::wSamplesPerBlock.
Referenced by SDL_LoadWAV_RW().
|
static |
Definition at line 48 of file SDL_wave.c.
References MS_ADPCM_decoder::aCoeff, WaveFMT::bitspersample, WaveFMT::blockalign, WaveFMT::byterate, WaveFMT::channels, WaveFMT::encoding, WaveFMT::frequency, i, MS_ADPCM_state, SDL_SetError, SDL_SwapLE16, SDL_SwapLE32, MS_ADPCM_decoder::wavefmt, MS_ADPCM_decoder::wNumCoef, and MS_ADPCM_decoder::wSamplesPerBlock.
Referenced by SDL_LoadWAV_RW().
Definition at line 125 of file SDL_wave.c.
References MS_ADPCM_decoder::aCoeff, WaveFMT::blockalign, WaveFMT::channels, MS_ADPCM_decodestate::hPredictor, MS_ADPCM_decodestate::iDelta, MS_ADPCM_decodestate::iSamp1, MS_ADPCM_decodestate::iSamp2, MS_ADPCM_nibble(), MS_ADPCM_state, NULL, SDL_free, SDL_malloc, SDL_OutOfMemory, MS_ADPCM_decoder::state, state, MS_ADPCM_decoder::wavefmt, and MS_ADPCM_decoder::wSamplesPerBlock.
Referenced by SDL_LoadWAV_RW().
|
static |
Definition at line 91 of file SDL_wave.c.
References MS_ADPCM_decodestate::iDelta, MS_ADPCM_decodestate::iSamp1, and MS_ADPCM_decodestate::iSamp2.
Referenced by MS_ADPCM_decode().
Definition at line 689 of file SDL_wave.c.
References Chunk::data, Chunk::length, Chunk::magic, NULL, SDL_EFREAD, SDL_Error, SDL_free, SDL_malloc, SDL_OutOfMemory, SDL_ReadLE32, and SDL_RWread.
Referenced by SDL_LoadWAV_RW().
This function frees data previously allocated with SDL_LoadWAV_RW()
Definition at line 683 of file SDL_wave.c.
References SDL_free.
SDL_AudioSpec* SDL_LoadWAV_RW | ( | SDL_RWops * | src, |
int | freesrc, | ||
SDL_AudioSpec * | spec, | ||
Uint8 ** | audio_buf, | ||
Uint32 * | audio_len | ||
) |
This function loads a WAVE from the data source, automatically freeing that source if freesrc
is non-zero. For example, to load a WAVE file, you could do:
If this function succeeds, it returns the given SDL_AudioSpec, filled with the audio data format of the wave data, and sets *audio_buf
to a malloc()'d buffer containing the audio data, and sets *audio_len
to the length of that audio buffer, in bytes. You need to free the audio buffer with SDL_FreeWAV() when you are done with it.
This function returns NULL and sets the SDL error message if the wave file cannot be opened, uses an unknown data format, or is corrupt. Currently raw and MS-ADPCM WAVE files are supported.
Definition at line 459 of file SDL_wave.c.
References AUDIO_F32, AUDIO_S16, AUDIO_S32, AUDIO_U8, BEXT, WaveFMT::bitspersample, WaveFMT::channels, SDL_AudioSpec::channels, ConvertSint24ToSint32(), DATA, Chunk::data, done, WaveFMT::encoding, EXTENSIBLE_CODE, extensible_ieee_guid, extensible_pcm_guid, FACT, FMT, SDL_AudioSpec::format, SDL_AudioSpec::freq, WaveFMT::frequency, IEEE_FLOAT_CODE, IMA_ADPCM_CODE, IMA_ADPCM_decode(), InitIMA_ADPCM(), InitMS_ADPCM(), JUNK, Chunk::length, LIST, Chunk::magic, MP3_CODE, MS_ADPCM_CODE, MS_ADPCM_decode(), NULL, PCM_CODE, ReadChunk(), RIFF, RW_SEEK_CUR, SDL_AudioSpec::samples, SDL_AUDIO_BITSIZE, SDL_free, SDL_memcmp, SDL_ReadLE32, SDL_RWclose, SDL_RWseek, SDL_SetError, SDL_SwapLE16, SDL_SwapLE32, SDL_zero, SDL_zerop, WaveExtensibleFMT::size, WaveExtensibleFMT::subformat, and WAVE.
|
static |
Definition at line 456 of file SDL_wave.c.
Referenced by SDL_LoadWAV_RW().
|
static |
Definition at line 455 of file SDL_wave.c.
Referenced by SDL_LoadWAV_RW().
|
static |
Referenced by IMA_ADPCM_decode(), and InitIMA_ADPCM().
|
static |
Referenced by InitMS_ADPCM(), and MS_ADPCM_decode().