X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=blobdiff_plain;f=plugins%2Fdfsound%2Fregisters.c;h=19a0a46b2d61d9bf696e3cd33815c71d2d537f41;hp=b684914fa24ff120c136f9130bfe95c64f315427;hb=6d866bb7894b252fc430a24a97769511d5ead1ca;hpb=ef79bbde537d6b9c745a7d86cb9df1d04c35590d diff --git a/plugins/dfsound/registers.c b/plugins/dfsound/registers.c index b684914f..19a0a46b 100644 --- a/plugins/dfsound/registers.c +++ b/plugins/dfsound/registers.c @@ -70,18 +70,20 @@ void CALLBACK SPUwriteRegister(unsigned long reg, unsigned short val) break; //------------------------------------------------// start case 6: - s_chan[ch].pStart=spuMemC+((unsigned long) val<<3); + // Brain Dead 13 - align to 16 boundary + s_chan[ch].pStart= spuMemC+(unsigned long)((val<<3)&~0xf); break; //------------------------------------------------// 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 @@ -109,12 +111,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; @@ -123,6 +126,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 @@ -154,6 +158,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 @@ -162,7 +167,7 @@ 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); + s_chan[ch].pLoop=spuMemC+((unsigned long)((val<<3)&~0xf)); s_chan[ch].bIgnoreLoop=1; //ReleaseMutex(s_chan[ch].hMutex); // -> oki, on with the thread break; @@ -361,9 +366,9 @@ unsigned short CALLBACK SPUreadRegister(unsigned long reg) case 12: // get adsr vol { const int ch=(r>>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); } @@ -423,8 +428,14 @@ void SoundOn(int start,int end,unsigned short val) // SOUND ON PSX COMAND if((val&1) && s_chan[ch].pStart) // 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].pCurr=s_chan[ch].pStart; + dwNewChannel|=(1<>=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 } } @@ -500,8 +508,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? @@ -528,8 +534,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; @@ -577,13 +581,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 } }