X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=blobdiff_plain;f=plugins%2Fdfsound%2Fexternals.h;h=28dab573c1c7a3b9d46a2f5291166e90788288ca;hp=f85620460acac2fd2ca56f6c8cbd364bef85ea91;hb=fa56d36096cd4ab2b227ce2aa61c8404b8874689;hpb=ef79bbde537d6b9c745a7d86cb9df1d04c35590d diff --git a/plugins/dfsound/externals.h b/plugins/dfsound/externals.h index f8562046..28dab573 100644 --- a/plugins/dfsound/externals.h +++ b/plugins/dfsound/externals.h @@ -21,6 +21,14 @@ // generic defines ///////////////////////////////////////////////////////// +#ifdef __GNUC__ +#define noinline __attribute__((noinline)) +#define unlikely(x) __builtin_expect((x), 0) +#else +#define noinline +#define unlikely(x) x +#endif + #define PSE_LT_SPU 4 #define PSE_SPU_ERR_SUCCESS 0 #define PSE_SPU_ERR -60 @@ -35,17 +43,13 @@ // spu defines //////////////////////////////////////////////////////////////////////// -// sound buffer sizes -// 400 ms complete sound buffer -#define SOUNDSIZE 70560 -// 137 ms test buffer... if less than that is buffered, a new upload will happen -#define TESTSIZE 24192 - // num of channels #define MAXCHAN 24 -// ~ 1 ms of data -#define NSSIZE 45 +// ~ FRAG_MSECS ms of data +// note: must be even due to the way reverb works now +#define FRAG_MSECS 2 +#define NSSIZE ((44100 * FRAG_MSECS / 1000 + 1) & ~1) /////////////////////////////////////////////////////////// // struct defines @@ -72,20 +76,17 @@ typedef struct typedef struct { - int State; - int AttackModeExp; - int AttackRate; - int DecayRate; - int SustainLevel; - int SustainModeExp; - int SustainIncrease; - int SustainRate; - int ReleaseModeExp; - int ReleaseRate; + unsigned char State:2; + unsigned char AttackModeExp:1; + unsigned char SustainModeExp:1; + unsigned char SustainIncrease:1; + unsigned char ReleaseModeExp:1; + unsigned char AttackRate; + unsigned char DecayRate; + unsigned char SustainLevel; + unsigned char SustainRate; + unsigned char ReleaseRate; int EnvelopeVol; - long lVolume; - long lDummy1; - long lDummy2; } ADSRInfoEx; /////////////////////////////////////////////////////////// @@ -104,45 +105,26 @@ typedef struct // MAIN CHANNEL STRUCT typedef struct { - // no mutexes used anymore... don't need them to sync access - //HANDLE hMutex; - - int bNew; // start flag - int iSBPos; // mixing stuff int spos; int sinc; - 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? :) - int sval; - unsigned char * pStart; // start ptr into sound mem unsigned char * pCurr; // current pos in sound mem unsigned char * pLoop; // loop ptr in sound mem - int bOn; // is channel active (sample playing?) - int bStop; // is channel stopped (sample _can_ still be playing, ADSR Release phase) - int bReverb; // can we do reverb on this channel? must have ctrl register bit, to get active - int iActFreq; // current psx pitch - int iUsedFreq; // current pc pitch + unsigned int bStop:1; // is channel stopped (sample _can_ still be playing, ADSR Release phase) + unsigned int bReverb:1; // can we do reverb on this channel? must have ctrl register bit, to get active + unsigned int bRVBActive:1; // reverb active flag + unsigned int bNoise:1; // noise active flag + unsigned int bFMod:2; // freq mod (0=off, 1=sound channel, 2=freq channel) + unsigned int prevflags:3; // flags from previous block + int iLeftVolume; // left volume - int iLeftVolRaw; // left psx volume value - int bIgnoreLoop; // ignore loop bit, if an external loop address is used - int iMute; // mute mode int iRightVolume; // right volume - int iRightVolRaw; // right psx volume value + ADSRInfoEx ADSRX; int iRawPitch; // raw pitch (0...3fff) - int iIrqDone; // debug irq done flag - int s_1; // last decoding infos - int s_2; - int bRVBActive; // reverb active flag - int iRVBOffset; // reverb offset - int iRVBRepeat; // reverb repeat - int bNoise; // noise active flag - int bFMod; // freq mod (0=off, 1=sound channel, 2=freq channel) - int iRVBNum; // another reverb helper - int iOldNoise; // old noise val for this channel - ADSRInfo ADSR; // active ADSR settings - ADSRInfoEx ADSRX; // next ADSR settings (will be moved to active on sample start) + + int SB[32+4]; } SPUCHAN; /////////////////////////////////////////////////////////// @@ -154,8 +136,6 @@ typedef struct int VolLeft; int VolRight; - int iLastRVBLeft; - int iLastRVBRight; int iRVBLeft; int iRVBRight; @@ -191,6 +171,17 @@ typedef struct int MIX_DEST_B1; // (offset) int IN_COEF_L; // (coef.) int IN_COEF_R; // (coef.) + + int dirty; // registers changed + + // normalized offsets + int nIIR_DEST_A0, nIIR_DEST_A1, nIIR_DEST_B0, nIIR_DEST_B1, + nACC_SRC_A0, nACC_SRC_A1, nACC_SRC_B0, nACC_SRC_B1, + nIIR_SRC_A0, nIIR_SRC_A1, nIIR_SRC_B0, nIIR_SRC_B1, + nACC_SRC_C0, nACC_SRC_C1, nACC_SRC_D0, nACC_SRC_D1, + nMIX_DEST_A0, nMIX_DEST_A1, nMIX_DEST_B0, nMIX_DEST_B1; + // MIX_DEST_xx - FB_SRC_x + int nFB_SRC_A0, nFB_SRC_A1, nFB_SRC_B0, nFB_SRC_B1; } REVERBInfo; /////////////////////////////////////////////////////////// @@ -207,20 +198,19 @@ extern unsigned char * spuMemC; extern unsigned char * pSpuIrq; extern unsigned char * pSpuBuffer; +#define regAreaGet(ch,offset) \ + regArea[((ch<<4)|(offset))>>1] + // user settings extern int iVolume; extern int iXAPitch; -extern int iUseTimer; -extern int iSPUIRQWait; -extern int iDebugMode; -extern int iRecordMode; extern int iUseReverb; extern int iUseInterpolation; -extern int iDisStereo; // MISC -extern int iSpuAsyncWait; +extern int had_dma; +extern int decode_pos; extern SPUCHAN s_chan[]; extern REVERBInfo rvb; @@ -230,10 +220,11 @@ extern unsigned short spuCtrl; extern unsigned short spuStat; extern unsigned short spuIrq; extern unsigned long spuAddr; -extern int bEndThread; -extern int bThreadEnded; extern int bSpuInit; -extern unsigned long dwNewChannel; +extern unsigned int dwNewChannel; +extern unsigned int dwChannelOn; +extern unsigned int dwPendingChanOff; +extern unsigned int dwChannelDead; extern int SSumR[]; extern int SSumL[]; @@ -257,9 +248,6 @@ extern uint32_t * XAPlay; extern uint32_t * XAStart; extern uint32_t * XAEnd; -extern uint32_t XARepeat; -extern uint32_t XALastVal; - extern uint32_t * CDDAFeed; extern uint32_t * CDDAPlay; extern uint32_t * CDDAStart; @@ -279,8 +267,5 @@ extern int iRightXAVol; extern int * sRVBPlay; extern int * sRVBEnd; extern int * sRVBStart; -extern int iReverbOff; -extern int iReverbRepeat; -extern int iReverbNum; #endif