Add a SoundOn flag to the nes core and hook to the sound on/off in sound config. the flag bypasses the apu.run function. the apu read/writes are still going, and seems to be TAS safe to do this

This commit is contained in:
andres.delikat 2011-08-27 15:49:16 +00:00
parent 1f3a315926
commit 942a9e086a
2 changed files with 14 additions and 2 deletions

View File

@ -22,7 +22,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
string game_name; //friendly name exposed to user and used as filename base
CartInfo cart; //the current cart prototype. should be moved into the board, perhaps
INESBoard board; //the board hardware that is currently driving things
public bool SoundOn = true;
bool _irq_apu, _irq_cart;
public bool irq_apu { get { return _irq_apu; } set { _irq_apu = value; sync_irq(); } }
public bool irq_cart { get { return _irq_cart; } set { _irq_cart = value; sync_irq(); } }
@ -113,7 +113,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo
cpu_cycles -= todo;
cpu_accumulate -= 48*todo;
cpu.Execute(todo);
apu.Run(todo);
if (SoundOn)
apu.Run(todo);
ppu.PostCpuInstruction(todo);
}
}

View File

@ -3,6 +3,8 @@ using BizHawk.Emulation.Sound;
using SlimDX.DirectSound;
using SlimDX.Multimedia;
using BizHawk.Emulation.Consoles.Nintendo;
namespace BizHawk.MultiClient
{
public class Sound : IDisposable
@ -174,6 +176,15 @@ namespace BizHawk.MultiClient
DSoundBuffer.Volume = -5000;
else
DSoundBuffer.Volume = 0 - ((100 - Global.Config.SoundVolume) * 15);
if (Global.Emulator is NES)
{
NES n = Global.Emulator as NES;
if (Global.Config.SoundEnabled == false)
n.SoundOn = false;
else
n.SoundOn = true;
}
}
}
}