midiApp.h
5.73 KB
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
/*
* midiApp.h
*/
#define STACKSIZE 0x1000
#ifdef _LANGUAGE_C
#include <audiotools.h>
#define MAX_VOICES 32
#define MAX_SEQ_CHANNELS 16
#define MAX_BUFFER_LENGTH 1024
#define DMA_QUEUE_SIZE 50
#define MAX_UPDATES 128
#define MAX_SEQP_EVENTS 128
#define FX_BUFFER_SIZE 8192
#define AUDIO_HEAP_SIZE 400000
#define MAX_CLIST_SIZE 5000
#define MAX_AUDIO_LENGTH 640
#define OUTPUT_RATE 44100
#define FRAME_SIZE 320 /* Best if a multiple of 160 */
#define MAX_PORTS 4
#define MAX_MSGS 16
#define STATUS_TYPE 1
#define SYSEX_TYPE 2
#define GET_OFFSET 20
#define GET_8 21
#define GET_16 22
#define GET_32 23
#define SET_8 24
#define SET_16 25
#define SET_32 26
#define GET_BLOCK 27
#define TRUE 1
#define FALSE 0
typedef struct {
char commandID;
char channel;
char *data;
char *parameter;
double dvalue;
char cvalue;
void *avalue;
} SysexRecord;
typedef struct
{
unsigned char midiByte[4];
} midiMess;
typedef struct
{
int pcktType;
int numEvts;
midiMess mess[MAX_MSGS];
} midiBlock;
typedef struct
{
int pcktType;
int reqType;
int offset;
int value;
} SysExReq;
typedef struct {
u32 validFlag;
char *fileName;
} ALRamRomObj;
typedef struct {
ALSymFileObj SFObj;
int deleteFlag;
char *data;
union {
int allocInsts;
int allocSnds;
ALRamRomObj *ramromObj;
int value;
} allocCts;
} ALSymObj;
typedef struct { char array[32]; }array32;
void ReadFiles(char *fileName);
ALSymObj *MatchHashName(char *name);
char *BuildClassList(int class);
char *BuildInstList(char *name);
char *BuildSoundList(char *name);
char *GetStrFromOffset(u32 offset);
void GetBlock(u32 offset,char *blockBuf,int numBytes);
void DecRefCtFromOffset(u32 offset);
int mdInit(void);
void ProcessSysEx(int whichMsg);
void AckPresent(char *param);
void HandleGetString(char *param,int strType);
void HandleGetNumber(char *param,int strType);
void HandleSetString(char *param,int strType,char *data);
void HandleSetNumber(char *param,int strType,double dvalue);
void HandleGetBank(char *param);
void HandleSetBank(char *param,char *data,double dvalue);
void HandleGetInst(char *param);
void HandleSetInst(char *param,char *data,double dvalue);
void HandleGetSnd(char *param);
void HandleSetSnd(char *param,char *data,double dvalue);
void HandleGetEnvlp(char *param);
void HandleSetEnvlp(char *param,double dvalue);
void HandleGetKmap(char *param);
void HandleSetKmap(char *param,double dvalue);
int CheckString(char **requestStr, array32 *list, int maxStr);
void SendClassList(int class, char *param);
void SendSoundList(char *param);
void SendInstList(char *param);
void SetValue(u32 offset,int type,u32 value);
void ReplyValue(char *param,u32 value);
void ReplyString(char *param,char *ptr);
u32 GetValue(u32 offset,int type);
char *parsename(char *name,char *nameStr);
int GetNumber(char **hdl);
void CreateBankObj(char *param,char *data);
void CreateInstObj(char *param,char *data);
void CreateSndObj(char *param,char *data);
void CreateKmapObj(char *param,char *data);
void CreateEnvlpObj(char *param,char *data);
void CreateWavetblObj(char *param,char *data);
void DeleteObject(char *name);
ALSymObj *SymObjFromOffset(u32 offset);
void CheckMemory(int mirrorSize);
void CompactMirror(void);
u32 AddName(char *str);
int AddHash(char *str, ALSymObj *obj);
#define NO_CLASS 0
#define BANK_CLASS 1
#define INST_CLASS 2
#define SOUND_CLASS 3
#define KEYMAP_CLASS 4
#define WAVETBL_CLASS 5
#define LOOP_CLASS 6
#define BNKFILE_CLASS 7
#define ENVLP_CLASS 8
#define BOOK_CLASS 9
#define SNDFILE_CLASS 10
#define MAX_BANK_STRS 5
#define BANK_INST_STR_LEN 10
#define BANK_PERC_PARAM 1
#define BANK_INST_CT_PARAM 2
#define BANK_RATE_PARAM 3
#define BANK_INST_PARAM 4
#define BANK_ALLOC_PARAM 5
#define MAX_INST_STRS 6
#define INST_SND_STR_LEN 5
#define INST_VOLUME_PARAM 1
#define INST_PAN_PARAM 2
#define INST_PRIOR_PARAM 3
#define INST_SNDCOUNT_PARAM 4
#define INST_SNDARRAY_PARAM 5
#define INST_ALLOC_PARAM 6
#define MAX_SOUND_STRS 5
#define SND_SAMPLE_PARAM 1
#define SND_KEYMAP_PARAM 2
#define SND_ENVLP_PARAM 3
#define SND_PAN_PARAM 4
#define SND_VOLUME_PARAM 5
#define MAX_ENVLP_STRS 5
#define ENVLP_ATTCK_TIME 1
#define ENVLP_ATTCK_LVL 2
#define ENVLP_DECAY_TIME 3
#define ENVLP_DECAY_LVL 4
#define ENVLP_REL_TIME 5
#define MAX_KMAP_STRS 6
#define KMAP_VEL_MIN 1
#define KMAP_VEL_MAX 2
#define KMAP_KEY_MIN 3
#define KMAP_KEY_MAX 4
#define KMAP_KEYBASE 5
#define KMAP_DETUNE 6
#define CREATE_BANK_STR_LEN 11
#define CREATE_INST_STR_LEN 17
#define CREATE_SND_STR_LEN 12
#define CREATE_ENVLP_STR_LEN 15
#define CREATE_KMAP_STR_LEN 13
#define CREATE_WAVETBL_STR_LEN 16
#define DELETE_BANK_STR_LEN 11
#define DELETE_INST_STR_LEN 17
#define DELETE_SND_STR_LEN 12
#define DELETE_ENVLP_STR_LEN 15
#define DELETE_KMAP_STR_LEN 13
#define DELETE_WAVETBL_STR_LEN 16
/*
* Symbol generated by "makerom" to indicate the end of the code segment
* in virtual (and physical) memory
*/
extern char _codeSegmentEnd[];
/*
* Symbols generated by "makerom" to tell us where the segments are
* in ROM.
*/
extern char _seqSegmentRomStart[], _seqSegmentRomEnd[];
extern char _midibankSegmentRomStart[], _midibankSegmentRomEnd[];
extern char _miditableSegmentRomStart[], _miditableSegmentRomEnd[];
#endif