~ubuntu-branches/debian/jessie/audacious-plugins/jessie

« back to all changes in this revision

Viewing changes to src/psf/peops2/externals.h

  • Committer: Package Import Robot
  • Author(s): Alessio Treglia
  • Date: 2012-02-20 00:28:16 UTC
  • mfrom: (1.1.16)
  • Revision ID: package-import@ubuntu.com-20120220002816-mgn4vhn314z6mubs
Tags: 3.2.1-1
* Team upload.
* New upstream bugfix release.
* Remove correct_spelling_error.diff, applied upstream.
* Refresh ffaudio.diff.
* Reintroduce src/psf/*, it seems DFSG clean now.
* Fix and update debian/copyright.
* Update watch file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
                         externals.h  -  description
 
3
                             -------------------
 
4
    begin                : Wed May 15 2002
 
5
    copyright            : (C) 2002 by Pete Bernert
 
6
    email                : BlackDove@addcom.de
 
7
 ***************************************************************************/
 
8
 
 
9
/***************************************************************************
 
10
 *                                                                         *
 
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.                                              *
 
16
 *                                                                         *
 
17
 ***************************************************************************/
 
18
 
 
19
//*************************************************************************//
 
20
// History of changes:
 
21
//
 
22
// 2004/04/04 - Pete
 
23
// - changed plugin to emulate PS2 spu
 
24
//
 
25
// 2002/04/04 - Pete
 
26
// - increased channel struct for interpolation
 
27
//
 
28
// 2002/05/15 - Pete
 
29
// - generic cleanup for the Peops release
 
30
//
 
31
//*************************************************************************//
 
32
 
 
33
#ifndef PEOPS2_EXTERNALS
 
34
#define PEOPS2_EXTERNALS
 
35
 
 
36
#include "ao.h"
 
37
 
 
38
typedef int8 s8;
 
39
typedef int16 s16;
 
40
typedef int32 s32;
 
41
typedef int64 s64;
 
42
 
 
43
typedef uint8 u8;
 
44
typedef uint16 u16;
 
45
typedef uint32 u32;
 
46
typedef uint64 u64;
 
47
 
 
48
#if LSB_FIRST
 
49
static INLINE u16 BFLIP16(u16 x)
 
50
{
 
51
 return x;
 
52
}
 
53
#else
 
54
static INLINE u16 BFLIP16(u16 x)
 
55
{
 
56
 return( ((x>>8)&0xFF)| ((x&0xFF)<<8) );
 
57
}
 
58
#endif
 
59
 
 
60
/////////////////////////////////////////////////////////
 
61
// generic defines
 
62
/////////////////////////////////////////////////////////
 
63
 
 
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
 
69
 
 
70
////////////////////////////////////////////////////////////////////////
 
71
// spu defines
 
72
////////////////////////////////////////////////////////////////////////
 
73
 
 
74
// sound buffer sizes
 
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
 
79
 
 
80
// num of channels
 
81
#define MAXCHAN     48
 
82
#define HLFCHAN     24
 
83
 
 
84
// ~ 1 ms of data (was 45)
 
85
#define NSSIZE  1
 
86
//45
 
87
 
 
88
///////////////////////////////////////////////////////////
 
89
// struct defines
 
90
///////////////////////////////////////////////////////////
 
91
 
 
92
// ADSR INFOS PER CHANNEL
 
93
typedef struct
 
94
{
 
95
 int            AttackModeExp;
 
96
 long           AttackTime;
 
97
 long           DecayTime;
 
98
 long           SustainLevel;
 
99
 int            SustainModeExp;
 
100
 long           SustainModeDec;
 
101
 long           SustainTime;
 
102
 int            ReleaseModeExp;
 
103
 unsigned long  ReleaseVal;
 
104
 long           ReleaseTime;
 
105
 long           ReleaseStartTime;
 
106
 long           ReleaseVol;
 
107
 long           lTime;
 
108
 long           lVolume;
 
109
} ADSRInfo;
 
110
 
 
111
typedef struct
 
112
{
 
113
 int            State;
 
114
 int            AttackModeExp;
 
115
 int            AttackRate;
 
116
 int            DecayRate;
 
117
 int            SustainLevel;
 
118
 int            SustainModeExp;
 
119
 int            SustainIncrease;
 
120
 int            SustainRate;
 
121
 int            ReleaseModeExp;
 
122
 int            ReleaseRate;
 
123
 int            EnvelopeVol;
 
124
 long           lVolume;
 
125
 long           lDummy1;
 
126
 long           lDummy2;
 
127
} ADSRInfoEx;
 
128
 
 
129
///////////////////////////////////////////////////////////
 
130
 
 
131
// Tmp Flags
 
132
 
 
133
// used for debug channel muting
 
134
#define FLAG_MUTE  1
 
135
 
 
136
// used for simple interpolation
 
137
#define FLAG_IPOL0 2
 
138
#define FLAG_IPOL1 4
 
139
 
 
140
///////////////////////////////////////////////////////////
 
141
 
 
142
// MAIN CHANNEL STRUCT
 
143
typedef struct
 
