//------------------------------------------------//\r
case 14: // loop?\r
spu.s_chan[ch].pLoop=spu.spuMemC+((val&~1)<<3);\r
+ spu.s_chan[ch].bIgnoreLoop = 1;\r
goto upd_irq;\r
//------------------------------------------------//\r
}\r
break;\r
//-------------------------------------------------//\r
case H_SPUReverbAddr:\r
- if(val==0xFFFF || val<=0x200)\r
- {spu.rvb->StartAddr=spu.rvb->CurrAddr=0;}\r
- else\r
- {\r
- const long iv=(unsigned long)val<<2;\r
- if(spu.rvb->StartAddr!=iv)\r
- {\r
- spu.rvb->StartAddr=(unsigned long)val<<2;\r
- spu.rvb->CurrAddr=spu.rvb->StartAddr;\r
- }\r
- }\r
goto rvbd;\r
//-------------------------------------------------//\r
case H_SPUirqAddr:\r
+ //if (val & 1)\r
+ // log_unhandled("w irq with lsb: %08lx %04x\n", reg, val);\r
spu.pSpuIrq=spu.spuMemC+(((unsigned long) val<<3)&~0xf);\r
goto upd_irq;\r
//-------------------------------------------------//\r
break;\r
//-------------------------------------------------//\r
\r
+ case H_SPUmvolL:\r
+ case H_SPUmvolR:\r
+ if (val & 0x8000)\r
+ log_unhandled("w master sweep: %08lx %04x\n", reg, val);\r
+ break;\r
+\r
+ case 0x0dac:\r
+ if (val != 4)\r
+ log_unhandled("1f801dac %04x\n", val);\r
+ break;\r
+\r
/*\r
case H_ExtLeft:\r
//auxprintf("EL %d\n",val);\r
break;\r
//-------------------------------------------------//\r
case H_CDLeft:\r
- spu.iLeftXAVol=val & 0x7fff;\r
- if(spu.cddavCallback) spu.cddavCallback(0,val);\r
+ spu.iLeftXAVol=(int16_t)val;\r
+ if(spu.cddavCallback) spu.cddavCallback(0,(int16_t)val);\r
break;\r
case H_CDRight:\r
- spu.iRightXAVol=val & 0x7fff;\r
- if(spu.cddavCallback) spu.cddavCallback(1,val);\r
+ spu.iRightXAVol=(int16_t)val;\r
+ if(spu.cddavCallback) spu.cddavCallback(1,(int16_t)val);\r
break;\r
//-------------------------------------------------//\r
case H_FMod1:\r
ReverbOn(16,24,val);\r
break;\r
//-------------------------------------------------//\r
- case H_Reverb+0 : spu.rvb->FB_SRC_A=val*4; goto rvbd;\r
- case H_Reverb+2 : spu.rvb->FB_SRC_B=val*4; goto rvbd;\r
- case H_Reverb+4 : spu.rvb->IIR_ALPHA=(short)val; goto rvbd;\r
- case H_Reverb+6 : spu.rvb->ACC_COEF_A=(short)val; goto rvbd;\r
- case H_Reverb+8 : spu.rvb->ACC_COEF_B=(short)val; goto rvbd;\r
- case H_Reverb+10 : spu.rvb->ACC_COEF_C=(short)val; goto rvbd;\r
- case H_Reverb+12 : spu.rvb->ACC_COEF_D=(short)val; goto rvbd;\r
- case H_Reverb+14 : spu.rvb->IIR_COEF=(short)val; goto rvbd;\r
- case H_Reverb+16 : spu.rvb->FB_ALPHA=(short)val; goto rvbd;\r
- case H_Reverb+18 : spu.rvb->FB_X=(short)val; goto rvbd;\r
- case H_Reverb+20 : spu.rvb->IIR_DEST_A0=val*4; goto rvbd;\r
- case H_Reverb+22 : spu.rvb->IIR_DEST_A1=val*4; goto rvbd;\r
- case H_Reverb+24 : spu.rvb->ACC_SRC_A0=val*4; goto rvbd;\r
- case H_Reverb+26 : spu.rvb->ACC_SRC_A1=val*4; goto rvbd;\r
- case H_Reverb+28 : spu.rvb->ACC_SRC_B0=val*4; goto rvbd;\r
- case H_Reverb+30 : spu.rvb->ACC_SRC_B1=val*4; goto rvbd;\r
- case H_Reverb+32 : spu.rvb->IIR_SRC_A0=val*4; goto rvbd;\r
- case H_Reverb+34 : spu.rvb->IIR_SRC_A1=val*4; goto rvbd;\r
- case H_Reverb+36 : spu.rvb->IIR_DEST_B0=val*4; goto rvbd;\r
- case H_Reverb+38 : spu.rvb->IIR_DEST_B1=val*4; goto rvbd;\r
- case H_Reverb+40 : spu.rvb->ACC_SRC_C0=val*4; goto rvbd;\r
- case H_Reverb+42 : spu.rvb->ACC_SRC_C1=val*4; goto rvbd;\r
- case H_Reverb+44 : spu.rvb->ACC_SRC_D0=val*4; goto rvbd;\r
- case H_Reverb+46 : spu.rvb->ACC_SRC_D1=val*4; goto rvbd;\r
- case H_Reverb+48 : spu.rvb->IIR_SRC_B1=val*4; goto rvbd;\r
- case H_Reverb+50 : spu.rvb->IIR_SRC_B0=val*4; goto rvbd;\r
- case H_Reverb+52 : spu.rvb->MIX_DEST_A0=val*4; goto rvbd;\r
- case H_Reverb+54 : spu.rvb->MIX_DEST_A1=val*4; goto rvbd;\r
- case H_Reverb+56 : spu.rvb->MIX_DEST_B0=val*4; goto rvbd;\r
- case H_Reverb+58 : spu.rvb->MIX_DEST_B1=val*4; goto rvbd;\r
- case H_Reverb+60 : spu.rvb->IN_COEF_L=(short)val; goto rvbd;\r
- case H_Reverb+62 : spu.rvb->IN_COEF_R=(short)val; goto rvbd;\r
+ case H_Reverb+0 : goto rvbd;\r
+ case H_Reverb+2 : goto rvbd;\r
+ case H_Reverb+4 : spu.rvb->IIR_ALPHA=(short)val; break;\r
+ case H_Reverb+6 : spu.rvb->ACC_COEF_A=(short)val; break;\r
+ case H_Reverb+8 : spu.rvb->ACC_COEF_B=(short)val; break;\r
+ case H_Reverb+10 : spu.rvb->ACC_COEF_C=(short)val; break;\r
+ case H_Reverb+12 : spu.rvb->ACC_COEF_D=(short)val; break;\r
+ case H_Reverb+14 : spu.rvb->IIR_COEF=(short)val; break;\r
+ case H_Reverb+16 : spu.rvb->FB_ALPHA=(short)val; break;\r
+ case H_Reverb+18 : spu.rvb->FB_X=(short)val; break;\r
+ case H_Reverb+20 : goto rvbd;\r
+ case H_Reverb+22 : goto rvbd;\r
+ case H_Reverb+24 : goto rvbd;\r
+ case H_Reverb+26 : goto rvbd;\r
+ case H_Reverb+28 : goto rvbd;\r
+ case H_Reverb+30 : goto rvbd;\r
+ case H_Reverb+32 : goto rvbd;\r
+ case H_Reverb+34 : goto rvbd;\r
+ case H_Reverb+36 : goto rvbd;\r
+ case H_Reverb+38 : goto rvbd;\r
+ case H_Reverb+40 : goto rvbd;\r
+ case H_Reverb+42 : goto rvbd;\r
+ case H_Reverb+44 : goto rvbd;\r
+ case H_Reverb+46 : goto rvbd;\r
+ case H_Reverb+48 : goto rvbd;\r
+ case H_Reverb+50 : goto rvbd;\r
+ case H_Reverb+52 : goto rvbd;\r
+ case H_Reverb+54 : goto rvbd;\r
+ case H_Reverb+56 : goto rvbd;\r
+ case H_Reverb+58 : goto rvbd;\r
+ case H_Reverb+60 : spu.rvb->IN_COEF_L=(short)val; break;\r
+ case H_Reverb+62 : spu.rvb->IN_COEF_R=(short)val; break;\r
}\r
return;\r
\r
{\r
const int ch=(r>>4)-0xc0;\r
if(spu.dwNewChannel&(1<<ch)) return 1; // we are started, but not processed? return 1\r
- if((spu.dwChannelOn&(1<<ch)) && // same here... we haven't decoded one sample yet, so no envelope yet. return 1 as well\r
+ if((spu.dwChannelsAudible&(1<<ch)) && // same here... we haven't decoded one sample yet, so no envelope yet. return 1 as well\r
!spu.s_chan[ch].ADSRX.EnvelopeVol)\r
return 1;\r
return (unsigned short)(spu.s_chan[ch].ADSRX.EnvelopeVol>>16);\r
return spu.spuCtrl;\r
\r
case H_SPUstat:\r
- return spu.spuStat;\r
+ return (spu.spuStat & ~0x3F) | (spu.spuCtrl & 0x3F);\r
\r
case H_SPUaddr:\r
return (unsigned short)(spu.spuAddr>>3);\r
//case H_SPUIsOn2:\r
// return IsSoundOn(16,24);\r
\r
+ case H_SPUMute1:\r
+ case H_SPUMute2:\r
+ log_unhandled("r isOn: %08lx\n", reg);\r
+ break;\r
}\r
\r
return spu.regArea[(r-0xc00)>>1];\r
\r
for(ch=start;ch<end;ch++,val>>=1) // loop channels\r
{\r
- if((val&1) && regAreaGet(ch,6)) // mmm... start has to be set before key on !?!\r
+ if((val&1) && regAreaGetCh(ch, 6)) // mmm... start has to be set before key on !?!\r
{\r
- spu.s_chan[ch].pCurr=spu.spuMemC+((regAreaGet(ch,6)&~1)<<3); // must be block aligned\r
- spu.s_chan[ch].pLoop=spu.spuMemC+((regAreaGet(ch,14)&~1)<<3);\r
+ spu.s_chan[ch].bIgnoreLoop = 0;\r
spu.dwNewChannel|=(1<<ch);\r
}\r
}\r
if(vol&0x8000) // sweep?\r
{\r
short sInc=1; // -> sweep up?\r
+ log_unhandled("ch%d sweepl %04x\n", ch, vol);\r
if(vol&0x2000) sInc=-1; // -> or down?\r
if(vol&0x1000) vol^=0xffff; // -> mmm... phase inverted? have to investigate this\r
vol=((vol&0x7f)+1)/2; // -> sweep: 0..127 -> 0..64\r
if(vol&0x8000) // comments... see above :)\r
{\r
short sInc=1;\r
+ log_unhandled("ch%d sweepr %04x\n", ch, vol);\r
if(vol&0x2000) sInc=-1;\r
if(vol&0x1000) vol^=0xffff;\r
vol=((vol&0x7f)+1)/2; \r
if(val>0x3fff) NP=0x3fff; // get pitch val\r
else NP=val;\r
\r
- spu.s_chan[ch].iRawPitch=NP;\r
- spu.s_chan[ch].sinc=(NP<<4)|8;\r
- spu.s_chan[ch].sinc_inv=0;\r
- if (spu_config.iUseInterpolation == 1)\r
- spu.SB[ch * SB_SIZE + 32] = 1; // -> freq change in simple interpolation mode: set flag\r
+ spu.s_chan[ch].iRawPitch = NP;\r
+ spu.s_chan[ch].sinc = NP << 4;\r
+ spu.s_chan[ch].sinc_inv = 0;\r
+ spu.s_chan[ch].bNewPitch = 1;\r
+\r
+ // don't mess spu.dwChannelsAudible as adsr runs independently\r
}\r
\r
////////////////////////////////////////////////////////////////////////\r