diff options
author | notaz | 2013-03-16 04:14:24 +0200 |
---|---|---|
committer | notaz | 2013-03-17 02:14:19 +0200 |
commit | 16187bfb1518db23ade931cd7358ba973a585180 (patch) | |
tree | a4800f4093ece664943b35c23f99505336d2b718 /plugins | |
parent | 23ea11bd19868d36b8c06134184bf45c9308d26e (diff) | |
download | pcsx_rearmed-16187bfb1518db23ade931cd7358ba973a585180.tar.gz pcsx_rearmed-16187bfb1518db23ade931cd7358ba973a585180.tar.bz2 pcsx_rearmed-16187bfb1518db23ade931cd7358ba973a585180.zip |
spu: change sync again
will hurt audio if game is way too slow, but perhaps improve
sync situation a bit..
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/dfsound/spu.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/plugins/dfsound/spu.c b/plugins/dfsound/spu.c index b89ab1a..6cefd11 100644 --- a/plugins/dfsound/spu.c +++ b/plugins/dfsound/spu.c @@ -707,8 +707,6 @@ static int do_samples(int forced_updates) while(!bIRQReturn) { - cycles_since_update = 0; - ns_from=0; ns_to=NSSIZE; ch=0; @@ -837,6 +835,8 @@ static int do_samples(int forced_updates) ns++; } + cycles_since_update -= PSXCLK / 44100 * NSSIZE; + ////////////////////////////////////////////////////// // special irq handling in the decode buffers (0x0000-0x1000) // we know: @@ -888,8 +888,15 @@ static int do_samples(int forced_updates) if(forced_updates == 0 && out_current->busy()) break; } + + if(cycles_since_update <= -PSXCLK/60 / 4) + break; } + // this may cause desync, but help audio when the emu can't keep up.. + if(cycles_since_update < 0) + cycles_since_update = 0; + return 0; } @@ -900,7 +907,6 @@ static int do_samples(int forced_updates) void CALLBACK SPUasync(unsigned long cycle) { - static int old_ctrl; int forced_updates = 0; int do_update = 0; @@ -915,16 +921,8 @@ void CALLBACK SPUasync(unsigned long cycle) had_dma = 0; } - if((spuCtrl&CTRL_IRQ) && (((spuCtrl^old_ctrl)&CTRL_IRQ) // irq was enabled - || cycles_since_update > PSXCLK/60 / 4)) { + if(cycles_since_update > PSXCLK/60 * 5/4) do_update = 1; - forced_updates = cycles_since_update / (PSXCLK/44100) / NSSIZE; - } - // with no irqs, once per frame should be fine (using a bit more because of BIAS) - else if(cycles_since_update > PSXCLK/60 * 5/4) - do_update = 1; - - old_ctrl = spuCtrl; if(do_update) do_samples(forced_updates); |