X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=blobdiff_plain;f=plugins%2Fdfsound%2Fregisters.c;h=983af8c91627829eefc29606b44385ca3bd90167;hp=5ab519b86fa479822f06244f5e7558d3e936ec1e;hb=77d6fd631e4c4efc26333ae43888855b9961493e;hpb=b00afb7734d75d4e625db0263548fa15b9aa0af7 diff --git a/plugins/dfsound/registers.c b/plugins/dfsound/registers.c index 5ab519b8..983af8c9 100644 --- a/plugins/dfsound/registers.c +++ b/plugins/dfsound/registers.c @@ -22,7 +22,6 @@ #include "externals.h" #include "registers.h" #include "regs.h" -#include "reverb.h" /* // adsr time values (in ms) by James Higgs ... see the end of @@ -76,13 +75,14 @@ void CALLBACK SPUwriteRegister(unsigned long reg, unsigned short val) //------------------------------------------------// level with pre-calcs case 8: { - const unsigned long lval=val;unsigned long lx; + const unsigned long lval=val; //---------------------------------------------// s_chan[ch].ADSRX.AttackModeExp=(lval&0x8000)?1:0; s_chan[ch].ADSRX.AttackRate=(lval>>8) & 0x007f; s_chan[ch].ADSRX.DecayRate=(lval>>4) & 0x000f; s_chan[ch].ADSRX.SustainLevel=lval & 0x000f; //---------------------------------------------// +#if 0 if(!iDebugMode) break; //---------------------------------------------// stuff below is only for debug mode @@ -110,12 +110,13 @@ void CALLBACK SPUwriteRegister(unsigned long reg, unsigned short val) } s_chan[ch].ADSR.DecayTime = // so calc how long does it take to run from 100% to the wanted sus level (lx*(1024-s_chan[ch].ADSR.SustainLevel))/1024; +#endif } break; //------------------------------------------------// adsr times with pre-calcs case 10: { - const unsigned long lval=val;unsigned long lx; + const unsigned long lval=val; //----------------------------------------------// s_chan[ch].ADSRX.SustainModeExp = (lval&0x8000)?1:0; @@ -124,6 +125,7 @@ void CALLBACK SPUwriteRegister(unsigned long reg, unsigned short val) s_chan[ch].ADSRX.ReleaseModeExp = (lval&0x0020)?1:0; s_chan[ch].ADSRX.ReleaseRate = lval & 0x001f; //----------------------------------------------// +#if 0 if(!iDebugMode) break; //----------------------------------------------// stuff below is only for debug mode @@ -155,6 +157,7 @@ void CALLBACK SPUwriteRegister(unsigned long reg, unsigned short val) if(lval & 0x4000) // add/dec flag s_chan[ch].ADSR.SustainModeDec=-1; else s_chan[ch].ADSR.SustainModeDec=1; +#endif } break; //------------------------------------------------// adsr volume... mmm have to investigate this @@ -164,8 +167,9 @@ void CALLBACK SPUwriteRegister(unsigned long reg, unsigned short val) case 14: // loop? //WaitForSingleObject(s_chan[ch].hMutex,2000); // -> no multithread fuckups s_chan[ch].pLoop=spuMemC+((unsigned long)((val<<3)&~0xf)); - s_chan[ch].bIgnoreLoop=1; + //s_chan[ch].bIgnoreLoop=1; //ReleaseMutex(s_chan[ch].hMutex); // -> oki, on with the thread + dwChannelDead&=~(1<>4)-0xc0; - if(s_chan[ch].bNew) return 1; // we are started, but not processed? return 1 - if(s_chan[ch].ADSRX.lVolume && // same here... we haven't decoded one sample yet, so no envelope yet. return 1 as well - !s_chan[ch].ADSRX.EnvelopeVol) + if(dwNewChannel&(1<>16); } @@ -372,7 +371,6 @@ unsigned short CALLBACK SPUreadRegister(unsigned long reg) case 14: // get loop address { const int ch=(r>>4)-0xc0; - if(s_chan[ch].pLoop==NULL) return 0; return (unsigned short)((s_chan[ch].pLoop-spuMemC)>>3); } } @@ -421,18 +419,19 @@ void SoundOn(int start,int end,unsigned short val) // SOUND ON PSX COMAND for(ch=start;ch>=1) // loop channels { - if((val&1) && s_chan[ch].pStart) // mmm... start has to be set before key on !?! + if((val&1) && regAreaGet(ch,6)) // mmm... start has to be set before key on !?! { s_chan[ch].bIgnoreLoop=0; - s_chan[ch].bNew=1; // do this here, not in StartSound // - fixes fussy timing issues s_chan[ch].bStop=0; - s_chan[ch].bOn=1; - s_chan[ch].pCurr=s_chan[ch].pStart; + s_chan[ch].pCurr=spuMemC+((regAreaGet(ch,6)&~1)<<3); // must be block aligned + s_chan[ch].pLoop=spuMemC+((regAreaGet(ch,14)&~1)<<3); dwNewChannel|=(1< turn off fmod + if(ch>0&&s_chan[ch-1].bFMod==2) + s_chan[ch-1].bFMod=0; } } } @@ -493,14 +493,7 @@ void NoiseOn(int start,int end,unsigned short val) // NOISE ON PSX COMMAND for(ch=start;ch>=1) // loop channels { - if(val&1) // -> noise on/off - { - s_chan[ch].bNoise=1; - } - else - { - s_chan[ch].bNoise=0; - } + s_chan[ch].bNoise=val&1; // -> noise on/off } } @@ -513,8 +506,6 @@ void NoiseOn(int start,int end,unsigned short val) // NOISE ON PSX COMMAND void SetVolumeL(unsigned char ch,short vol) // LEFT VOLUME { - s_chan[ch].iLeftVolRaw=vol; - if(vol&0x8000) // sweep? { short sInc=1; // -> sweep up? @@ -541,8 +532,6 @@ void SetVolumeL(unsigned char ch,short vol) // LEFT VOLUME void SetVolumeR(unsigned char ch,short vol) // RIGHT VOLUME { - s_chan[ch].iRightVolRaw=vol; - if(vol&0x8000) // comments... see above :) { short sInc=1; @@ -590,13 +579,6 @@ void ReverbOn(int start,int end,unsigned short val) // REVERB ON PSX COMMAND for(ch=start;ch>=1) // loop channels { - if(val&1) // -> reverb on/off - { - s_chan[ch].bReverb=1; - } - else - { - s_chan[ch].bReverb=0; - } + s_chan[ch].bReverb=val&1; // -> reverb on/off } }