summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorSND\shalma_cp <SND\shalma_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2010-12-09 14:53:29 +0000
committerSND\shalma_cp <SND\shalma_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2010-12-09 14:53:29 +0000
commitfa5c356f25794bd37240197f719ceca239927a8d (patch)
tree5d465e76fdf5e693792f9ba05985147a7a68e754 /plugins
parentf03cd2c04ac944d672444a6562d8f1593264a794 (diff)
downloadpcsxr-fa5c356f25794bd37240197f719ceca239927a8d.tar.gz
dfsound
- Final Fantasy 7 = adsr.c - use newer PEOPS DSound Sustain level - PEOPS 1.09a win32 = fix FF7 cursor - freeze.c - add emu crash check (spu not init yet) - spu.c - improve spu async timing - set latency = 20 ms - smoother, less pops, cracks - spu.c, registers.c - VAG silence flag (keeps playing channel for IRQs) - new save states needed git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@60906 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'plugins')
-rw-r--r--plugins/dfsound/adsr.c5
-rw-r--r--plugins/dfsound/externals.h3
-rw-r--r--plugins/dfsound/freeze.c2
-rw-r--r--plugins/dfsound/registers.c6
-rw-r--r--plugins/dfsound/spu.c54
5 files changed, 50 insertions, 20 deletions
diff --git a/plugins/dfsound/adsr.c b/plugins/dfsound/adsr.c
index 2496e461..3c88e321 100644
--- a/plugins/dfsound/adsr.c
+++ b/plugins/dfsound/adsr.c
@@ -135,7 +135,10 @@ INLINE int MixADSR(int ch) // MIX ADSR
}
if(s_chan[ch].ADSRX.EnvelopeVol<0) s_chan[ch].ADSRX.EnvelopeVol=0;
- if(((s_chan[ch].ADSRX.EnvelopeVol>>27)&0xF) <= s_chan[ch].ADSRX.SustainLevel)
+ //if(((s_chan[ch].ADSRX.EnvelopeVol>>27)&0xF) <= s_chan[ch].ADSRX.SustainLevel)
+
+ // PEOPS DSound FF7 cursor fix (dfsound too?)
+ if(s_chan[ch].ADSRX.EnvelopeVol <= s_chan[ch].ADSRX.SustainLevel * (0x7fffffff / 0xf) )
{
s_chan[ch].ADSRX.State=2;
}
diff --git a/plugins/dfsound/externals.h b/plugins/dfsound/externals.h
index 30ac977d..6fe7c9d2 100644
--- a/plugins/dfsound/externals.h
+++ b/plugins/dfsound/externals.h
@@ -127,7 +127,8 @@ typedef struct
int iLeftVolume; // left volume
int iLeftVolRaw; // left psx volume value
int bIgnoreLoop; // ignore loop bit, if an external loop address is used
- int iMute; // mute mode
+ int iMute; // mute mode (debug)
+ int iSilent; // voice on - sound on/off
int iRightVolume; // right volume
int iRightVolRaw; // right psx volume value
int iRawPitch; // raw pitch (0...3fff)
diff --git a/plugins/dfsound/freeze.c b/plugins/dfsound/freeze.c
index e4283595..9a5f142f 100644
--- a/plugins/dfsound/freeze.c
+++ b/plugins/dfsound/freeze.c
@@ -68,6 +68,8 @@ long CALLBACK SPUfreeze(uint32_t ulFreezeMode,SPUFreeze_t * pF)
if(!pF) return 0; // first check
+ if(!bSpuInit) return 0;
+
if(ulFreezeMode) // info or save?
{//--------------------------------------------------//
if(ulFreezeMode==1)
diff --git a/plugins/dfsound/registers.c b/plugins/dfsound/registers.c
index a6d2869f..94b7d3e8 100644
--- a/plugins/dfsound/registers.c
+++ b/plugins/dfsound/registers.c
@@ -430,9 +430,15 @@ void SoundOn(int start,int end,unsigned short val) // SOUND ON PSX COMAND
s_chan[ch].bNew=1;
// ..?
+ s_chan[ch].iSilent=0;
//s_chan[ch].bStop=0;
//s_chan[ch].pLoop=0;
+ // Final Fantasy 7 - don't do any of these
+ //s_chan[ch].pLoop = spuMemC;
+ //s_chan[ch].pLoop = 0;
+ //s_chan[ch].pLoop = s_chan[ch].pStart;
+
dwNewChannel|=(1<<ch); // bitfield for faster testing
}
}
diff --git a/plugins/dfsound/spu.c b/plugins/dfsound/spu.c
index c89704b3..4bc0c1d0 100644
--- a/plugins/dfsound/spu.c
+++ b/plugins/dfsound/spu.c
@@ -447,8 +447,8 @@ INLINE int iGetInterpolationVal(int ch)
// .. can be made smaller (smallest val: 1 ms), but bigger waits give
// better performance
-#define PAUSE_W 5
-#define PAUSE_L 5000
+#define PAUSE_W 1
+#define PAUSE_L 1000
////////////////////////////////////////////////////////////////////////
@@ -467,7 +467,8 @@ static void *MAINThread(void *arg)
unsigned char * start;unsigned int nSample;
int ch,predict_nr,shift_factor,flags,d,s;
int bIRQReturn=0;
-
+
+ bEndThread = 0;
while(!bEndThread) // until we are shutting down
{
// ok, at the beginning we are looking if there is
@@ -625,18 +626,22 @@ static void *MAINThread(void *arg)
if(flags&1)
{
+ // Xenogears - 7 = play missing sounds
start = s_chan[ch].pLoop;
- // Xenogears - 7 = menu sound + other missing sounds
- // TODO: SILENCE flag + DQ4 check (loop hangs?)
+ // (?) - silence flag (voice still plays)
if( (flags&2) == 0 )
- start = (unsigned char *) -1;
-
- // stop check?
- if( s_chan[ch].pLoop == 0 )
- start = (unsigned char *) -1;
+ s_chan[ch].iSilent = 1;
+ //start = (unsigned char *) -1;
}
+#if 0
+ // crash check
+ if( start == 0 )
+ start = (unsigned char *) -1;
+ if( start >= spuMemC + 0x80000 )
+ start = spuMemC - 0x80000;
+#endif
s_chan[ch].pCurr=start; // store values for next cycle
s_chan[ch].s_1=s_1;
@@ -695,7 +700,7 @@ GOON: ;
//////////////////////////////////////////////
// ok, left/right sound volume (psx volume goes from 0 ... 0x3fff)
- if(s_chan[ch].iMute)
+ if(s_chan[ch].iMute || s_chan[ch].iSilent)
s_chan[ch].sval=0; // debug mute
else
{
@@ -799,15 +804,21 @@ ENDX: ;
InitREVERB();
+ //////////////////////////////////////////////////////
// feed the sound
- // wanna have around 1/60 sec (16.666 ms) updates
- if (iCycle++ > 16)
+ // latency = 20 ms (less pops, crackles, smoother)
+
+ if(iCycle++>=20)
{
SoundFeedStreamData((unsigned char *)pSpuBuffer,
((unsigned char *)pS) - ((unsigned char *)pSpuBuffer));
pS = (short *)pSpuBuffer;
iCycle = 0;
}
+
+
+ if( iUseTimer == 2 )
+ bEndThread = 1;
}
// end of big main loop...
@@ -836,6 +847,7 @@ DWORD WINAPI MAINThreadEx(LPVOID lpParameter)
// SPU ASYNC... even newer epsxe func
// 1 time every 'cycle' cycles... harhar
+long cpu_cycles;
void CALLBACK SPUasync(unsigned long cycle)
{
if(iSpuAsyncWait)
@@ -862,11 +874,17 @@ void CALLBACK SPUasync(unsigned long cycle)
{
if(!bSpuInit) return; // -> no init, no call
-#ifdef _WINDOWS
- MAINProc(0,0,0,0,0); // -> experimental win mode... not really tested... don't like the drawbacks
-#else
- MAINThread(0); // -> linux high-compat mode
-#endif
+ // 1 ms updates
+ while( cpu_cycles >= 33868800 / 1000 )
+ {
+ #ifdef _WINDOWS
+ MAINProc(0,0,0,0,0); // -> experimental win mode... not really tested... don't like the drawbacks
+ #else
+ MAINThread(0); // -> linux high-compat mode
+ #endif
+
+ cpu_cycles -= 33868800 / 1000;
+ }
}
}