1 /*--------------------------------------------------------------------------* 2 Project: Revolution SOUNDFILE dynamic link library 3 File: aifffile.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: aifffile.h,v $ 14 Revision 1.2 02/09/2006 06:51:39 aka 15 Changed copyright. 16 17 18 *--------------------------------------------------------------------------*/ 19 #ifndef __AIFFFILE_H__ 20 #define __AIFFFILE_H__ 21 22 #include "Types.h" 23 #include "chunkname.h" 24 25 /*--------------------------------------------------------------------------* 26 AIFF chunk names 27 *--------------------------------------------------------------------------*/ 28 #define CHUNK_FORM chunk_name('F','O','R','M') 29 #define CHUNK_AIFF chunk_name('A','I','F','F') 30 #define CHUNK_AIFC chunk_name('A','I','F','C') 31 #define CHUNK_FVER chunk_name('F','V','E','R') 32 #define CHUNK_COMM chunk_name('C','O','M','M') 33 #define CHUNK_SSND chunk_name('S','S','N','D') 34 #define CHUNK_MARK chunk_name('M','A','R','K') 35 #define CHUNK_COMT chunk_name('C','O','M','T') 36 #define CHUNK_INST chunk_name('I','N','S','T') 37 #define CHUNK_MIDI chunk_name('M','I','D','I') 38 #define CHUNK_AESD chunk_name('A','E','S','D') 39 #define CHUNK_APPL chunk_name('A','P','P','L') 40 #define CHUNK_NAME chunk_name('N','A','M','E') 41 #define CHUNK_AUTH chunk_name('A','U','T','H') 42 #define CHUNK_COPY chunk_name('(','c',')',' ') 43 #define CHUNK_ANNO chunk_name('A','N','N','O') 44 45 typedef struct 46 { 47 48 u8 chunk[4]; 49 u8 bytes[4]; 50 u8 channels[2]; 51 u8 samples[4]; 52 u8 bitsPerSample[2]; 53 u8 samplesPerSec[10]; 54 55 } AIFFCOMM; 56 57 typedef struct 58 { 59 60 u8 chunk[4]; 61 u8 bytes[4]; 62 u8 normalKey; 63 u8 detune; 64 u8 lowKey; 65 u8 hiKey; 66 u8 loVel; 67 u8 hiVel; 68 u8 gain[2]; 69 u8 playMode0[2]; 70 u8 begLoop0[2]; 71 u8 endLoop0[2]; 72 u8 playMode1[2]; 73 u8 begLoop1[2]; 74 u8 endLoop1[2]; 75 76 77 } AIFFINST; 78 79 typedef struct 80 { 81 82 u8 chunk[4]; 83 u8 bytes[4]; 84 85 u8 count[2]; 86 87 u8 id0[2]; 88 u8 position0[4]; 89 u8 ch0[10]; 90 91 u8 id1[2]; 92 u8 position1[4]; 93 u8 ch1[11]; 94 95 } AIFFMARK; 96 97 typedef struct 98 { 99 100 AIFFCOMM comm; 101 AIFFINST inst; 102 AIFFMARK mark; 103 104 } AIFFINFO; 105 106 107 void aiffCreateHeader 108 ( 109 AIFFINFO *aiffinfo, 110 int channels, 111 int samples, 112 int bitsPerSample, 113 int sampleRate 114 ); 115 116 void aiffWriteHeader 117 ( 118 AIFFINFO *aiffinfo, 119 FILE *outfile, 120 int loopStart, 121 int loopEnd, 122 int bitsPerSample, 123 int samples, 124 int channels 125 ); 126 127 void aiffCreateMark(AIFFINFO *aiffinfo, u32 startloop, u32 endloop); 128 void aiffWriteMark(AIFFINFO *aiffinfo, FILE *outfile); 129 130 int aiffReadHeader(AIFFINFO *aiffinfo, FILE *infile); 131 int aiffGetChannels(AIFFINFO *aiffinfo); 132 int aiffGetSamples(AIFFINFO *aiffinfo); 133 int aiffGetSampleRate(AIFFINFO *aiffinfo); 134 int aiffGetBitsPerSample(AIFFINFO *aiffinfo); 135 int aiffGetLoopStart(AIFFINFO *aiffinfo); 136 int aiffGetLoopEnd(AIFFINFO *aiffinfo); 137 138 #endif // __AIFFFILE_H__ 139