NES Multiregion: sound frequencies supported

This commit is contained in:
goyuken 2012-10-31 18:35:34 +00:00
parent 7dc5808771
commit bc22049a19
1 changed files with 9 additions and 3 deletions

View File

@ -64,12 +64,12 @@ namespace BizHawk.Emulation.Consoles.Nintendo
ISoundProvider output; ISoundProvider output;
NES nes; NES nes;
public MagicSoundProvider(NES nes) public MagicSoundProvider(NES nes, uint infreq)
{ {
this.nes = nes; this.nes = nes;
var actualMetaspu = new Sound.MetaspuSoundProvider(Sound.ESynchMethod.ESynchMethod_V); var actualMetaspu = new Sound.MetaspuSoundProvider(Sound.ESynchMethod.ESynchMethod_V);
//1.789773mhz NTSC //1.789773mhz NTSC
resampler = new Sound.Utilities.SpeexResampler(2, 1789773, 44100*APU.DECIMATIONFACTOR, 1789773, 44100, actualMetaspu.buffer.enqueue_samples); resampler = new Sound.Utilities.SpeexResampler(2, infreq, 44100 * APU.DECIMATIONFACTOR, infreq, 44100, actualMetaspu.buffer.enqueue_samples);
output = new Sound.Utilities.DCFilter(actualMetaspu); output = new Sound.Utilities.DCFilter(actualMetaspu);
} }
@ -128,7 +128,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
apu = new APU(this); apu = new APU(this);
if (magicSoundProvider != null) magicSoundProvider.Dispose(); if (magicSoundProvider != null) magicSoundProvider.Dispose();
magicSoundProvider = new MagicSoundProvider(this); //magicSoundProvider = new MagicSoundProvider(this);
// set up region // set up region
if (!string.IsNullOrEmpty(cart.system)) if (!string.IsNullOrEmpty(cart.system))
@ -142,17 +142,20 @@ namespace BizHawk.Emulation.Consoles.Nintendo
CoreOutputComm.VsyncNum = 50; CoreOutputComm.VsyncNum = 50;
CoreOutputComm.VsyncDen = 1; CoreOutputComm.VsyncDen = 1;
cpu_sequence = cpu_sequence_PAL; cpu_sequence = cpu_sequence_PAL;
magicSoundProvider = new MagicSoundProvider(this, 1662607);
break; break;
case "NES-NTSC": case "NES-NTSC":
case "Famicom": case "Famicom":
ppu.region = PPU.Region.NTSC; ppu.region = PPU.Region.NTSC;
cpu_sequence = cpu_sequence_NTSC; cpu_sequence = cpu_sequence_NTSC;
magicSoundProvider = new MagicSoundProvider(this, 1789773);
break; break;
// there's no official name for these in bootgod, not sure what we should use // there's no official name for these in bootgod, not sure what we should use
case "PC10": case "PC10":
case "VS": case "VS":
ppu.region = PPU.Region.RGB; ppu.region = PPU.Region.RGB;
cpu_sequence = cpu_sequence_NTSC; cpu_sequence = cpu_sequence_NTSC;
magicSoundProvider = new MagicSoundProvider(this, 1789773);
break; break;
// this is in bootgod, but not used at all // this is in bootgod, but not used at all
case "Dendy": case "Dendy":
@ -160,11 +163,13 @@ namespace BizHawk.Emulation.Consoles.Nintendo
CoreOutputComm.VsyncNum = 50; CoreOutputComm.VsyncNum = 50;
CoreOutputComm.VsyncDen = 1; CoreOutputComm.VsyncDen = 1;
cpu_sequence = cpu_sequence_NTSC; cpu_sequence = cpu_sequence_NTSC;
magicSoundProvider = new MagicSoundProvider(this, 1773448);
break; break;
default: default:
Console.WriteLine("Unrecognized NES region \"{0}\"! Defaulting to NTSC."); Console.WriteLine("Unrecognized NES region \"{0}\"! Defaulting to NTSC.");
ppu.region = PPU.Region.NTSC; ppu.region = PPU.Region.NTSC;
cpu_sequence = cpu_sequence_NTSC; cpu_sequence = cpu_sequence_NTSC;
magicSoundProvider = new MagicSoundProvider(this, 1789773);
break; break;
} }
} }
@ -173,6 +178,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
Console.WriteLine("Unknown NES region! Defaulting to NTSC."); Console.WriteLine("Unknown NES region! Defaulting to NTSC.");
ppu.region = PPU.Region.NTSC; ppu.region = PPU.Region.NTSC;
cpu_sequence = cpu_sequence_NTSC; cpu_sequence = cpu_sequence_NTSC;
magicSoundProvider = new MagicSoundProvider(this, 1789773);
} }
//fceux uses this technique, which presumably tricks some games into thinking the memory is randomized //fceux uses this technique, which presumably tricks some games into thinking the memory is randomized