notaz.gp2x.de
/
pcsx_rearmed.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
adjust vita's mappings to more resemble other platforms
[pcsx_rearmed.git]
/
plugins
/
dfsound
/
xa.c
diff --git
a/plugins/dfsound/xa.c
b/plugins/dfsound/xa.c
index
c416d19
..
08afc00
100644
(file)
--- a/
plugins/dfsound/xa.c
+++ b/
plugins/dfsound/xa.c
@@
-16,6
+16,7
@@
***************************************************************************/
#include "stdafx.h"
***************************************************************************/
#include "stdafx.h"
+#include "spu.h"
#define _IN_XA
#include <stdint.h>
#define _IN_XA
#include <stdint.h>
@@
-38,7
+39,7
@@
static int gauss_window[8] = {0, 0, 0, 0, 0, 0, 0, 0};
// MIX XA & CDDA
////////////////////////////////////////////////////////////////////////
// MIX XA & CDDA
////////////////////////////////////////////////////////////////////////
-INLINE void MixXA(int *SSumLR, int ns_to, int decode_pos)
+INLINE void MixXA(int *SSumLR, int
*RVB, int
ns_to, int decode_pos)
{
int cursor = decode_pos;
int ns;
{
int cursor = decode_pos;
int ns;
@@
-50,18
+51,26
@@
INLINE void MixXA(int *SSumLR, int ns_to, int decode_pos)
if(spu.XAPlay == spu.XAFeed)
spu.XARepeat--;
if(spu.XAPlay == spu.XAFeed)
spu.XARepeat--;
- for(ns = 0; ns < ns_to*2; )
+ for(ns = 0; ns < ns_to*2;
ns += 2
)
{
if(spu.XAPlay != spu.XAFeed) v=*spu.XAPlay++;
if(spu.XAPlay == spu.XAEnd) spu.XAPlay=spu.XAStart;
l = ((int)(short)v * spu.iLeftXAVol) >> 15;
r = ((int)(short)(v >> 16) * spu.iLeftXAVol) >> 15;
{
if(spu.XAPlay != spu.XAFeed) v=*spu.XAPlay++;
if(spu.XAPlay == spu.XAEnd) spu.XAPlay=spu.XAStart;
l = ((int)(short)v * spu.iLeftXAVol) >> 15;
r = ((int)(short)(v >> 16) * spu.iLeftXAVol) >> 15;
- SSumLR[ns++] += l;
- SSumLR[ns++] += r;
+ if (spu.spuCtrl & CTRL_CD)
+ {
+ SSumLR[ns+0] += l;
+ SSumLR[ns+1] += r;
+ }
+ if (unlikely(spu.spuCtrl & CTRL_CDREVERB))
+ {
+ RVB[ns+0] += l;
+ RVB[ns+1] += r;
+ }
- spu.spuMem[cursor] =
v
;
- spu.spuMem[cursor + 0x400/2] =
v >> 16
;
+ spu.spuMem[cursor] =
HTOLE16(v)
;
+ spu.spuMem[cursor + 0x400/2] =
HTOLE16(v >> 16)
;
cursor = (cursor + 1) & 0x1ff;
}
spu.XALastVal = v;
cursor = (cursor + 1) & 0x1ff;
}
spu.XALastVal = v;
@@
-70,18
+79,26
@@
INLINE void MixXA(int *SSumLR, int ns_to, int decode_pos)
// hence this 'ns_to < 8'
else if(spu.CDDAPlay != spu.CDDAFeed || ns_to < 8)
{
// hence this 'ns_to < 8'
else if(spu.CDDAPlay != spu.CDDAFeed || ns_to < 8)
{
- for(ns = 0; ns < ns_to*2; )
+ for(ns = 0; ns < ns_to*2;
ns += 2
)
{
if(spu.CDDAPlay != spu.CDDAFeed) v=*spu.CDDAPlay++;
if(spu.CDDAPlay == spu.CDDAEnd) spu.CDDAPlay=spu.CDDAStart;
l = ((int)(short)v * spu.iLeftXAVol) >> 15;
r = ((int)(short)(v >> 16) * spu.iLeftXAVol) >> 15;
{
if(spu.CDDAPlay != spu.CDDAFeed) v=*spu.CDDAPlay++;
if(spu.CDDAPlay == spu.CDDAEnd) spu.CDDAPlay=spu.CDDAStart;
l = ((int)(short)v * spu.iLeftXAVol) >> 15;
r = ((int)(short)(v >> 16) * spu.iLeftXAVol) >> 15;
- SSumLR[ns++] += l;
- SSumLR[ns++] += r;
+ if (spu.spuCtrl & CTRL_CD)
+ {
+ SSumLR[ns+0] += l;
+ SSumLR[ns+1] += r;
+ }
+ if (unlikely(spu.spuCtrl & CTRL_CDREVERB))
+ {
+ RVB[ns+0] += l;
+ RVB[ns+1] += r;
+ }
- spu.spuMem[cursor] =
v
;
- spu.spuMem[cursor + 0x400/2] =
v >> 16
;
+ spu.spuMem[cursor] =
HTOLE16(v)
;
+ spu.spuMem[cursor + 0x400/2] =
HTOLE16(v >> 16)
;
cursor = (cursor + 1) & 0x1ff;
}
spu.XALastVal = v;
cursor = (cursor + 1) & 0x1ff;
}
spu.XALastVal = v;
@@
-94,6
+111,7
@@
INLINE void MixXA(int *SSumLR, int ns_to, int decode_pos)
// small linux time helper... only used for watchdog
////////////////////////////////////////////////////////////////////////
// small linux time helper... only used for watchdog
////////////////////////////////////////////////////////////////////////
+#if 0
static unsigned long timeGetTime_spu()
{
#if defined(NO_OS)
static unsigned long timeGetTime_spu()
{
#if defined(NO_OS)
@@
-106,19
+124,19
@@
static unsigned long timeGetTime_spu()
return tv.tv_sec * 1000 + tv.tv_usec/1000; // to do that, but at least it works
#endif
}
return tv.tv_sec * 1000 + tv.tv_usec/1000; // to do that, but at least it works
#endif
}
+#endif
////////////////////////////////////////////////////////////////////////
// FEED XA
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
// FEED XA
////////////////////////////////////////////////////////////////////////
-
INLINE void FeedXA(
xa_decode_t *xap)
+
void FeedXA(const
xa_decode_t *xap)
{
int sinc,spos,i,iSize,iPlace,vl,vr;
if(!spu.bSPUIsOpen) return;
{
int sinc,spos,i,iSize,iPlace,vl,vr;
if(!spu.bSPUIsOpen) return;
- spu.xapGlobal = xap; // store info for save states
- spu.XARepeat = 100; // set up repeat
+ spu.XARepeat = 3; // set up repeat
#if 0//def XA_HACK
iSize=((45500*xap->nsamples)/xap->freq); // get size
#if 0//def XA_HACK
iSize=((45500*xap->nsamples)/xap->freq); // get size
@@
-133,6
+151,7
@@
INLINE void FeedXA(xa_decode_t *xap)
if(iPlace==0) return; // no place at all
//----------------------------------------------------//
if(iPlace==0) return; // no place at all
//----------------------------------------------------//
+#if 0
if(spu_config.iXAPitch) // pitch change option?
{
static DWORD dwLT=0;
if(spu_config.iXAPitch) // pitch change option?
{
static DWORD dwLT=0;
@@
-169,6
+188,7
@@
INLINE void FeedXA(xa_decode_t *xap)
if(iLastSize) iSize=iLastSize;
}
}
if(iLastSize) iSize=iLastSize;
}
}
+#endif
//----------------------------------------------------//
spos=0x10000L;
//----------------------------------------------------//
spos=0x10000L;
@@
-179,6
+199,7
@@
INLINE void FeedXA(xa_decode_t *xap)
uint32_t * pS=(uint32_t *)xap->pcm;
uint32_t l=0;
uint32_t * pS=(uint32_t *)xap->pcm;
uint32_t l=0;
+#if 0
if(spu_config.iXAPitch)
{
int32_t l1,l2;short s;
if(spu_config.iXAPitch)
{
int32_t l1,l2;short s;
@@
-238,6
+259,7
@@
INLINE void FeedXA(xa_decode_t *xap)
}
}
else
}
}
else
+#endif
{
for(i=0;i<iSize;i++)
{
{
for(i=0;i<iSize;i++)
{
@@
-290,6
+312,7
@@
INLINE void FeedXA(xa_decode_t *xap)
unsigned short * pS=(unsigned short *)xap->pcm;
uint32_t l;short s=0;
unsigned short * pS=(unsigned short *)xap->pcm;
uint32_t l;short s=0;
+#if 0
if(spu_config.iXAPitch)
{
int32_t l1;
if(spu_config.iXAPitch)
{
int32_t l1;
@@
-337,6
+360,7
@@
INLINE void FeedXA(xa_decode_t *xap)
}
}
else
}
}
else
+#endif
{
for(i=0;i<iSize;i++)
{
{
for(i=0;i<iSize;i++)
{
@@
-385,12
+409,12
@@
INLINE void FeedXA(xa_decode_t *xap)
// FEED CDDA
////////////////////////////////////////////////////////////////////////
// FEED CDDA
////////////////////////////////////////////////////////////////////////
-
INLINE int
FeedCDDA(unsigned char *pcm, int nBytes)
+
void
FeedCDDA(unsigned char *pcm, int nBytes)
{
int space;
space=(spu.CDDAPlay-spu.CDDAFeed-1)*4 & (CDDA_BUFFER_SIZE - 1);
if(space<nBytes)
{
int space;
space=(spu.CDDAPlay-spu.CDDAFeed-1)*4 & (CDDA_BUFFER_SIZE - 1);
if(space<nBytes)
- return
0x7761; // rearmed_wait
+ return
;
while(nBytes>0)
{
while(nBytes>0)
{
@@
-406,8
+430,7
@@
INLINE int FeedCDDA(unsigned char *pcm, int nBytes)
nBytes-=space;
pcm+=space;
}
nBytes-=space;
pcm+=space;
}
-
- return 0x676f; // rearmed_go
}
#endif
}
#endif
+// vim:shiftwidth=1:expandtab