notaz.gp2x.de
/
fceu.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
perfect vsync, bugfixes
[fceu.git]
/
sound.c
diff --git
a/sound.c
b/sound.c
index
7e130fa
..
bb3c89d
100644
(file)
--- a/
sound.c
+++ b/
sound.c
@@
-869,28
+869,27
@@
void SetNESSoundMap(void)
SetReadHandler(0x4015,0x4015,Read_PSG);
}
SetReadHandler(0x4015,0x4015,Read_PSG);
}
-static int32 WaveNSF[2048];
-
int32 highp; // 0 through 65536, 0 = no high pass, 65536 = max high pass
int32 lowp; // 0 through 65536, 65536 = max low pass(total attenuation)
// 65536 = no low pass
int32 highp; // 0 through 65536, 0 = no high pass, 65536 = max high pass
int32 lowp; // 0 through 65536, 65536 = max low pass(total attenuation)
// 65536 = no low pass
+static int32 flt_acc=0, flt_acc2=0;
+
static void FilterSound(uint32 *in, int16 *outMono, int count)
{
static void FilterSound(uint32 *in, int16 *outMono, int count)
{
- static int32 acc=0, acc2=0;
// static int min=0, max=0;
for(;count;count--,in++,outMono++)
{
int32 diff;
// static int min=0, max=0;
for(;count;count--,in++,outMono++)
{
int32 diff;
- diff = *in - acc;
+ diff = *in -
flt_
acc;
- acc += (diff*highp)>>16;
-
acc2+= (int32) (((int64)((diff-
acc2)*lowp))>>16);
+
flt_
acc += (diff*highp)>>16;
+
flt_acc2+= (int32) (((int64)((diff-flt_
acc2)*lowp))>>16);
*in=0;
*in=0;
- *outMono = acc2*7 >> 2; // * 1.75
+ *outMono =
flt_
acc2*7 >> 2; // * 1.75
// if (acc2 < min) { printf("min: %i %04x\n", acc2, acc2); min = acc2; }
// if (acc2 > max) { printf("max: %i %04x\n", acc2, acc2); max = acc2; }
}
// if (acc2 < min) { printf("min: %i %04x\n", acc2, acc2); min = acc2; }
// if (acc2 > max) { printf("max: %i %04x\n", acc2, acc2); max = acc2; }
}
@@
-923,17
+922,6
@@
int FlushEmulateSound(void)
GameExpSound.Fill(end&0xF);
FilterSound(Wave,WaveFinalMono,end>>4);
GameExpSound.Fill(end&0xF);
FilterSound(Wave,WaveFinalMono,end>>4);
-// printf("count %d, num ints %d\n", end, (end >> 4));
- if(FCEUGameInfo.type==GIT_NSF)
- {
- int x;//,s=0,si=end/1024;
- for(x=0;x<1024;x++)
- {
- //WaveNSF[x]=WaveFinal[s>>4];
- WaveNSF[x]=WaveFinalMono[x];
- //s+=si;
- }
- }
if(end&0xF)
Wave[0]=Wave[(end>>4)];
if(end&0xF)
Wave[0]=Wave[(end>>4)];
@@
-948,9
+936,9
@@
int FlushEmulateSound(void)
return(end);
}
return(end);
}
-int GetSoundBuffer(int
32
**W)
+int GetSoundBuffer(int
16
**W)
{
{
- *W=Wave
NSF
;
+ *W=Wave
FinalMono
;
return inbuf;
}
return inbuf;
}
@@
-1029,6
+1017,8
@@
void SetSoundVariables(void)
if(highp>(1<<16)) highp=1<<16;
if(lowp>(1<<16)) lowp=1<<16;
if(highp>(1<<16)) highp=1<<16;
if(lowp>(1<<16)) lowp=1<<16;
+
+ flt_acc=flt_acc2=0;
}
void FixOldSaveStateSFreq(void)
}
void FixOldSaveStateSFreq(void)