wave.h
author Stephane Peter
Sat, 30 Oct 1999 22:57:49 +0000
changeset 11 3939a99bf422
parent 0 4ce2db4db959
permissions -rw-r--r--
Various bugfixes for music looping
     1 /*
     2     Taken with permission from SDL_wave.h, part of the SDL library,
     3     available at: http://www.devolution.com/~slouken/SDL 
     4     and placed under the same license as this mixer library.
     5 */
     6 
     7 /* WAVE files are little-endian */
     8 
     9 /*******************************************/
    10 /* Define values for Microsoft WAVE format */
    11 /*******************************************/
    12 #define RIFF		0x46464952		/* "RIFF" */
    13 #define WAVE		0x45564157		/* "WAVE" */
    14 #define FACT		0x74636166		/* "fact" */
    15 #define LIST		0x5453494c		/* "LIST" */
    16 #define FMT		0x20746D66		/* "fmt " */
    17 #define DATA		0x61746164		/* "data" */
    18 #define PCM_CODE	1
    19 #define ADPCM_CODE	2
    20 #define WAVE_MONO	1
    21 #define WAVE_STEREO	2
    22 
    23 /* Normally, these three chunks come consecutively in a WAVE file */
    24 typedef struct WaveFMT {
    25 /* Not saved in the chunk we read:
    26 	Uint32	FMTchunk;
    27 	Uint32	fmtlen;
    28 */
    29 	Uint16	encoding;	
    30 	Uint16	channels;		/* 1 = mono, 2 = stereo */
    31 	Uint32	frequency;		/* One of 11025, 22050, or 44100 Hz */
    32 	Uint32	byterate;		/* Average bytes per second */
    33 	Uint16	blockalign;		/* Bytes per sample block */
    34 	Uint16	bitspersample;		/* One of 8, 12, 16, or 4 for ADPCM */
    35 } WaveFMT;
    36 
    37 /* The general chunk found in the WAVE file */
    38 typedef struct Chunk {
    39 	Uint32 magic;
    40 	Uint32 length;
    41 	Uint8 *data;			/* Data includes magic and length */
    42 } Chunk;
    43 
    44 /*********************************************/
    45 /* Define values for AIFF (IFF audio) format */
    46 /*********************************************/
    47 #define FORM		0x4d524f46		/* "FORM" */
    48 #define AIFF		0x46464941		/* "AIFF" */
    49 #define SSND		0x444e5353		/* "SSND" */
    50 #define COMM		0x4d4d4f43		/* "COMM" */
    51