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