Rename ISoundProvider to IAsyncSoundProvider to more accurately describe what the service does

This commit is contained in:
adelikat 2016-12-09 10:24:43 -06:00
parent 5b31b33713
commit b697110098
45 changed files with 59 additions and 59 deletions

View File

@ -17,7 +17,7 @@ namespace BizHawk.Client.EmuHawk
private long _soundRemainder; // audio timekeeping for video dumping
public void DumpAV(IVideoProvider v, ISoundProvider s, out short[] samples, out int samplesprovided)
public void DumpAV(IVideoProvider v, IAsyncSoundProvider s, out short[] samples, out int samplesprovided)
{
if (!aset || !vset)
throw new InvalidOperationException("Must set params first!");

View File

@ -1345,7 +1345,7 @@ namespace BizHawk.Client.EmuHawk
// AVI/WAV state
private IVideoWriter _currAviWriter;
private HashSet<int> _currAviWriterFrameList;
private ISoundProvider _aviSoundInput;
private IAsyncSoundProvider _aviSoundInput;
private MetaspuSoundProvider _dumpProxy; // an audio proxy used for dumping
private bool _dumpaudiosync; // set true to for experimental AV dumping
private int _avwriterResizew;

View File

@ -16,7 +16,7 @@ namespace BizHawk.Client.EmuHawk
private bool _disposed;
private ISoundOutput _soundOutput;
private ISyncSoundProvider _syncSoundProvider;
private ISoundProvider _asyncSoundProvider;
private IAsyncSoundProvider _asyncSoundProvider;
private SoundOutputProvider _outputProvider;
private readonly BufferedAsync _semiSync = new BufferedAsync();
@ -112,7 +112,7 @@ namespace BizHawk.Client.EmuHawk
}
}
public void SetAsyncInputPin(ISoundProvider source)
public void SetAsyncInputPin(IAsyncSoundProvider source)
{
if (_syncSoundProvider != null)
{

View File

@ -7,7 +7,7 @@ using System.ComponentModel;
namespace BizHawk.Emulation.Common
{
[CoreAttributes("NullHawk", "", false, true)]
public class NullEmulator : IEmulator, IVideoProvider, ISyncSoundProvider, ISoundProvider, ISettable<NullEmulator.NullEmulatorSettings, object>
public class NullEmulator : IEmulator, IVideoProvider, ISyncSoundProvider, IAsyncSoundProvider, ISettable<NullEmulator.NullEmulatorSettings, object>
{
public NullEmulator(CoreComm comm, object settings)
{
@ -32,7 +32,7 @@ namespace BizHawk.Emulation.Common
private readonly int[] frameBuffer = new int[256 * 192];
private readonly Random rand = new Random();
public CoreComm CoreComm { get; private set; }
public ISoundProvider SoundProvider { get { return this; } }
public IAsyncSoundProvider SoundProvider { get { return this; } }
public ISyncSoundProvider SyncSoundProvider { get { return this; } }
public bool StartAsyncSound() { return true; }
public void EndAsyncSound() { }

View File

@ -1,6 +1,6 @@
namespace BizHawk.Emulation.Common
{
public class NullSound : ISoundProvider
public class NullSound : IAsyncSoundProvider
{
public static readonly NullSound SilenceProvider = new NullSound();

View File

@ -15,7 +15,7 @@ namespace BizHawk.Emulation.Common
/// <summary>
/// Sound provider for async operation. this is optional, and is only required after StartAsyncSound() is called and returns true
/// </summary>
ISoundProvider SoundProvider { get; }
IAsyncSoundProvider SoundProvider { get; }
/// <summary>
/// sound provider for sync operation. this is manditory

View File

@ -1,6 +1,6 @@
namespace BizHawk.Emulation.Common
{
public interface ISoundProvider
public interface IAsyncSoundProvider
{
void GetSamples(short[] samples);
void DiscardSamples();

View File

@ -15,13 +15,13 @@
/// </summary>
public class FakeSyncSound : ISyncSoundProvider
{
private readonly ISoundProvider source;
private readonly IAsyncSoundProvider source;
private readonly int spf;
/// <summary>
/// </summary>
/// <param name="spf">number of sample pairs to request and provide on each GetSamples() call</param>
public FakeSyncSound(ISoundProvider source, int spf)
public FakeSyncSound(IAsyncSoundProvider source, int spf)
{
this.source = source;
this.spf = spf;

View File

@ -28,9 +28,9 @@ namespace BizHawk.Emulation.Common
* that and then bypass the BufferedAsync.
*/
public sealed class BufferedAsync : ISoundProvider
public sealed class BufferedAsync : IAsyncSoundProvider
{
public ISoundProvider BaseSoundProvider;
public IAsyncSoundProvider BaseSoundProvider;
readonly Queue<short> buffer = new Queue<short>(4096);

View File

@ -5,7 +5,7 @@ namespace BizHawk.Emulation.Common
/// <summary>
/// implements a DC block filter on top of an ISoundProvider. rather simple.
/// </summary>
sealed public class DCFilter : ISoundProvider, ISyncSoundProvider
sealed public class DCFilter : IAsyncSoundProvider, ISyncSoundProvider
{
/*
* A note about accuracy:
@ -14,7 +14,7 @@ namespace BizHawk.Emulation.Common
* Analog output hardware ALWAYS has dc blocking caps.
*/
ISoundProvider input;
IAsyncSoundProvider input;
ISyncSoundProvider syncinput;
int latchL = 0;
@ -35,7 +35,7 @@ namespace BizHawk.Emulation.Common
int depth;
public static DCFilter AsISoundProvider(ISoundProvider input, int filterwidth)
public static DCFilter AsISoundProvider(IAsyncSoundProvider input, int filterwidth)
{
if (input == null)
throw new ArgumentNullException();
@ -54,7 +54,7 @@ namespace BizHawk.Emulation.Common
return new DCFilter(null, null, filterwidth);
}
DCFilter(ISoundProvider input, ISyncSoundProvider syncinput, int filterwidth)
DCFilter(IAsyncSoundProvider input, ISyncSoundProvider syncinput, int filterwidth)
{
if (filterwidth < 8 || filterwidth > 65536)
throw new ArgumentOutOfRangeException();
@ -104,13 +104,13 @@ namespace BizHawk.Emulation.Common
}
}
void ISoundProvider.GetSamples(short[] samples)
void IAsyncSoundProvider.GetSamples(short[] samples)
{
input.GetSamples(samples);
PushThroughSamples(samples, samples.Length);
}
void ISoundProvider.DiscardSamples()
void IAsyncSoundProvider.DiscardSamples()
{
input.DiscardSamples();
}

View File

@ -6,7 +6,7 @@ namespace BizHawk.Emulation.Common
/// <summary>
/// uses Metaspu to have an ISyncSoundProvider input to a ISoundProvider
/// </summary>
public class MetaspuAsync : ISoundProvider
public class MetaspuAsync : IAsyncSoundProvider
{
private readonly ISynchronizingAudioBuffer buffer;
private readonly ISyncSoundProvider input;
@ -32,7 +32,7 @@ namespace BizHawk.Emulation.Common
}
}
public class MetaspuSoundProvider : ISoundProvider
public class MetaspuSoundProvider : IAsyncSoundProvider
{
public ISynchronizingAudioBuffer buffer;
public MetaspuSoundProvider(ESynchMethod method)
@ -46,7 +46,7 @@ namespace BizHawk.Emulation.Common
}
private readonly short[] pullBuffer = new short[1470];
public void PullSamples(ISoundProvider source)
public void PullSamples(IAsyncSoundProvider source)
{
Array.Clear(pullBuffer, 0, 1470);
source.GetSamples(pullBuffer);

View File

@ -5,13 +5,13 @@ namespace BizHawk.Emulation.Common
/// <summary>
/// An interface that extends a sound provider to provide mixing capabilities through the SoundMixer class
/// </summary>
public interface IMixedSoundProvider : ISoundProvider
public interface IMixedSoundProvider : IAsyncSoundProvider
{
int MaxVolume { get; set; }
}
// This is a straightforward class to mix/chain multiple ISoundProvider sources.
public sealed class SoundMixer : ISoundProvider
public sealed class SoundMixer : IAsyncSoundProvider
{
private readonly List<IMixedSoundProvider> SoundProviders;

View File

@ -6,7 +6,7 @@ namespace BizHawk.Emulation.Cores.Calculators
{
public IEmulatorServiceProvider ServiceProvider { get; private set; }
public ISoundProvider SoundProvider
public IAsyncSoundProvider SoundProvider
{
get { return NullSound.SilenceProvider; }
}

View File

@ -7,7 +7,7 @@ namespace BizHawk.Emulation.Cores.Computers.AppleII
public IEmulatorServiceProvider ServiceProvider { get; private set; }
[FeatureNotImplemented]
public ISoundProvider SoundProvider
public IAsyncSoundProvider SoundProvider
{
get { return null; }
}

View File

@ -139,7 +139,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
public bool StartAsyncSound() { return false; }
public void EndAsyncSound() { }
[SaveState.DoNotSave]
public ISoundProvider SoundProvider { get { return null; } }
public IAsyncSoundProvider SoundProvider { get { return null; } }
[SaveState.DoNotSave]
public ISyncSoundProvider SyncSoundProvider { get; private set; }
[SaveState.DoNotSave]

View File

@ -6,7 +6,7 @@ using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS
{
public sealed partial class Sid : ISoundProvider, ISyncSoundProvider
public sealed partial class Sid : IAsyncSoundProvider, ISyncSoundProvider
{
public int MaxVolume
{

View File

@ -80,7 +80,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
public CoreComm CoreComm { get; private set; }
public ISoundProvider SoundProvider { get { return _dcfilter; } }
public IAsyncSoundProvider SoundProvider { get { return _dcfilter; } }
// todo: make this not so ugly
public ISyncSoundProvider SyncSoundProvider

View File

@ -7,7 +7,7 @@ using System.Numerics;
namespace BizHawk.Emulation.Cores.Atari.Atari2600
{
// Emulates the TIA
public partial class TIA : IVideoProvider, ISoundProvider
public partial class TIA : IVideoProvider, IAsyncSoundProvider
{
#region palette

View File

@ -209,7 +209,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari7800
public ISyncSoundProvider SyncSoundProvider { get { return avProvider; } }
public bool StartAsyncSound() { return false; }
public void EndAsyncSound() { }
public ISoundProvider SoundProvider { get { return null; } }
public IAsyncSoundProvider SoundProvider { get { return null; } }
MyAVProvider avProvider = new MyAVProvider();

View File

@ -198,7 +198,7 @@ namespace BizHawk.Emulation.Cores.Atari.Lynx
short[] soundbuff = new short[2048];
int numsamp;
public ISoundProvider SoundProvider { get { return null; } }
public IAsyncSoundProvider SoundProvider { get { return null; } }
public ISyncSoundProvider SyncSoundProvider { get { return this; } }
public bool StartAsyncSound() { return false; }
public void EndAsyncSound() { }

View File

@ -167,7 +167,7 @@ namespace BizHawk.Emulation.Cores.ColecoVision
public string SystemId { get { return "Coleco"; } }
public GameInfo game;
public CoreComm CoreComm { get; private set; }
public ISoundProvider SoundProvider { get { return PSG; } }
public IAsyncSoundProvider SoundProvider { get { return PSG; } }
public string BoardName { get { return null; } }

View File

@ -9,7 +9,7 @@ namespace BizHawk.Emulation.Cores.Intellivision
private DCFilter _dcfilter;
public ISoundProvider SoundProvider
public IAsyncSoundProvider SoundProvider
{
get { return _dcfilter; }
}

View File

@ -5,7 +5,7 @@ using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Intellivision
{
public sealed class PSG : ISoundProvider
public sealed class PSG : IAsyncSoundProvider
{
public ushort[] Register = new ushort[16];

View File

@ -204,7 +204,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
{
nsamp = 0;
}
public ISoundProvider SoundProvider { get { throw new InvalidOperationException(); } }
public IAsyncSoundProvider SoundProvider { get { throw new InvalidOperationException(); } }
public ISyncSoundProvider SyncSoundProvider { get { return this; } }
public bool StartAsyncSound() { return false; }
public void EndAsyncSound() { }

View File

@ -293,7 +293,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
short[] soundbuffer;
GCHandle soundhandle;
public ISoundProvider SoundProvider { get { return null; } }
public IAsyncSoundProvider SoundProvider { get { return null; } }
public ISyncSoundProvider SyncSoundProvider { get { return this; } }
public bool StartAsyncSound() { return false; }
public void EndAsyncSound() { }

View File

@ -232,7 +232,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
short[] soundbuff = new short[2048];
int numsamp;
public ISoundProvider SoundProvider { get { return null; } }
public IAsyncSoundProvider SoundProvider { get { return null; } }
public ISyncSoundProvider SyncSoundProvider { get { return this; } }
public bool StartAsyncSound() { return false; }
public void EndAsyncSound() { }

View File

@ -569,7 +569,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
#region ISoundProvider
public ISoundProvider SoundProvider { get { return null; } }
public IAsyncSoundProvider SoundProvider { get { return null; } }
public ISyncSoundProvider SyncSoundProvider { get { return this; } }
public bool StartAsyncSound() { return false; }
public void EndAsyncSound() { }

View File

@ -89,7 +89,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
public IEmulatorServiceProvider ServiceProvider { get; private set; }
public ISoundProvider SoundProvider { get { return null; } }
public IAsyncSoundProvider SoundProvider { get { return null; } }
public ISyncSoundProvider SyncSoundProvider { get { return this; } }
public bool StartAsyncSound() { return false; }
public void EndAsyncSound() { }

View File

@ -268,7 +268,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
public DisplayType Region { get { return _display_type; } }
public ISoundProvider SoundProvider { get { return null; } }
public IAsyncSoundProvider SoundProvider { get { return null; } }
public ISyncSoundProvider SyncSoundProvider { get { return _audioProvider.Resampler; } }

View File

@ -79,7 +79,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
magicSoundProvider = null;
}
class MagicSoundProvider : ISoundProvider, ISyncSoundProvider, IDisposable
class MagicSoundProvider : IAsyncSoundProvider, ISyncSoundProvider, IDisposable
{
BlipBuffer blip;
NES nes;

View File

@ -334,7 +334,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
}
MyVideoProvider videoProvider;
public ISoundProvider SoundProvider { get { return magicSoundProvider; } }
public IAsyncSoundProvider SoundProvider { get { return magicSoundProvider; } }
public ISyncSoundProvider SyncSoundProvider { get { return magicSoundProvider; } }
public bool StartAsyncSound() { return true; }
public void EndAsyncSound() { }

View File

@ -322,7 +322,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
#region SoundProvider
public ISoundProvider SoundProvider { get { return null; } }
public IAsyncSoundProvider SoundProvider { get { return null; } }
public ISyncSoundProvider SyncSoundProvider { get { return this; } }
public bool StartAsyncSound() { return false; }
public void EndAsyncSound() { }

View File

@ -1300,7 +1300,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
resampler.EnqueueSample((short)left, (short)right);
}
public ISoundProvider SoundProvider { get { return null; } }
public IAsyncSoundProvider SoundProvider { get { return null; } }
public ISyncSoundProvider SyncSoundProvider { get { return resampler; } }
public bool StartAsyncSound() { return false; }
public void EndAsyncSound() { }

View File

@ -75,7 +75,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES9X
#region ISyncSoundProvider
private short[] _sbuff = new short[2048];
public ISoundProvider SoundProvider { get { return null; } }
public IAsyncSoundProvider SoundProvider { get { return null; } }
public ISyncSoundProvider SyncSoundProvider { get { return this; } }
public bool StartAsyncSound() { return false; }
public void EndAsyncSound() { }

View File

@ -406,8 +406,8 @@ namespace BizHawk.Emulation.Cores.PCEngine
public CoreComm CoreComm { get; private set; }
ISoundProvider soundProvider;
public ISoundProvider SoundProvider
IAsyncSoundProvider soundProvider;
public IAsyncSoundProvider SoundProvider
{
get { return soundProvider; }
}

View File

@ -301,7 +301,7 @@ namespace BizHawk.Emulation.Cores.Sega.Genesis
public CoreComm CoreComm { get; private set; }
public ISoundProvider SoundProvider
public IAsyncSoundProvider SoundProvider
{
get { return SoundMixer; }
}

View File

@ -6,7 +6,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
{
public IEmulatorServiceProvider ServiceProvider { get; private set; }
public ISoundProvider SoundProvider
public IAsyncSoundProvider SoundProvider
{
get { return ActiveSoundProvider; }
}

View File

@ -118,7 +118,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
SoundMixer = new SoundMixer(YM2413, PSG);
if (HasYM2413 && game["WhenFMDisablePSG"])
SoundMixer.DisableSource(PSG);
ActiveSoundProvider = HasYM2413 ? (ISoundProvider)SoundMixer : PSG;
ActiveSoundProvider = HasYM2413 ? (IAsyncSoundProvider)SoundMixer : PSG;
SystemRam = new byte[0x2000];
@ -310,7 +310,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
else if (port == 0xF2 && HasYM2413) YM2413.DetectionValue = value;
}
private ISoundProvider ActiveSoundProvider;
private IAsyncSoundProvider ActiveSoundProvider;
private string _region;
private string RegionStr

View File

@ -364,7 +364,7 @@ namespace BizHawk.Emulation.Cores.Sega.Saturn
}
public void DiscardSamples() { }
public ISoundProvider SoundProvider { get { return null; } }
public IAsyncSoundProvider SoundProvider { get { return null; } }
public ISyncSoundProvider SyncSoundProvider { get { return this; } }
public bool StartAsyncSound() { return false; }
public void EndAsyncSound() { }

View File

@ -7,7 +7,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
{
public IEmulatorServiceProvider ServiceProvider { get; private set; }
public ISoundProvider SoundProvider { get { return null; } }
public IAsyncSoundProvider SoundProvider { get { return null; } }
public ISyncSoundProvider SyncSoundProvider
{

View File

@ -7,7 +7,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx64
{
public IEmulatorServiceProvider ServiceProvider { get; private set; }
public ISoundProvider SoundProvider { get { return null; } }
public IAsyncSoundProvider SoundProvider { get { return null; } }
public ISyncSoundProvider SyncSoundProvider
{

View File

@ -41,7 +41,7 @@ namespace BizHawk.Emulation.Cores.Sony.PSP
}
};
public ISoundProvider SoundProvider { get { return null; } }
public IAsyncSoundProvider SoundProvider { get { return null; } }
public ISyncSoundProvider SyncSoundProvider { get { return this; } }
public bool StartAsyncSound() { return false; }
public void EndAsyncSound() { }

View File

@ -861,7 +861,7 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
private short[] sbuff = new short[1611 * 2]; //need this for pal
private int sbuffcontains = 0;
public ISoundProvider SoundProvider { get { throw new InvalidOperationException(); } }
public IAsyncSoundProvider SoundProvider { get { throw new InvalidOperationException(); } }
public ISyncSoundProvider SyncSoundProvider { get { return this; } }
public bool StartAsyncSound() { return false; }
public void EndAsyncSound() { }

View File

@ -221,7 +221,7 @@ namespace BizHawk.Emulation.Cores.WonderSwan
private short[] sbuff = new short[1536];
private int sbuffcontains = 0;
public ISoundProvider SoundProvider { get { throw new InvalidOperationException(); } }
public IAsyncSoundProvider SoundProvider { get { throw new InvalidOperationException(); } }
public ISyncSoundProvider SyncSoundProvider { get { return this; } }
public bool StartAsyncSound() { return false; }
public void EndAsyncSound() { }

View File

@ -737,7 +737,7 @@ namespace BizHawk.Emulation.Cores
#region ISoundProvider
public ISoundProvider SoundProvider { get { return null; } }
public IAsyncSoundProvider SoundProvider { get { return null; } }
public ISyncSoundProvider SyncSoundProvider { get { return resampler; } }
public bool StartAsyncSound() { return false; }
public void EndAsyncSound() { }