1 /*--------------------------------------------------------------------------* 2 Project: Revolution SOUNDFILE dynamic link library 3 File: Wavfile.h 4 5 Copyright (C)2001-2006 Nintendo All Rights Reserved. 6 7 These coded instructions, statements, and computer programs contain 8 proprietary information of Nintendo of America Inc. and/or Nintendo 9 Company Ltd., and are protected by Federal copyright law. They may 10 not be disclosed to third parties or copied or duplicated in any form, 11 in whole or in part, without the prior written consent of Nintendo. 12 13 $Log: Wavfile.h,v $ 14 Revision 1.2 02/09/2006 06:51:39 aka 15 Changed copyright. 16 17 18 *--------------------------------------------------------------------------*/ 19 #ifndef __WAVFILE_H__ 20 #define __WAVFILE_H__ 21 22 #include "Types.h" 23 #include "chunkname.h" 24 25 26 /*--------------------------------------------------------------------------* 27 RIFF chunk names 28 *--------------------------------------------------------------------------*/ 29 #define CHUNK_RIFF chunk_name('R','I','F','F') 30 #define CHUNK_WAVE chunk_name('W','A','V','E') 31 32 33 typedef struct 34 { 35 char chunkId[4]; 36 u32 chunkSize; 37 u16 waveFormatType; 38 u16 channel; 39 u32 samplesPerSec; 40 u32 bytesPerSec; 41 u16 blockSize; 42 u16 bitsPerSample; 43 44 } FMTCHUNK; 45 46 typedef struct 47 { 48 char chunkId[4]; 49 u32 chunkSize; 50 51 } DATACHUNK; 52 53 typedef struct 54 { 55 char chunkId[4]; 56 u32 chunkSize; 57 char formType[4]; 58 FMTCHUNK fmt; 59 DATACHUNK data; 60 61 } WAVECHUNK; 62 63 64 void wavCreateHeader(WAVECHUNK *wc, 65 int numOfSamples, 66 int channel, 67 int bitsPerSample, 68 int frequency); 69 70 void wavWriteHeader(WAVECHUNK *wc, FILE *outfile); 71 int wavReadHeader(WAVECHUNK *wc, FILE *infile); 72 u32 wavGetSamples(WAVECHUNK *wc); 73 u32 wavGetChannels(WAVECHUNK *wc); 74 u32 wavGetBitsPerSample(WAVECHUNK *wc); 75 u32 wavGetSampleRate(WAVECHUNK *wc); 76 77 #endif // __WAVFILE_H__ 78