X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=plugins%2Fdfsound%2Fspu.c;h=ed5b4b5c79506c4ca06b035c5f3a709f2c9c1611;hb=refs%2Fremotes%2Fgithub%2Fmaster;hp=ad86cabc8be39c895e7556d4d79c38148f2a3b83;hpb=8fb79cd1347e938cfecd799ad8ce7934164d6d63;p=pcsx_rearmed.git diff --git a/plugins/dfsound/spu.c b/plugins/dfsound/spu.c index ad86cabc..c14f6469 100644 --- a/plugins/dfsound/spu.c +++ b/plugins/dfsound/spu.c @@ -33,7 +33,7 @@ #include "arm_features.h" #endif -#ifdef HAVE_ARMV7 +#ifdef HAVE_ARMV6 #define ssat32_to_16(v) \ asm("ssat %0,#16,%1" : "=r" (v) : "r" (v)) #else @@ -333,11 +333,11 @@ INLINE int GetInterpolationGauss(const sample_buf *sb, int spos) int gpos = sb->interp.gauss.pos; int vl = (spos >> 6) & ~3; int vr; - vr = (gauss[vl+0] * gval(0)) >> 15; - vr += (gauss[vl+1] * gval(1)) >> 15; - vr += (gauss[vl+2] * gval(2)) >> 15; - vr += (gauss[vl+3] * gval(3)) >> 15; - return vr; + vr = gauss[vl+0] * gval(0); + vr += gauss[vl+1] * gval(1); + vr += gauss[vl+2] * gval(2); + vr += gauss[vl+3] * gval(3); + return vr >> 15; } static void decode_block_data(int *dest, const unsigned char *src, int predict_nr, int shift_factor) @@ -1000,8 +1000,10 @@ static void queue_channel_work(int ns_to, unsigned int silentch) if (unlikely(s_chan->bFMod == 2)) { // sucks, have to do double work - assert(!s_chan->bNoise); - d = do_samples_gauss(tmpFMod, decode_block, NULL, ch, ns_to, + if (s_chan->bNoise) + d = do_samples_noise(tmpFMod, ch, ns_to); + else + d = do_samples_gauss(tmpFMod, decode_block, NULL, ch, ns_to, &spu.sb[ch], s_chan->sinc, &s_chan->spos, &s_chan->iSBPos); if (!s_chan->bStarting) { d = MixADSR(tmpFMod, &s_chan->ADSRX, d); @@ -1243,6 +1245,7 @@ void do_samples(unsigned int cycles_to, int force_no_thread) spu.cycles_played += ns_to * 768; spu.decode_pos = (spu.decode_pos + ns_to) & 0x1ff; + spu.spuStat = (spu.spuStat & ~0x800) | ((spu.decode_pos << 3) & 0x800); #if 0 static int ccount; static time_t ctime; ccount++; if (time(NULL) != ctime) @@ -1253,8 +1256,8 @@ void do_samples(unsigned int cycles_to, int force_no_thread) static void do_samples_finish(int *SSumLR, int ns_to, int silentch, int decode_pos) { - int vol_l = ((int)regAreaGet(H_SPUmvolL) << 17) >> 17; - int vol_r = ((int)regAreaGet(H_SPUmvolR) << 17) >> 17; + int vol_l = ((int)regAreaGet(H_SPUcmvolL) << 16) >> 17; + int vol_r = ((int)regAreaGet(H_SPUcmvolR) << 16) >> 17; int ns; int d; @@ -1386,6 +1389,7 @@ void CALLBACK SPUplayADPCMchannel(xa_decode_t *xap, unsigned int cycle, int is_s FeedXA(xap); // call main XA feeder spu.xapGlobal = xap; // store info for save states + spu.cdClearSamples = 512; } // CDDA AUDIO @@ -1398,6 +1402,7 @@ int CALLBACK SPUplayCDDAchannel(short *pcm, int nbytes, unsigned int cycle, int do_samples(cycle, 1); // catch up to prevent source underflows later FeedCDDA((unsigned char *)pcm, nbytes); + spu.cdClearSamples = 512; return 0; } @@ -1569,6 +1574,14 @@ static void exit_spu_thread(void) #endif +long CALLBACK SPUfreeze(unsigned int ulFreezeMode, struct SPUFreeze * pF, + unsigned int cycles) +{ + if (worker != NULL) + sync_worker_thread(1); + return DoFreeze(ulFreezeMode, pF, cycles); +} + // SPUINIT: this func will be called first by the main emu long CALLBACK SPUinit(void) { @@ -1718,6 +1731,9 @@ void spu_get_debug_info(int *chans_out, int *run_chans, int *fmod_chans_out, int *run_chans = ~spu.dwChannelsAudible & ~spu.dwChannelDead & irq_chans; *fmod_chans_out = fmod_chans; *noise_chans_out = noise_chans; + // sometimes unused + (void)do_samples_skip_fmod; + (void)SkipADSR; } // vim:shiftwidth=1:expandtab