144
{
 
145
 // no mutexes used anymore... don't need them to sync access
 
146
 //HANDLE            hMutex;
 
147
 
 
148
 int               bNew;                               // start flag
 
149
 
 
150
 int               iSBPos;                             // mixing stuff
 
151
 int               spos;
 
152
 int               sinc;
 
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? :)
 
154
 int               sval;
 
155
 
 
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
 
159
 
 
160
 int               iStartAdr;
 
161
 int               iLoopAdr;
 
162
 int               iNextAdr;
 
163
 
 
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
 
168
 int               bReverbR;
 
169
 
 
170
 int               bVolumeL;                           // Volume on/off
 
171
 int               bVolumeR;
 
172
 
 
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
 
184
 int               s_2;
 
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)
 
191
 
 
192
} SPUCHAN;
 
193
 
 
194
///////////////////////////////////////////////////////////
 
195
 
 
196
typedef struct
 
197
{
 
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
 
201
 
 
202
 int VolLeft;
 
203
 int VolRight;
 
204
 int iLastRVBLeft;
 
205
 int iLastRVBRight;
 
206
 int iRVBLeft;
 
207
 int iRVBRight;
 
208
 int iCnt;
 
209
 
 
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.)
 
219
 int FB_X;           // (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.)
 
242
} REVERBInfo;
 
243
 
 
244
#ifdef _WINDOWS
 
245
//extern HINSTANCE hInst;
 
246
//#define WM_MUTE (WM_USER+543)
 
247
#endif
 
248
 
 
249
///////////////////////////////////////////////////////////
 
250
// SPU.C globals
 
251
///////////////////////////////////////////////////////////
 
252
 
 
253
#ifndef _IN_SPU
 
254
 
 
255
// psx buffers / addresses
 
256
 
 
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;
 
262
 
 
263
// user settings
 
264
 
 
265
extern int        iUseXA;
 
266
extern int        iVolume;
 
267
extern int        iXAPitch;
 
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;
 
275
// MISC
 
276
 
 
277
extern SPUCHAN s_chan[];
 
278
extern REVERBInfo rvb[];
 
279
 
 
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[];
 
287
 
 
288
extern int      bEndThread;
 
289
extern int      bThreadEnded;
 
290
extern int      bSpuInit;
 
291
 
 
292
extern int      SSumR[];
 
293
extern int      SSumL[];
 
294
extern int      iCycle;
 
295
extern short *  pS;
 
296
extern unsigned long dwNewChannel2[];
 
297
extern unsigned long dwEndChannel2[];
 
298
 
 
299
extern int iSpuAsyncWait;
 
300
 
 
301
#ifdef _WINDOWS
 
302
//extern HWND    hWMain;                               // window handle
 
303
//extern HWND    hWDebug;
 
304
#endif
 
305
 
 
306
extern void (CALLBACK *cddavCallback)(unsigned short,unsigned short);
 
307
 
 
308
#endif
 
309
 
 
310
///////////////////////////////////////////////////////////
 
311
// CFG.C globals
 
312
///////////////////////////////////////////////////////////
 
313
 
 
314
#ifndef _IN_CFG
 
315
 
 
316
#ifndef _WINDOWS
 
317
extern char * pConfigFile;
 
318
#endif
 
319
 
 
320
#endif
 
321
 
 
322
///////////////////////////////////////////////////////////
 
323
// DSOUND.C globals
 
324
///////////////////////////////////////////////////////////
 
325
 
 
326
#ifndef _IN_DSOUND
 
327
 
 
328
#ifdef _WINDOWS
 
329
extern unsigned long LastWrite;
 
330
extern unsigned long LastPlay;
 
331
#endif
 
332
 
 
333
#endif
 
334
 
 
335
///////////////////////////////////////////////////////////
 
336
// RECORD.C globals
 
337
///////////////////////////////////////////////////////////
 
338
 
 
339
#ifndef _IN_RECORD
 
340
 
 
341
#ifdef _WINDOWS
 
342
extern int iDoRecord;
 
343
#endif
 
344
 
 
345
#endif
 
346
 
 
347
///////////////////////////////////////////////////////////
 
348
// XA.C globals
 
349
///////////////////////////////////////////////////////////
 
350
 
 
351
#ifndef _IN_XA
 
352
 
 
353
extern xa_decode_t   * xapGlobal;
 
354
 
 
355
extern unsigned long * XAFeed;
 
356
extern unsigned long * XAPlay;
 
357
extern unsigned long * XAStart;
 
358
extern unsigned long * XAEnd;
 
359
 
 
360
extern unsigned long   XARepeat;
 
361
extern unsigned long   XALastVal;
 
362
 
 
363
extern int           iLeftXAVol;
 
364
extern int           iRightXAVol;
 
365
 
 
366
#endif
 
367
 
 
368
///////////////////////////////////////////////////////////
 
369
// REVERB.C globals
 
370
///////////////////////////////////////////////////////////
 
371
 
 
372
#ifndef _IN_REVERB
 
373
 
 
374
extern int *          sRVBPlay[];
 
375
extern int *          sRVBEnd[];
 
376
extern int *          sRVBStart[];
 
377
 
 
378
#endif
 
379
 
 
380
#endif // PEOPS2_EXTERNALS