Intellivion copy paste enough stuff to get the sound working

Sound now fully implemented including in savestates
This commit is contained in:
alyosha-tas 2016-12-13 12:26:56 -05:00 committed by GitHub
parent ed091083d2
commit c6d8666f23
2 changed files with 33 additions and 1 deletions

View File

@ -52,6 +52,7 @@ namespace BizHawk.Emulation.Cores.Intellivision
_psg.Reset();
_psg.ReadMemory = ReadMemory;
_psg.WriteMemory = WriteMemory;
(ServiceProvider as BasicServiceProvider).Register<ISoundProvider>(_psg);
Connect();

View File

@ -6,7 +6,7 @@ using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Intellivision
{
// Sound refactor todo: Implement ISoundProvider, and register _psg in the Intellivision core
public sealed class PSG
public sealed class PSG : ISoundProvider
{
public ushort[] Register = new ushort[16];
@ -30,6 +30,37 @@ namespace BizHawk.Emulation.Cores.Intellivision
}
}
public void GetSamplesAsync(short[] samples)
{
throw new NotSupportedException("Async is not available");
}
public bool CanProvideAsync
{
get { return false; }
}
public SyncSoundMode SyncMode
{
get { return SyncSoundMode.Sync; }
}
public void SetSyncMode(SyncSoundMode mode)
{
if (mode != SyncSoundMode.Sync)
{
throw new InvalidOperationException("Only Sync mode is supported.");
}
}
public void GetSamplesSync(out short[] samples, out int nsamp)
{
short[] ret = new short[735 * 2];
GetSamples(ret);
samples = ret;
nsamp = 735;
}
public void GetSamples(short[] samples)
{
for (int i = 0; i < samples.Length / 2; i++)