static int check_irq(int ch, unsigned char *pos)
{
- if((spu.spuCtrl & CTRL_IRQ) && pos == spu.pSpuIrq)
+ if((spu.spuCtrl & (CTRL_ON|CTRL_IRQ)) == (CTRL_ON|CTRL_IRQ) && pos == spu.pSpuIrq)
{
//printf("ch%d irq %04x\n", ch, pos - spu.spuMemC);
do_irq();
return 0;
}
+void check_irq_io(unsigned int addr)
+{
+ unsigned int irq_addr = regAreaGet(H_SPUirqAddr) << 3;
+ //addr &= ~7; // ?
+ if((spu.spuCtrl & (CTRL_ON|CTRL_IRQ)) == (CTRL_ON|CTRL_IRQ) && addr == irq_addr)
+ {
+ //printf("io irq %04x\n", irq_addr);
+ do_irq();
+ }
+}
+
////////////////////////////////////////////////////////////////////////
// START SOUND... called by main thread to setup a new sound on a channel
////////////////////////////////////////////////////////////////////////
spu.dwNewChannel&=~(1<<ch); // clear new channel bit
spu.dwChannelDead&=~(1<<ch);
- if (s_chan->iRawPitch)
- spu.dwChannelsAudible|=1<<ch;
+ spu.dwChannelsAudible|=1<<ch;
}
static void StartSound(int ch)
d = SkipADSR(&s_chan->ADSRX, d);
if (d < ns_to) {
spu.dwChannelsAudible &= ~(1 << ch);
+ s_chan->ADSRX.State = ADSR_RELEASE;
s_chan->ADSRX.EnvelopeVol = 0;
}
}
do_irq();
}
}
+ check_irq_io(spu.spuAddr);
if (unlikely(spu.rvb->dirty))
REVERBPrep();