AudioApp.h
2.16 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
/*
* midiApp.h
*/
#ifndef _AE_AudioApp_h
#define _AE_AudioApp_h
#include <libaudio.h>
#include <dmedia/midi.h>
#include <audiotools.h>
#include <ramrom.h>
#include "spec.h"
#define MAX_MIDI_MSGS 16
#define STATUS_TYPE 1
#define SYSEX_TYPE 2
#define WRITE_BLOCK 1
#define WRITE_RAMROM 2
#define INIT_AUDIO 3
#define START_SEQUENCE 4
#define SET_BANK 5 /* presumes all pointers are already set. */
#define RESET_BANK 6 /* used when sequence is currently running */
#define SET_FX_PARAM 7
#define LOAD_BANKFILE 8
#define LOAD_INST_VOL 9
#define LOAD_INST_PAN 10
#define LOAD_INST_PRIORITY 11
#define LOAD_INST_BENDRANGE 12
#define TRUE 1
#define FALSE 0
#ifndef MIN
#define MIN(a,b) (((a)<(b))?(a):(b))
#endif
typedef struct {
unsigned char midiByte[4];
} midiMess;
typedef struct {
int numEvts;
midiMess mess[MAX_MIDI_MSGS];
} midiBlock;
typedef struct {
int reqType;
int offset;
int value;
} SysExReq;
typedef struct
{
int pcktType;
union {
midiBlock mb;
SysExReq sysr;
} d;
} CommPckt;
typedef struct
{
ALLink node;
int startAddr;
u32 lastFrame;
char *ptr;
} DMABuffer;
typedef struct
{
u8 initialized;
DMABuffer *firstUsed;
DMABuffer *firstFree;
} DMAState;
/*
* The number of bytes needed to store a 16 byte aligned midiblock
* and a 16 byte align u32.
*/
#define CACHE_ALIGN_UP(a) ((a+15) & ~15)
#define CACHE_ALIGN_DOWN(a) (a & ~15)
#define TRANSFER_SPACE_SIZE (((sizeof(CommPckt)/16) + 3) * 16)
#define RDRAM_MEMORY_END 0x80300000
typedef struct
{
char *audioHeap;
int heapSize;
int frameSize; /* in samples per frame */
int maxCmdListSize; /* in commands, not bytes */
int numDMABuffs;
int dmaBufSize;
int dmaQSize;
int frameLag;
ALSynConfig synConfig;
ALSeqpConfig seqpConfig;
} AudioConfig;
#endif