diff options
author | notaz | 2011-10-05 02:11:18 +0300 |
---|---|---|
committer | notaz | 2011-10-08 03:29:24 +0300 |
commit | 983a7cfdccceaa612267a1b045110b4f831d1495 (patch) | |
tree | 9db370d4f7a553f078d8ab4793324ca220a90bc5 /plugins/dfsound/xa.c | |
parent | 4600ba0381ea86bdfdcba8f4f762c89f5c51af5b (diff) | |
download | pcsx_rearmed-983a7cfdccceaa612267a1b045110b4f831d1495.tar.gz pcsx_rearmed-983a7cfdccceaa612267a1b045110b4f831d1495.tar.bz2 pcsx_rearmed-983a7cfdccceaa612267a1b045110b4f831d1495.zip |
spu/cdda: sync cdda to spu playback
this will probably make cdrom/vsync timing desync situation
worse (those were never in sync anyway) but fix some cdda
related sound stuttering.
Those magic values are used trying to preserve other SPU plugin
compatibility.
Diffstat (limited to 'plugins/dfsound/xa.c')
-rw-r--r-- | plugins/dfsound/xa.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/plugins/dfsound/xa.c b/plugins/dfsound/xa.c index b45aef2..b1efe10 100644 --- a/plugins/dfsound/xa.c +++ b/plugins/dfsound/xa.c @@ -389,21 +389,29 @@ INLINE void FeedXA(xa_decode_t *xap) // FEED CDDA //////////////////////////////////////////////////////////////////////// -INLINE void FeedCDDA(unsigned char *pcm, int nBytes) +INLINE int FeedCDDA(unsigned char *pcm, int nBytes) { + int space; + space=(CDDAPlay-CDDAFeed-1)*4 & (CDDA_BUFFER_SIZE - 1); + if(space<nBytes) + return 0x7761; // rearmed_wait + while(nBytes>0) { if(CDDAFeed==CDDAEnd) CDDAFeed=CDDAStart; - while(CDDAFeed==CDDAPlay-1|| - (CDDAFeed==CDDAEnd-1&&CDDAPlay==CDDAStart)) - { - if (!iUseTimer) usleep(1000); - else return; - } - *CDDAFeed++=(*pcm | (*(pcm+1)<<8) | (*(pcm+2)<<16) | (*(pcm+3)<<24)); - nBytes-=4; - pcm+=4; + space=(CDDAPlay-CDDAFeed-1)*4 & (CDDA_BUFFER_SIZE - 1); + if(CDDAFeed+space/4>CDDAEnd) + space=(CDDAEnd-CDDAFeed)*4; + if(space>nBytes) + space=nBytes; + + memcpy(CDDAFeed,pcm,space); + CDDAFeed+=space/4; + nBytes-=space; + pcm+=space; } + + return 0x676f; // rearmed_go } #endif |