X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=plugins%2Fdfsound%2Fexternals.h;h=3047afc81ed5a94b10b29ea6c87e7c250ae1d59c;hb=5514a050f4e936f5c333fa1271b11bf5a6a9ea39;hp=7935cb99fea38875e5bebe2e782333df6e5afb51;hpb=3154bfab51566cbaa5bce3965d4c915bfb1b4f53;p=pcsx_rearmed.git diff --git a/plugins/dfsound/externals.h b/plugins/dfsound/externals.h index 7935cb99..3047afc8 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 @@ -175,7 +181,10 @@ typedef struct 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,10 @@ typedef struct int iLeftXAVol; int iRightXAVol; - int pad[32]; + SPUCHAN * s_chan; + + int pad[31]; unsigned short regArea[0x400]; - unsigned short spuMem[256*1024]; } SPUInfo; /////////////////////////////////////////////////////////// @@ -228,19 +238,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