src/audio/SDL_wave.h
branchSDL-1.3
changeset 1662 782fd950bd46
parent 1659 14717b52abc0
child 1994 6abc7e6f9817
equal deleted inserted replaced
1661:281d3f4870e5 1662:782fd950bd46
    24 /* WAVE files are little-endian */
    24 /* WAVE files are little-endian */
    25 
    25 
    26 /*******************************************/
    26 /*******************************************/
    27 /* Define values for Microsoft WAVE format */
    27 /* Define values for Microsoft WAVE format */
    28 /*******************************************/
    28 /*******************************************/
    29 #define RIFF		0x46464952		/* "RIFF" */
    29 #define RIFF		0x46464952      /* "RIFF" */
    30 #define WAVE		0x45564157		/* "WAVE" */
    30 #define WAVE		0x45564157      /* "WAVE" */
    31 #define FACT		0x74636166		/* "fact" */
    31 #define FACT		0x74636166      /* "fact" */
    32 #define LIST		0x5453494c		/* "LIST" */
    32 #define LIST		0x5453494c      /* "LIST" */
    33 #define FMT		0x20746D66		/* "fmt " */
    33 #define FMT		0x20746D66      /* "fmt " */
    34 #define DATA		0x61746164		/* "data" */
    34 #define DATA		0x61746164      /* "data" */
    35 #define PCM_CODE	0x0001
    35 #define PCM_CODE	0x0001
    36 #define MS_ADPCM_CODE	0x0002
    36 #define MS_ADPCM_CODE	0x0002
    37 #define IMA_ADPCM_CODE	0x0011
    37 #define IMA_ADPCM_CODE	0x0011
    38 #define MP3_CODE	0x0055
    38 #define MP3_CODE	0x0055
    39 #define WAVE_MONO	1
    39 #define WAVE_MONO	1
    40 #define WAVE_STEREO	2
    40 #define WAVE_STEREO	2
    41 
    41 
    42 /* Normally, these three chunks come consecutively in a WAVE file */
    42 /* Normally, these three chunks come consecutively in a WAVE file */
    43 typedef struct WaveFMT {
    43 typedef struct WaveFMT
       
    44 {
    44 /* Not saved in the chunk we read:
    45 /* Not saved in the chunk we read:
    45 	Uint32	FMTchunk;
    46 	Uint32	FMTchunk;
    46 	Uint32	fmtlen;
    47 	Uint32	fmtlen;
    47 */
    48 */
    48 	Uint16	encoding;	
    49     Uint16 encoding;
    49 	Uint16	channels;		/* 1 = mono, 2 = stereo */
    50     Uint16 channels;            /* 1 = mono, 2 = stereo */
    50 	Uint32	frequency;		/* One of 11025, 22050, or 44100 Hz */
    51     Uint32 frequency;           /* One of 11025, 22050, or 44100 Hz */
    51 	Uint32	byterate;		/* Average bytes per second */
    52     Uint32 byterate;            /* Average bytes per second */
    52 	Uint16	blockalign;		/* Bytes per sample block */
    53     Uint16 blockalign;          /* Bytes per sample block */
    53 	Uint16	bitspersample;		/* One of 8, 12, 16, or 4 for ADPCM */
    54     Uint16 bitspersample;       /* One of 8, 12, 16, or 4 for ADPCM */
    54 } WaveFMT;
    55 } WaveFMT;
    55 
    56 
    56 /* The general chunk found in the WAVE file */
    57 /* The general chunk found in the WAVE file */
    57 typedef struct Chunk {
    58 typedef struct Chunk
    58 	Uint32 magic;
    59 {
    59 	Uint32 length;
    60     Uint32 magic;
    60 	Uint8 *data;
    61     Uint32 length;
       
    62     Uint8 *data;
    61 } Chunk;
    63 } Chunk;
    62 
    64 /* vi: set ts=4 sw=4 expandtab: */