X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=blobdiff_plain;f=plugins%2Fdfsound%2Fexternals.h;h=d3bcbc6b9bdf77b0d2da5380ff5749b9c07737e9;hp=7935cb99fea38875e5bebe2e782333df6e5afb51;hb=de4a0279efefdd2e4595c8fc27f1564f4bff9341;hpb=3154bfab51566cbaa5bce3965d4c915bfb1b4f53 diff --git a/plugins/dfsound/externals.h b/plugins/dfsound/externals.h index 7935cb99..d3bcbc6b 100644 --- a/plugins/dfsound/externals.h +++ b/plugins/dfsound/externals.h @@ -53,10 +53,17 @@ // struct defines /////////////////////////////////////////////////////////// +enum ADSR_State { + ADSR_ATTACK = 0, + ADSR_DECAY = 1, + ADSR_SUSTAIN = 2, + ADSR_RELEASE = 3, +}; + // ADSR INFOS PER CHANNEL typedef struct { - unsigned char State:2; + unsigned char State:2; // ADSR_State unsigned char AttackModeExp:1; unsigned char SustainModeExp:1; unsigned char SustainIncrease:1; @@ -93,7 +100,6 @@ typedef struct unsigned char * pCurr; // current pos in sound mem unsigned char * pLoop; // loop ptr in sound mem - 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 @@ -104,8 +110,6 @@ typedef struct int iRightVolume; // right volume ADSRInfoEx ADSRX; int iRawPitch; // raw pitch (0...3fff) - - int SB[32+4]; } SPUCHAN; /////////////////////////////////////////////////////////// @@ -169,13 +173,18 @@ typedef struct // psx buffers / addresses +#define SB_SIZE (32 + 4) + typedef struct { unsigned short spuCtrl; unsigned short spuStat; unsigned int spuAddr; - unsigned char * spuMemC; + union { + unsigned char *spuMemC; + unsigned short *spuMem; + }; unsigned char * pSpuIrq; unsigned int cycles_played; @@ -216,9 +225,11 @@ typedef struct int iLeftXAVol; int iRightXAVol; - int pad[32]; + SPUCHAN * s_chan; + int * SB; + + int pad[30]; unsigned short regArea[0x400]; - unsigned short spuMem[256*1024]; } SPUInfo; /////////////////////////////////////////////////////////// @@ -228,19 +239,18 @@ typedef struct #ifndef _IN_SPU extern SPUInfo spu; -extern SPUCHAN s_chan[]; extern REVERBInfo rvb; -void do_samples(unsigned int cycles_to); +void do_samples(unsigned int cycles_to, int do_sync); void schedule_next_irq(void); #define regAreaGet(ch,offset) \ spu.regArea[((ch<<4)|(offset))>>1] -#define do_samples_if_needed(c) \ +#define do_samples_if_needed(c, sync) \ do { \ - if ((int)((c) - spu.cycles_played) >= 16 * 768) \ - do_samples(c); \ + if (sync || (int)((c) - spu.cycles_played) >= 16 * 768) \ + do_samples(c, sync); \ } while (0) #endif