summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorSND\shalma_cp <SND\shalma_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2010-12-20 17:22:53 +0000
committerSND\shalma_cp <SND\shalma_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2010-12-20 17:22:53 +0000
commit756a023930b1844adcbcc15c07f030a6990de626 (patch)
tree629c1e7d5ae028610d5ec27f70fecb8eaee29744 /plugins
parent0e49cf1b049b2d4a4efa9091dfc3a8d3989961f3 (diff)
downloadpcsxr-756a023930b1844adcbcc15c07f030a6990de626.tar.gz
dfsound
- (Hopkat) adsr.c - Use Neill's 4-bit sustain level (accuracy) - (Hopkat) registers.c - External loop address align to 16 bytes - (Hopkat) spu.c, externals.h - Use shorter update intervals (improves Square sounds, music) - (Hopkat) spu.c - Allow interpolation on fmod channel git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@61362 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'plugins')
-rw-r--r--plugins/dfsound/adsr.c5
-rw-r--r--plugins/dfsound/externals.h24
-rw-r--r--plugins/dfsound/registers.c2
-rw-r--r--plugins/dfsound/spu.c30
4 files changed, 42 insertions, 19 deletions
diff --git a/plugins/dfsound/adsr.c b/plugins/dfsound/adsr.c
index 5955884c..1ac9e223 100644
--- a/plugins/dfsound/adsr.c
+++ b/plugins/dfsound/adsr.c
@@ -142,10 +142,7 @@ 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)
-
- // PEOPS DSound FF7 cursor fix (dfsound too?)
- if(s_chan[ch].ADSRX.EnvelopeVol <= s_chan[ch].ADSRX.SustainLevel * (0x7fffffff / 0xf) )
+ if(((s_chan[ch].ADSRX.EnvelopeVol>>27)&0xF) <= s_chan[ch].ADSRX.SustainLevel)
{
s_chan[ch].ADSRX.State=2;
}
diff --git a/plugins/dfsound/externals.h b/plugins/dfsound/externals.h
index 24176e55..ebaad812 100644
--- a/plugins/dfsound/externals.h
+++ b/plugins/dfsound/externals.h
@@ -44,8 +44,28 @@
// num of channels
#define MAXCHAN 24
-// ~ 1 ms of data
-#define NSSIZE 45
+
+// ~ 1 ms of data - somewhat slower than Eternal
+//#define NSSIZE 45
+//#define INTERVAL_TIME 1000
+
+// ~ 0.5 ms of data - roughly Eternal maybe
+//#define NSSIZE 23
+//#define INTERVAL_TIME 2000
+
+// ~ 0.25 ms of data - seems a little bad..?
+//#define NSSIZE 12
+//#define INTERVAL_TIME 4000
+
+#define NSSIZE 10
+#define APU_CYCLES_UPDATE NSSIZE
+#define LATENCY 10
+
+// make sure this is bigger than cpu action - no glitchy
+#define INTERVAL_TIME 5000
+
+
+#define CPU_CLOCK 33868800
///////////////////////////////////////////////////////////
// struct defines
diff --git a/plugins/dfsound/registers.c b/plugins/dfsound/registers.c
index fbf20101..238aa74a 100644
--- a/plugins/dfsound/registers.c
+++ b/plugins/dfsound/registers.c
@@ -163,7 +163,7 @@ void CALLBACK SPUwriteRegister(unsigned long reg, unsigned short val)
//------------------------------------------------//
case 14: // loop?
//WaitForSingleObject(s_chan[ch].hMutex,2000); // -> no multithread fuckups
- s_chan[ch].pLoop=spuMemC+((unsigned long) val<<3);
+ s_chan[ch].pLoop=spuMemC+spuMemC+((unsigned long)((val<<3)&~0xf));
s_chan[ch].bIgnoreLoop=1;
//ReleaseMutex(s_chan[ch].hMutex); // -> oki, on with the thread
break;
diff --git a/plugins/dfsound/spu.c b/plugins/dfsound/spu.c
index 701abb42..fbc02a71 100644
--- a/plugins/dfsound/spu.c
+++ b/plugins/dfsound/spu.c
@@ -346,10 +346,13 @@ INLINE int iGetNoiseVal(int ch)
////////////////////////////////////////////////////////////////////////
INLINE void StoreInterpolationVal(int ch,int fa)
-{
+{
+ /*
+ // fmod channel = sound output
if(s_chan[ch].bFMod==2) // fmod freq channel
s_chan[ch].SB[29]=fa;
- else
+ else
+ */
{
if((spuCtrl&0x4000)==0) fa=0; // muted?
else // else adjust
@@ -383,8 +386,9 @@ INLINE void StoreInterpolationVal(int ch,int fa)
INLINE int iGetInterpolationVal(int ch)
{
int fa;
-
- if(s_chan[ch].bFMod==2) return s_chan[ch].SB[29];
+
+ // fmod channel = sound output
+ //if(s_chan[ch].bFMod==2) return s_chan[ch].SB[29];
switch(iUseInterpolation)
{
@@ -481,7 +485,7 @@ static void *MAINThread(void *arg)
if(dwNewChannel) // new channel should start immedately?
{ // (at least one bit 0 ... MAXCHANNEL is set?)
iSecureStart++; // -> set iSecure
- if(iSecureStart>5) iSecureStart=0; // (if it is set 5 times - that means on 5 tries a new samples has been started - in a row, we will reset it, to give the sound update a chance)
+ if(iSecureStart>0) iSecureStart=0; // (if it is set 5 times - that means on 5 tries a new samples has been started - in a row, we will reset it, to give the sound update a chance)
}
else iSecureStart=0; // 0: no new channel should start
@@ -547,7 +551,6 @@ static void *MAINThread(void *arg)
s_chan[ch].ADSRX.lVolume=0;
s_chan[ch].ADSRX.EnvelopeVol=0;
- //goto ENDX; // -> and done for this channel
}
s_chan[ch].iSBPos=0;
@@ -629,6 +632,9 @@ static void *MAINThread(void *arg)
if(flags&1)
{
+ // ...?
+ //s_chan[ch].bIgnoreLoop = 0;
+
// Xenogears - 7 = play missing sounds
start = s_chan[ch].pLoop;
@@ -727,9 +733,7 @@ GOON: ;
ns++;
s_chan[ch].spos += s_chan[ch].sinc;
-
}
-ENDX: ;
}
}
@@ -814,9 +818,11 @@ ENDX: ;
//////////////////////////////////////////////////////
// feed the sound
- // latency = 20 ms (less pops, crackles, smoother)
+ // latency = 25 ms (less pops, crackles, smoother)
- if(iCycle++>=20)
+ //if(iCycle++>=20)
+ iCycle += APU_CYCLES_UPDATE;
+ if(iCycle > 44000/1000*LATENCY + 100*LATENCY/1000)
{
SoundFeedStreamData((unsigned char *)pSpuBuffer,
((unsigned char *)pS) - ((unsigned char *)pSpuBuffer));
@@ -887,7 +893,7 @@ void CALLBACK SPUasync(unsigned long cycle)
if(!bSpuInit) return; // -> no init, no call
// 1 ms updates
- while( cpu_cycles >= 33868800 / 1000 )
+ while( cpu_cycles >= CPU_CLOCK / INTERVAL_TIME )
{
#ifdef _WINDOWS
MAINProc(0,0,0,0,0); // -> experimental win mode... not really tested... don't like the drawbacks
@@ -895,7 +901,7 @@ void CALLBACK SPUasync(unsigned long cycle)
MAINThread(0); // -> linux high-compat mode
#endif
- cpu_cycles -= 33868800 / 1000;
+ cpu_cycles -= CPU_CLOCK / INTERVAL_TIME;
}
}
}