*/\r
//-------------------------------------------------//\r
case H_SPUon1:\r
+ spu.last_keyon_cycles = cycles;\r
do_samples_if_needed(cycles, 0, 2);\r
SoundOn(0,16,val);\r
break;\r
//-------------------------------------------------//\r
case H_SPUon2:\r
+ spu.last_keyon_cycles = cycles;\r
do_samples_if_needed(cycles, 0, 2);\r
SoundOn(16,24,val);\r
break;\r
//-------------------------------------------------//\r
case H_SPUoff1:\r
+ if (cycles - spu.last_keyon_cycles < 786u) {\r
+ if (val & regAreaGet(H_SPUon1))\r
+ log_unhandled("koff1 %04x %d\n", val, cycles - spu.last_keyon_cycles);\r
+ val &= ~regAreaGet(H_SPUon1);\r
+ }\r
SoundOff(0,16,val);\r
break;\r
//-------------------------------------------------//\r
case H_SPUoff2:\r
+ if (cycles - spu.last_keyon_cycles < 786u) {\r
+ if (val & regAreaGet(H_SPUon1))\r
+ log_unhandled("koff2 %04x %d\n", val, cycles - spu.last_keyon_cycles);\r
+ val &= ~regAreaGet(H_SPUon2);\r
+ }\r
SoundOff(16,24,val);\r
break;\r
//-------------------------------------------------//\r
static void SoundOff(int start,int end,unsigned short val)\r
{\r
int ch;\r
- for(ch=start;ch<end;ch++,val>>=1) // loop channels\r
+ for (ch = start; val && ch < end; ch++, val >>= 1) // loop channels\r
{\r
if(val&1)\r
{\r
spu.s_chan[ch].bReverb=val&1; // -> reverb on/off\r
}\r
}\r
+\r
+// vim:shiftwidth=1:expandtab\r