BizHawk/BizHawk.Emulation.Cores/Consoles/Coleco/ColecoVision.ISoundProvider.cs

60 lines
1.1 KiB
C#
Raw Normal View History

2018-03-04 16:00:32 +00:00
using System;
using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.ColecoVision
{
2018-03-04 16:00:32 +00:00
public partial class ColecoVision : ISoundProvider
{
2018-03-04 16:00:32 +00:00
private SN76489col PSG;
private AY_3_8910_SGM SGM_sound;
2018-03-13 20:31:21 +00:00
private readonly BlipBuffer _blip = new BlipBuffer(4096);
2018-03-04 16:00:32 +00:00
public void DiscardSamples()
{
2018-03-13 20:31:21 +00:00
_blip.Clear();
_sampleClock = 0;
2018-03-04 16:00:32 +00:00
}
public void GetSamplesAsync(short[] samples)
{
throw new NotSupportedException("Async is not available");
}
public bool CanProvideAsync => false;
public SyncSoundMode SyncMode => 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)
{
2018-03-13 20:31:21 +00:00
_blip.EndFrame((uint)_sampleClock);
_sampleClock = 0;
2018-03-04 16:00:32 +00:00
2018-03-13 20:31:21 +00:00
nsamp = _blip.SamplesAvailable();
2018-03-04 16:00:32 +00:00
samples = new short[nsamp * 2];
2018-03-13 20:31:21 +00:00
_blip.ReadSamples(samples, nsamp, true);
2018-03-04 16:00:32 +00:00
2018-03-13 20:31:21 +00:00
for (int i = 0; i < nsamp * 2; i += 2)
2018-03-04 16:00:32 +00:00
{
2018-03-13 20:31:21 +00:00
samples[i + 1] = samples[i];
}
2018-03-04 16:00:32 +00:00
}
public void GetSamples(short[] samples)
{
throw new Exception();
}
}
}