DCFilter: allow variable filterwidth. 2600 tia: use a rather aggressive (~172hz cutoff) dc filter. this coefficient is reasonably close to actual hardware behavior.
This commit is contained in:
parent
ac86041b94
commit
19e5325afa
|
@ -13,6 +13,7 @@ namespace BizHawk
|
|||
public MOS6502X cpu;
|
||||
public M6532 m6532;
|
||||
public TIA tia;
|
||||
public Emulation.Sound.Utilities.DCFilter dcfilter;
|
||||
public byte[] ram = new byte[128];
|
||||
public MapperBase mapper;
|
||||
|
||||
|
@ -142,6 +143,8 @@ namespace BizHawk
|
|||
// Setup TIA
|
||||
//tia = new TIA(this, frameBuffer);
|
||||
tia = new TIA(this);
|
||||
// dcfilter coefficent is from real observed hardware behavior: a latched "1" will fully decay by ~170 or so tia sound cycles
|
||||
dcfilter = new Emulation.Sound.Utilities.DCFilter(tia, 256);
|
||||
// Setup 6532
|
||||
m6532 = new M6532(this);
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace BizHawk
|
|||
public CoreInputComm CoreInputComm { get; set; }
|
||||
public CoreOutputComm CoreOutputComm { get; private set; }
|
||||
public IVideoProvider VideoProvider { get { return tia; } }
|
||||
public ISoundProvider SoundProvider { get { return tia; } }
|
||||
public ISoundProvider SoundProvider { get { return dcfilter; } }
|
||||
|
||||
public Atari2600(GameInfo game, byte[] rom)
|
||||
{
|
||||
|
|
|
@ -24,15 +24,16 @@ namespace BizHawk.Emulation.Sound.Utilities
|
|||
|
||||
Queue<short> buffer;
|
||||
|
||||
const int depth = 65536;
|
||||
int depth;
|
||||
|
||||
/// <summary>
|
||||
/// if input == null, run in detatched push mode
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
public DCFilter(ISoundProvider input = null)
|
||||
public DCFilter(ISoundProvider input = null, int filterwidth = 65536)
|
||||
{
|
||||
this.input = input;
|
||||
this.depth = filterwidth;
|
||||
this.buffer = new Queue<short>(depth * 2);
|
||||
for (int i = 0; i < depth * 2; i++)
|
||||
buffer.Enqueue(0);
|
||||
|
@ -65,8 +66,8 @@ namespace BizHawk.Emulation.Sound.Utilities
|
|||
sumR += R;
|
||||
buffer.Enqueue(L);
|
||||
buffer.Enqueue(R);
|
||||
int bigL = L - (sumL >> 16); // / depth;
|
||||
int bigR = R - (sumR >> 16); // / depth;
|
||||
int bigL = L - sumL / depth;
|
||||
int bigR = R - sumR / depth;
|
||||
// check for clipping
|
||||
if (bigL > 32767)
|
||||
samples[i] = 32767;
|
||||
|
|
Loading…
Reference in New Issue