libaudio_internal.h (3092B)
1 #ifndef _LIBAUDIO_INTERNAL_H_ 2 #define _LIBAUDIO_INTERNAL_H_ 3 #include <ultra64.h> 4 #define AL_BANK_VERSION 0x4231 /* 'B1' */ 5 6 typedef u8 ALPan; 7 typedef s32 ALMicroTime; 8 9 /* Possible wavetable types */ 10 enum 11 { 12 AL_ADPCM_WAVE = 0, 13 AL_RAW16_WAVE 14 }; 15 16 typedef struct 17 { 18 u32 start; 19 u32 end; 20 u32 count; 21 } ALRawLoop; 22 23 typedef struct 24 { 25 u32 start; 26 u32 end; 27 u32 count; 28 ADPCM_STATE state; 29 } ALADPCMloop; 30 31 typedef struct 32 { 33 s32 order; 34 s32 npredictors; 35 s16 book[1]; // variable size, 8-byte aligned 36 } ALADPCMBook; 37 38 typedef struct 39 { 40 ALMicroTime attackTime; 41 ALMicroTime decayTime; 42 ALMicroTime releaseTime; 43 u8 attackVolume; 44 u8 decayVolume; 45 } ALEnvelope; 46 47 typedef struct 48 { 49 u8 velocityMin; 50 u8 velocityMax; 51 u8 keyMin; 52 u8 keyMax; 53 u8 keyBase; 54 s8 detune; 55 } ALKeyMap; 56 57 typedef struct 58 { 59 ALADPCMloop *loop; 60 ALADPCMBook *book; 61 } ALADPCMWaveInfo; 62 63 typedef struct 64 { 65 ALRawLoop *loop; 66 } ALRAWWaveInfo; 67 68 typedef struct ALWaveTable_s 69 { 70 u8 *base; /* ptr to start of wave data */ 71 s32 len; /* length of data in bytes */ 72 u8 type; /* compression type */ 73 u8 flags; /* offset/address flags */ 74 union { 75 ALADPCMWaveInfo adpcmWave; 76 ALRAWWaveInfo rawWave; 77 } waveInfo; 78 } ALWaveTable; 79 80 typedef struct ALSound_s 81 { 82 ALEnvelope *envelope; 83 ALKeyMap *keyMap; 84 ALWaveTable *wavetable; /* offset to wavetable struct */ 85 ALPan samplePan; 86 u8 sampleVolume; 87 u8 flags; 88 } ALSound; 89 90 typedef struct 91 { 92 u8 volume; /* overall volume for this instrument */ 93 ALPan pan; /* 0 = hard left, 127 = hard right */ 94 u8 priority; /* voice priority for this instrument */ 95 u8 flags; 96 u8 tremType; /* the type of tremelo osc. to use */ 97 u8 tremRate; /* the rate of the tremelo osc. */ 98 u8 tremDepth; /* the depth of the tremelo osc */ 99 u8 tremDelay; /* the delay for the tremelo osc */ 100 u8 vibType; /* the type of tremelo osc. to use */ 101 u8 vibRate; /* the rate of the tremelo osc. */ 102 u8 vibDepth; /* the depth of the tremelo osc */ 103 u8 vibDelay; /* the delay for the tremelo osc */ 104 s16 bendRange; /* pitch bend range in cents */ 105 s16 soundCount; /* number of sounds in this array */ 106 ALSound *soundArray[1]; 107 } ALInstrument; 108 109 typedef struct ALBank_s 110 { 111 s16 instCount; /* number of programs in this bank */ 112 u8 flags; 113 u8 pad; 114 s32 sampleRate; /* e.g. 44100, 22050, etc... */ 115 ALInstrument *percussion; /* default percussion for GM */ 116 ALInstrument *instArray[1]; /* ARRAY of instruments */ 117 } ALBank; 118 119 typedef struct 120 { /* Note: sizeof won't be correct */ 121 s16 revision; /* format revision of this file */ 122 s16 bankCount; /* number of banks */ 123 ALBank *bankArray[1]; /* ARRAY of bank offsets */ 124 } ALBankFile; 125 126 void alBnkfNew(ALBankFile *f, u8 *table); 127 #endif