2017-04-25 16:42:03 +00:00
|
|
|
|
using System;
|
|
|
|
|
using BizHawk.Emulation.Common;
|
|
|
|
|
|
|
|
|
|
namespace BizHawk.Emulation.Cores.Nintendo.GBA
|
|
|
|
|
{
|
|
|
|
|
public partial class MGBAHawk : ISoundProvider
|
|
|
|
|
{
|
2017-04-25 17:00:50 +00:00
|
|
|
|
private readonly short[] _soundbuff = new short[2048];
|
|
|
|
|
private int _nsamp;
|
2017-04-25 16:42:03 +00:00
|
|
|
|
|
2017-04-25 17:00:50 +00:00
|
|
|
|
public bool CanProvideAsync => false;
|
2017-04-25 16:42:03 +00:00
|
|
|
|
|
|
|
|
|
public void SetSyncMode(SyncSoundMode mode)
|
|
|
|
|
{
|
|
|
|
|
if (mode == SyncSoundMode.Async)
|
|
|
|
|
{
|
|
|
|
|
throw new NotSupportedException("Async mode is not supported.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-25 17:00:50 +00:00
|
|
|
|
public SyncSoundMode SyncMode => SyncSoundMode.Sync;
|
|
|
|
|
|
|
|
|
|
public void GetSamplesSync(out short[] samples, out int nsamp)
|
2017-04-25 16:42:03 +00:00
|
|
|
|
{
|
2017-04-25 17:00:50 +00:00
|
|
|
|
nsamp = _nsamp;
|
|
|
|
|
samples = _soundbuff;
|
|
|
|
|
DiscardSamples();
|
2017-04-25 16:42:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void GetSamplesAsync(short[] samples)
|
|
|
|
|
{
|
|
|
|
|
throw new InvalidOperationException("Async mode is not supported.");
|
|
|
|
|
}
|
2017-04-25 17:00:50 +00:00
|
|
|
|
|
|
|
|
|
public void DiscardSamples()
|
|
|
|
|
{
|
|
|
|
|
_nsamp = 0;
|
|
|
|
|
}
|
2017-04-25 16:42:03 +00:00
|
|
|
|
}
|
|
|
|
|
}
|