drc: handle some load delay cases with interpreter
[pcsx_rearmed.git] / plugins / dfsound / externals.h
... / ...
CommitLineData
1/***************************************************************************\r
2 externals.h - description\r
3 -------------------\r
4 begin : Wed May 15 2002\r
5 copyright : (C) 2002 by Pete Bernert\r
6 email : BlackDove@addcom.de\r
7 ***************************************************************************/\r
8/***************************************************************************\r
9 * *\r
10 * This program is free software; you can redistribute it and/or modify *\r
11 * it under the terms of the GNU General Public License as published by *\r
12 * the Free Software Foundation; either version 2 of the License, or *\r
13 * (at your option) any later version. See also the license.txt file for *\r
14 * additional informations. *\r
15 * *\r
16 ***************************************************************************/\r
17\r
18#include <stdint.h>\r
19\r
20/////////////////////////////////////////////////////////\r
21// generic defines\r
22/////////////////////////////////////////////////////////\r
23\r
24#define PSE_LT_SPU 4\r
25#define PSE_SPU_ERR_SUCCESS 0\r
26#define PSE_SPU_ERR -60\r
27#define PSE_SPU_ERR_NOTCONFIGURED PSE_SPU_ERR - 1\r
28#define PSE_SPU_ERR_INIT PSE_SPU_ERR - 2\r
29#ifndef max\r
30#define max(a,b) (((a) > (b)) ? (a) : (b))\r
31#define min(a,b) (((a) < (b)) ? (a) : (b))\r
32#endif\r
33\r
34////////////////////////////////////////////////////////////////////////\r
35// spu defines\r
36////////////////////////////////////////////////////////////////////////\r
37\r
38// sound buffer sizes\r
39// 400 ms complete sound buffer\r
40#define SOUNDSIZE 70560\r
41// 137 ms test buffer... if less than that is buffered, a new upload will happen\r
42#define TESTSIZE 24192\r
43\r
44// num of channels\r
45#define MAXCHAN 24\r
46\r
47// ~ 1 ms of data\r
48#define NSSIZE 45\r
49\r
50///////////////////////////////////////////////////////////\r
51// struct defines\r
52///////////////////////////////////////////////////////////\r
53\r
54// ADSR INFOS PER CHANNEL\r
55typedef struct\r
56{\r
57 int AttackModeExp;\r
58 long AttackTime;\r
59 long DecayTime;\r
60 long SustainLevel;\r
61 int SustainModeExp;\r
62 long SustainModeDec;\r
63 long SustainTime;\r
64 int ReleaseModeExp;\r
65 unsigned long ReleaseVal;\r
66 long ReleaseTime;\r
67 long ReleaseStartTime; \r
68 long ReleaseVol; \r
69 long lTime;\r
70 long lVolume;\r
71} ADSRInfo;\r
72\r
73typedef struct\r
74{\r
75 unsigned char State:2;\r
76 unsigned char AttackModeExp:1;\r
77 unsigned char SustainModeExp:1;\r
78 unsigned char SustainIncrease:1;\r
79 unsigned char ReleaseModeExp:1;\r
80 unsigned char AttackRate;\r
81 unsigned char DecayRate;\r
82 unsigned char SustainLevel;\r
83 unsigned char SustainRate;\r
84 unsigned char ReleaseRate;\r
85 int EnvelopeVol;\r
86} ADSRInfoEx;\r
87 \r
88///////////////////////////////////////////////////////////\r
89\r
90// Tmp Flags\r
91\r
92// used for debug channel muting\r
93#define FLAG_MUTE 1\r
94\r
95// used for simple interpolation\r
96#define FLAG_IPOL0 2\r
97#define FLAG_IPOL1 4\r
98\r
99///////////////////////////////////////////////////////////\r
100\r
101// MAIN CHANNEL STRUCT\r
102typedef struct\r
103{\r
104 int iSBPos; // mixing stuff\r
105 int spos;\r
106 int sinc;\r
107\r
108 unsigned char * pStart; // start ptr into sound mem\r
109 unsigned char * pCurr; // current pos in sound mem\r
110 unsigned char * pLoop; // loop ptr in sound mem\r
111\r
112 unsigned int bStop:1; // is channel stopped (sample _can_ still be playing, ADSR Release phase)\r
113 unsigned int bReverb:1; // can we do reverb on this channel? must have ctrl register bit, to get active\r
114 unsigned int bIgnoreLoop:1; // ignore loop bit, if an external loop address is used\r
115 unsigned int bRVBActive:1; // reverb active flag\r
116 unsigned int bNoise:1; // noise active flag\r
117 unsigned int bFMod:2; // freq mod (0=off, 1=sound channel, 2=freq channel)\r
118\r
119 int iActFreq; // current psx pitch\r
120 int iUsedFreq; // current pc pitch\r
121 int iLeftVolume; // left volume\r
122 int iRightVolume; // right volume\r
123 int s_1; // last decoding infos\r
124 int s_2;\r
125 ADSRInfoEx ADSRX;\r
126 int iRawPitch; // raw pitch (0...3fff)\r
127\r
128 int iRVBOffset; // reverb offset\r
129 int iRVBRepeat; // reverb repeat\r
130 int iRVBNum; // another reverb helper\r
131 int iOldNoise; // old noise val for this channel \r
132\r
133 int SB[32+32];\r
134} SPUCHAN;\r
135\r
136///////////////////////////////////////////////////////////\r
137\r
138typedef struct\r
139{\r
140 int StartAddr; // reverb area start addr in samples\r
141 int CurrAddr; // reverb area curr addr in samples\r
142\r
143 int VolLeft;\r
144 int VolRight;\r
145 int iLastRVBLeft;\r
146 int iLastRVBRight;\r
147 int iRVBLeft;\r
148 int iRVBRight;\r
149\r
150 int FB_SRC_A; // (offset)\r
151 int FB_SRC_B; // (offset)\r
152 int IIR_ALPHA; // (coef.)\r
153 int ACC_COEF_A; // (coef.)\r
154 int ACC_COEF_B; // (coef.)\r
155 int ACC_COEF_C; // (coef.)\r
156 int ACC_COEF_D; // (coef.)\r
157 int IIR_COEF; // (coef.)\r
158 int FB_ALPHA; // (coef.)\r
159 int FB_X; // (coef.)\r
160 int IIR_DEST_A0; // (offset)\r
161 int IIR_DEST_A1; // (offset)\r
162 int ACC_SRC_A0; // (offset)\r
163 int ACC_SRC_A1; // (offset)\r
164 int ACC_SRC_B0; // (offset)\r
165 int ACC_SRC_B1; // (offset)\r
166 int IIR_SRC_A0; // (offset)\r
167 int IIR_SRC_A1; // (offset)\r
168 int IIR_DEST_B0; // (offset)\r
169 int IIR_DEST_B1; // (offset)\r
170 int ACC_SRC_C0; // (offset)\r
171 int ACC_SRC_C1; // (offset)\r
172 int ACC_SRC_D0; // (offset)\r
173 int ACC_SRC_D1; // (offset)\r
174 int IIR_SRC_B1; // (offset)\r
175 int IIR_SRC_B0; // (offset)\r
176 int MIX_DEST_A0; // (offset)\r
177 int MIX_DEST_A1; // (offset)\r
178 int MIX_DEST_B0; // (offset)\r
179 int MIX_DEST_B1; // (offset)\r
180 int IN_COEF_L; // (coef.)\r
181 int IN_COEF_R; // (coef.)\r
182} REVERBInfo;\r
183\r
184///////////////////////////////////////////////////////////\r
185// SPU.C globals\r
186///////////////////////////////////////////////////////////\r
187\r
188#ifndef _IN_SPU\r
189\r
190// psx buffers / addresses\r
191\r
192extern unsigned short regArea[]; \r
193extern unsigned short spuMem[];\r
194extern unsigned char * spuMemC;\r
195extern unsigned char * pSpuIrq;\r
196extern unsigned char * pSpuBuffer;\r
197\r
198// user settings\r
199\r
200extern int iVolume;\r
201extern int iXAPitch;\r
202extern int iUseTimer;\r
203extern int iSPUIRQWait;\r
204extern int iDebugMode;\r
205extern int iRecordMode;\r
206extern int iUseReverb;\r
207extern int iUseInterpolation;\r
208// MISC\r
209\r
210extern int iSpuAsyncWait;\r
211\r
212extern SPUCHAN s_chan[];\r
213extern REVERBInfo rvb;\r
214\r
215extern unsigned long dwNoiseVal;\r
216extern unsigned short spuCtrl;\r
217extern unsigned short spuStat;\r
218extern unsigned short spuIrq;\r
219extern unsigned long spuAddr;\r
220extern int bEndThread; \r
221extern int bThreadEnded;\r
222extern int bSpuInit;\r
223extern unsigned int dwNewChannel;\r
224extern unsigned int dwChannelOn;\r
225\r
226extern int SSumR[];\r
227extern int SSumL[];\r
228extern int iCycle;\r
229extern short * pS;\r
230\r
231extern void (CALLBACK *cddavCallback)(unsigned short,unsigned short);\r
232\r
233#endif\r
234\r
235///////////////////////////////////////////////////////////\r
236// XA.C globals\r
237///////////////////////////////////////////////////////////\r
238\r
239#ifndef _IN_XA\r
240\r
241extern xa_decode_t * xapGlobal;\r
242\r
243extern uint32_t * XAFeed;\r
244extern uint32_t * XAPlay;\r
245extern uint32_t * XAStart;\r
246extern uint32_t * XAEnd;\r
247\r
248extern uint32_t XARepeat;\r
249extern uint32_t XALastVal;\r
250\r
251extern uint32_t * CDDAFeed;\r
252extern uint32_t * CDDAPlay;\r
253extern uint32_t * CDDAStart;\r
254extern uint32_t * CDDAEnd;\r
255\r
256extern int iLeftXAVol;\r
257extern int iRightXAVol;\r
258\r
259#endif\r
260\r
261///////////////////////////////////////////////////////////\r
262// REVERB.C globals\r
263///////////////////////////////////////////////////////////\r
264\r
265#ifndef _IN_REVERB\r
266\r
267extern int * sRVBPlay;\r
268extern int * sRVBEnd;\r
269extern int * sRVBStart;\r
270extern int iReverbOff;\r
271extern int iReverbRepeat;\r
272extern int iReverbNum; \r
273\r
274#endif\r