n64.h
1.96 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
/*
* n64.h
*/
#ifndef __n64__
#define __n64__
#include <PR/libaudio.h>
#include <dmedia/midi.h>
#include <PR/audiotools.h>
#include <PR/ramrom.h>
#include "spec.h"
#define MAX_MIDI_MSGS 16
#define STATUS_TYPE 1
#define SYSEX_TYPE 2
#define PARAMS_PER_SECTION 8
enum
{
WRITE_BLOCK = 1,
WRITE_RAMROM,
INIT_AUDIO,
START_SEQUENCE,
STOP_SEQUENCE,
SET_BANK,
RESET_BANK,
SET_FX_PARAM,
SET_FX_SXN_PARAMS,
LOAD_BANKFILE,
LOAD_INST_VOL,
LOAD_INST_PAN,
LOAD_INST_PRIORITY,
LOAD_INST_BENDRANGE
};
#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;
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;
} TN64Config;
/*
* 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
#endif