1
/***************************************************************************
2
externals.h - description
4
begin : Wed May 15 2002
5
copyright : (C) 2002 by Pete Bernert
6
email : BlackDove@addcom.de
7
***************************************************************************/
9
/***************************************************************************
11
* This program is free software; you can redistribute it and/or modify *
12
* it under the terms of the GNU General Public License as published by *
13
* the Free Software Foundation; either version 2 of the License, or *
14
* (at your option) any later version. See also the license.txt file for *
15
* additional informations. *
17
***************************************************************************/
19
//*************************************************************************//
20
// History of changes:
23
// - changed plugin to emulate PS2 spu
26
// - increased channel struct for interpolation
29
// - generic cleanup for the Peops release
31
//*************************************************************************//
33
#ifndef PEOPS2_EXTERNALS
34
#define PEOPS2_EXTERNALS
49
static INLINE u16 BFLIP16(u16 x)
54
static INLINE u16 BFLIP16(u16 x)
56
return( ((x>>8)&0xFF)| ((x&0xFF)<<8) );
60
/////////////////////////////////////////////////////////
62
/////////////////////////////////////////////////////////
64
//#define PSE_LT_SPU 4
65
//#define PSE_SPU_ERR_SUCCESS 0
66
//#define PSE_SPU_ERR -60
67
//#define PSE_SPU_ERR_NOTCONFIGURED PSE_SPU_ERR - 1
68
//#define PSE_SPU_ERR_INIT PSE_SPU_ERR - 2
70
////////////////////////////////////////////////////////////////////////
72
////////////////////////////////////////////////////////////////////////
75
// 400 ms complete sound buffer
76
#define SOUNDSIZE 76800
77
// 137 ms test buffer... if less than that is buffered, a new upload will happen
78
#define TESTSIZE 26304
84
// ~ 1 ms of data (was 45)
88
///////////////////////////////////////////////////////////
90
///////////////////////////////////////////////////////////
92
// ADSR INFOS PER CHANNEL
103
unsigned long ReleaseVal;
105
long ReleaseStartTime;
129
///////////////////////////////////////////////////////////
133
// used for debug channel muting
136
// used for simple interpolation
140
///////////////////////////////////////////////////////////
142
// MAIN CHANNEL STRUCT
145
// no mutexes used anymore... don't need them to sync access
148
int bNew; // start flag
150
int iSBPos; // mixing stuff
153
int SB[32+32]; // Pete added another 32 dwords in 1.6 ... prevents overflow issues with gaussian/cubic interpolation (thanx xodnizel!), and can be used for even better interpolations, eh? :)
156
unsigned char * pStart; // start ptr into sound mem
157
unsigned char * pCurr; // current pos in sound mem
158
unsigned char * pLoop; // loop ptr in sound mem
164
int bOn; // is channel active (sample playing?)
165
int bStop; // is channel stopped (sample _can_ still be playing, ADSR Release phase)
166
int bEndPoint; // end point reached
167
int bReverbL; // can we do reverb on this channel? must have ctrl register bit, to get active
170
int bVolumeL; // Volume on/off
173
int iActFreq; // current psx pitch
174
int iUsedFreq; // current pc pitch
175
int iLeftVolume; // left volume
176
int iLeftVolRaw; // left psx volume value
177
int bIgnoreLoop; // ignore loop bit, if an external loop address is used
178
int iMute; // mute mode
179
int iRightVolume; // right volume
180
int iRightVolRaw; // right psx volume value
181
int iRawPitch; // raw pitch (0...3fff)
182
int iIrqDone; // debug irq done flag
183
int s_1; // last decoding infos
185
int bRVBActive; // reverb active flag
186
int bNoise; // noise active flag
187
int bFMod; // freq mod (0=off, 1=sound channel, 2=freq channel)
188
int iOldNoise; // old noise val for this channel
189
ADSRInfo ADSR; // active ADSR settings
190
ADSRInfoEx ADSRX; // next ADSR settings (will be moved to active on sample start)
194
///////////////////////////////////////////////////////////
198
int StartAddr; // reverb area start addr in samples
199
int EndAddr; // reverb area end addr in samples
200
int CurrAddr; // reverb area curr addr in samples
210
int FB_SRC_A; // (offset)
211
int FB_SRC_B; // (offset)
212
int IIR_ALPHA; // (coef.)
213
int ACC_COEF_A; // (coef.)
214
int ACC_COEF_B; // (coef.)
215
int ACC_COEF_C; // (coef.)
216
int ACC_COEF_D; // (coef.)
217
int IIR_COEF; // (coef.)
218
int FB_ALPHA; // (coef.)
220
int IIR_DEST_A0; // (offset)
221
int IIR_DEST_A1; // (offset)
222
int ACC_SRC_A0; // (offset)
223
int ACC_SRC_A1; // (offset)
224
int ACC_SRC_B0; // (offset)
225
int ACC_SRC_B1; // (offset)
226
int IIR_SRC_A0; // (offset)
227
int IIR_SRC_A1; // (offset)
228
int IIR_DEST_B0; // (offset)
229
int IIR_DEST_B1; // (offset)
230
int ACC_SRC_C0; // (offset)
231
int ACC_SRC_C1; // (offset)
232
int ACC_SRC_D0; // (offset)
233
int ACC_SRC_D1; // (offset)
234
int IIR_SRC_B1; // (offset)
235
int IIR_SRC_B0; // (offset)
236
int MIX_DEST_A0; // (offset)
237
int MIX_DEST_A1; // (offset)
238
int MIX_DEST_B0; // (offset)
239
int MIX_DEST_B1; // (offset)
240
int IN_COEF_L; // (coef.)
241
int IN_COEF_R; // (coef.)
245
//extern HINSTANCE hInst;
246
//#define WM_MUTE (WM_USER+543)
249
///////////////////////////////////////////////////////////
251
///////////////////////////////////////////////////////////
255
// psx buffers / addresses
257
extern unsigned short regArea[];
258
extern unsigned short spuMem[];
259
extern unsigned char * spuMemC;
260
extern unsigned char * pSpuIrq[];
261
extern unsigned char * pSpuBuffer;
268
extern int iUseTimer;
269
extern int iSPUIRQWait;
270
extern int iDebugMode;
271
extern int iRecordMode;
272
extern int iUseReverb;
273
extern int iUseInterpolation;
274
extern int iDisStereo;
277
extern SPUCHAN s_chan[];
278
extern REVERBInfo rvb[];
280
extern unsigned long dwNoiseVal;
281
extern unsigned short spuCtrl2[];
282
extern unsigned short spuStat2[];
283
extern unsigned long spuIrq2[];
284
extern unsigned long spuAddr2[];
285
extern unsigned long spuRvbAddr2[];
286
extern unsigned long spuRvbAEnd2[];
288
extern int bEndThread;
289
extern int bThreadEnded;
296
extern unsigned long dwNewChannel2[];
297
extern unsigned long dwEndChannel2[];
299
extern int iSpuAsyncWait;
302
//extern HWND hWMain; // window handle
303
//extern HWND hWDebug;
306
extern void (CALLBACK *cddavCallback)(unsigned short,unsigned short);
310
///////////////////////////////////////////////////////////
312
///////////////////////////////////////////////////////////
317
extern char * pConfigFile;
322
///////////////////////////////////////////////////////////
324
///////////////////////////////////////////////////////////
329
extern unsigned long LastWrite;
330
extern unsigned long LastPlay;
335
///////////////////////////////////////////////////////////
337
///////////////////////////////////////////////////////////
342
extern int iDoRecord;
347
///////////////////////////////////////////////////////////
349
///////////////////////////////////////////////////////////
353
extern xa_decode_t * xapGlobal;
355
extern unsigned long * XAFeed;
356
extern unsigned long * XAPlay;
357
extern unsigned long * XAStart;
358
extern unsigned long * XAEnd;
360
extern unsigned long XARepeat;
361
extern unsigned long XALastVal;
363
extern int iLeftXAVol;
364
extern int iRightXAVol;
368
///////////////////////////////////////////////////////////
370
///////////////////////////////////////////////////////////
374
extern int * sRVBPlay[];
375
extern int * sRVBEnd[];
376
extern int * sRVBStart[];
380
#endif // PEOPS2_EXTERNALS