SDL_wave.h
Go to the documentation of this file.
/*
Simple DirectMedia Layer
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "../SDL_internal.h"
/* WAVE files are little-endian */
/*******************************************/
/* Define values for Microsoft WAVE format */
/*******************************************/
#define RIFF 0x46464952 /* "RIFF" */
#define WAVE 0x45564157 /* "WAVE" */
#define FACT 0x74636166 /* "fact" */
#define LIST 0x5453494c /* "LIST" */
#define BEXT 0x74786562 /* "bext" */
#define JUNK 0x4B4E554A /* "JUNK" */
#define FMT 0x20746D66 /* "fmt " */
#define DATA 0x61746164 /* "data" */
#define PCM_CODE 0x0001
#define MS_ADPCM_CODE 0x0002
#define IEEE_FLOAT_CODE 0x0003
#define IMA_ADPCM_CODE 0x0011
#define MP3_CODE 0x0055
#define WAVE_MONO 1
#define WAVE_STEREO 2
/* Normally, these three chunks come consecutively in a WAVE file */
typedef struct WaveFMT
{
/* Not saved in the chunk we read:
Uint32 FMTchunk;
Uint32 fmtlen;
*/
Uint16 encoding;
Uint16 channels; /* 1 = mono, 2 = stereo */
Uint32 frequency; /* One of 11025, 22050, or 44100 Hz */
Uint32 byterate; /* Average bytes per second */
Uint16 blockalign; /* Bytes per sample block */
Uint16 bitspersample; /* One of 8, 12, 16, or 4 for ADPCM */
} WaveFMT;
/* The general chunk found in the WAVE file */
typedef struct Chunk
{
Uint32 magic;
Uint32 length;
Uint8 *data;
} Chunk;
/* vi: set ts=4 sw=4 expandtab: */
Uint32
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:157
WaveFMT
Definition: SDL_wave.h:45
WaveFMT::blockalign
Uint16 blockalign
Definition: SDL_wave.h:55
Chunk
Definition: SDL_wave.h:60
Chunk::length
Uint32 length
Definition: SDL_wave.h:63
WaveFMT::encoding
Uint16 encoding
Definition: SDL_wave.h:51
WaveFMT::channels
Uint16 channels
Definition: SDL_wave.h:52
Uint8
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:139
Chunk::data
Uint8 * data
Definition: SDL_wave.h:64
Chunk::magic
Uint32 magic
Definition: SDL_wave.h:62
Uint16
uint16_t Uint16
An unsigned 16-bit integer type.
Definition: SDL_stdinc.h:147
WaveFMT::frequency
Uint32 frequency
Definition: SDL_wave.h:53
WaveFMT::bitspersample
Uint16 bitspersample
Definition: SDL_wave.h:56
WaveFMT::byterate
Uint32 byterate
Definition: SDL_wave.h:54