1 /***************************************************************************
\r
2 externals.h - description
\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
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
16 ***************************************************************************/
\r
20 /////////////////////////////////////////////////////////
\r
22 /////////////////////////////////////////////////////////
\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
30 #define max(a,b) (((a) > (b)) ? (a) : (b))
\r
31 #define min(a,b) (((a) < (b)) ? (a) : (b))
\r
34 ////////////////////////////////////////////////////////////////////////
\r
36 ////////////////////////////////////////////////////////////////////////
\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
50 ///////////////////////////////////////////////////////////
\r
52 ///////////////////////////////////////////////////////////
\r
54 // ADSR INFOS PER CHANNEL
\r
62 long SustainModeDec;
\r
65 unsigned long ReleaseVal;
\r
67 long ReleaseStartTime;
\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
88 ///////////////////////////////////////////////////////////
\r
92 // used for debug channel muting
\r
95 // used for simple interpolation
\r
96 #define FLAG_IPOL0 2
\r
97 #define FLAG_IPOL1 4
\r
99 ///////////////////////////////////////////////////////////
\r
101 // MAIN CHANNEL STRUCT
\r
104 int iSBPos; // mixing stuff
\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
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
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
126 int iRawPitch; // raw pitch (0...3fff)
\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
136 ///////////////////////////////////////////////////////////
\r
140 int StartAddr; // reverb area start addr in samples
\r
141 int CurrAddr; // reverb area curr addr in samples
\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
184 ///////////////////////////////////////////////////////////
\r
186 ///////////////////////////////////////////////////////////
\r
190 // psx buffers / addresses
\r
192 extern unsigned short regArea[];
\r
193 extern unsigned short spuMem[];
\r
194 extern unsigned char * spuMemC;
\r
195 extern unsigned char * pSpuIrq;
\r
196 extern unsigned char * pSpuBuffer;
\r
200 extern int iVolume;
\r
201 extern int iXAPitch;
\r
202 extern int iUseTimer;
\r
203 extern int iSPUIRQWait;
\r
204 extern int iDebugMode;
\r
205 extern int iRecordMode;
\r
206 extern int iUseReverb;
\r
207 extern int iUseInterpolation;
\r
210 extern int iSpuAsyncWait;
\r
212 extern SPUCHAN s_chan[];
\r
213 extern REVERBInfo rvb;
\r
215 extern unsigned long dwNoiseVal;
\r
216 extern unsigned short spuCtrl;
\r
217 extern unsigned short spuStat;
\r
218 extern unsigned short spuIrq;
\r
219 extern unsigned long spuAddr;
\r
220 extern int bEndThread;
\r
221 extern int bThreadEnded;
\r
222 extern int bSpuInit;
\r
223 extern unsigned int dwNewChannel;
\r
224 extern unsigned int dwChannelOn;
\r
226 extern int SSumR[];
\r
227 extern int SSumL[];
\r
231 extern void (CALLBACK *cddavCallback)(unsigned short,unsigned short);
\r
235 ///////////////////////////////////////////////////////////
\r
237 ///////////////////////////////////////////////////////////
\r
241 extern xa_decode_t * xapGlobal;
\r
243 extern uint32_t * XAFeed;
\r
244 extern uint32_t * XAPlay;
\r
245 extern uint32_t * XAStart;
\r
246 extern uint32_t * XAEnd;
\r
248 extern uint32_t XARepeat;
\r
249 extern uint32_t XALastVal;
\r
251 extern uint32_t * CDDAFeed;
\r
252 extern uint32_t * CDDAPlay;
\r
253 extern uint32_t * CDDAStart;
\r
254 extern uint32_t * CDDAEnd;
\r
256 extern int iLeftXAVol;
\r
257 extern int iRightXAVol;
\r
261 ///////////////////////////////////////////////////////////
\r
262 // REVERB.C globals
\r
263 ///////////////////////////////////////////////////////////
\r
267 extern int * sRVBPlay;
\r
268 extern int * sRVBEnd;
\r
269 extern int * sRVBStart;
\r
270 extern int iReverbOff;
\r
271 extern int iReverbRepeat;
\r
272 extern int iReverbNum;
\r