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