2011-01-21 03:59:50 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
2011-01-11 02:55:51 +00:00
|
|
|
|
|
2013-11-04 01:39:19 +00:00
|
|
|
|
namespace BizHawk.Emulation.Common
|
2011-01-11 02:55:51 +00:00
|
|
|
|
{
|
2014-12-04 02:12:57 +00:00
|
|
|
|
public interface IEmulator : IEmulatorService, IDisposable
|
2011-07-30 20:49:36 +00:00
|
|
|
|
{
|
2014-12-04 03:38:30 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Retrieves an IEmulatorService from the core,
|
|
|
|
|
/// if the core does not have the type specified, it will return null
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <typeparam name="T"></typeparam>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
IEmulatorServiceProvider ServiceProvider { get; }
|
|
|
|
|
|
2013-11-06 02:15:29 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Video provider to the client
|
|
|
|
|
/// </summary>
|
2011-07-30 20:49:36 +00:00
|
|
|
|
IVideoProvider VideoProvider { get; }
|
2013-11-06 02:15:29 +00:00
|
|
|
|
|
2012-10-11 01:14:14 +00:00
|
|
|
|
/// <summary>
|
2013-11-06 02:15:29 +00:00
|
|
|
|
/// Sound provider for async operation. this is optional, and is only required after StartAsyncSound() is called and returns true
|
2012-10-11 01:14:14 +00:00
|
|
|
|
/// </summary>
|
2011-07-30 20:49:36 +00:00
|
|
|
|
ISoundProvider SoundProvider { get; }
|
2013-11-06 02:15:29 +00:00
|
|
|
|
|
2012-10-11 01:14:14 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// sound provider for sync operation. this is manditory
|
|
|
|
|
/// </summary>
|
sound api changes. added a new ISyncSoundProvider, which works similarly to ISoundProvider except the source (not the sink) determines the number of samples to process. Added facilities to metaspu, dcfilter, speexresampler to work with ISyncSoundProvider. Add ISyncSoundProvider to IEmulator. All IEmulators must provide sync sound, but they need not provide async sound. When async is needed and an IEmulator doesn't provide it, the frontend will wrap it in a vecna metaspu. SNES, GB changed to provide sync sound only. All other emulator cores mostly unchanged; they just provide stub fakesync alongside async, for now. For the moment, the only use of the sync sound is for realtime audio throttling, where it works and sounds quite nice. In the future, sync sound will be supported for AV dumping as well.
2012-10-11 00:44:59 +00:00
|
|
|
|
ISyncSoundProvider SyncSoundProvider { get; }
|
2013-11-06 02:15:29 +00:00
|
|
|
|
|
2012-10-11 01:14:14 +00:00
|
|
|
|
/// <summary>start async operation. (on construct, sync operation is assumed).</summary>
|
|
|
|
|
/// <returns>false if core doesn't support async sound; SyncSoundProvider will continue to be used in that case</returns>
|
sound api changes. added a new ISyncSoundProvider, which works similarly to ISoundProvider except the source (not the sink) determines the number of samples to process. Added facilities to metaspu, dcfilter, speexresampler to work with ISyncSoundProvider. Add ISyncSoundProvider to IEmulator. All IEmulators must provide sync sound, but they need not provide async sound. When async is needed and an IEmulator doesn't provide it, the frontend will wrap it in a vecna metaspu. SNES, GB changed to provide sync sound only. All other emulator cores mostly unchanged; they just provide stub fakesync alongside async, for now. For the moment, the only use of the sync sound is for realtime audio throttling, where it works and sounds quite nice. In the future, sync sound will be supported for AV dumping as well.
2012-10-11 00:44:59 +00:00
|
|
|
|
bool StartAsyncSound();
|
2012-10-11 01:14:14 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// end async operation, returning to sync operation. after this, all sound requests will go to the SyncSoundProvider
|
|
|
|
|
/// </summary>
|
sound api changes. added a new ISyncSoundProvider, which works similarly to ISoundProvider except the source (not the sink) determines the number of samples to process. Added facilities to metaspu, dcfilter, speexresampler to work with ISyncSoundProvider. Add ISyncSoundProvider to IEmulator. All IEmulators must provide sync sound, but they need not provide async sound. When async is needed and an IEmulator doesn't provide it, the frontend will wrap it in a vecna metaspu. SNES, GB changed to provide sync sound only. All other emulator cores mostly unchanged; they just provide stub fakesync alongside async, for now. For the moment, the only use of the sync sound is for realtime audio throttling, where it works and sounds quite nice. In the future, sync sound will be supported for AV dumping as well.
2012-10-11 00:44:59 +00:00
|
|
|
|
void EndAsyncSound();
|
2011-07-30 20:49:36 +00:00
|
|
|
|
|
2013-11-06 02:15:29 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Defines all the possible inputs and types that the core can receive
|
|
|
|
|
/// </summary>
|
2011-07-30 20:49:36 +00:00
|
|
|
|
ControllerDefinition ControllerDefinition { get; }
|
|
|
|
|
IController Controller { get; set; }
|
|
|
|
|
|
2013-11-06 02:15:29 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
// note that (some?) cores expect you to call SoundProvider.GetSamples() after each FrameAdvance()
|
2012-09-20 19:52:47 +00:00
|
|
|
|
// please do this, even when rendersound = false
|
2013-11-06 02:15:29 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// </summary>
|
2012-09-20 20:00:14 +00:00
|
|
|
|
void FrameAdvance(bool render, bool rendersound = true);
|
2011-07-30 20:49:36 +00:00
|
|
|
|
|
2013-11-06 02:15:29 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// The frame count
|
|
|
|
|
/// </summary>
|
2011-07-30 20:49:36 +00:00
|
|
|
|
int Frame { get; }
|
2013-11-06 02:15:29 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The unique Id of the given core, for instance "NES"
|
|
|
|
|
/// </summary>
|
2011-07-30 20:49:36 +00:00
|
|
|
|
string SystemId { get; }
|
2013-11-06 02:15:29 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// This flag is a contract with the client.
|
|
|
|
|
/// If true, the core agrees to behave in a completely deterministic manner,
|
|
|
|
|
/// Features like movie recording depend on this.
|
|
|
|
|
/// It is the client's responsibility to manage this flag.
|
|
|
|
|
/// If a core wants to implement non-deterministic features (like speed hacks, frame-skipping), it must be done only when this flag is false
|
|
|
|
|
/// if you want to set this, look in the emulator's constructor or Load() method
|
|
|
|
|
/// </summary>
|
2012-10-03 15:31:04 +00:00
|
|
|
|
bool DeterministicEmulation { get; }
|
2011-07-30 20:49:36 +00:00
|
|
|
|
|
2013-08-24 16:54:22 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// identifying information about a "mapper" or similar capability. null if no such useful distinction can be drawn
|
|
|
|
|
/// </summary>
|
|
|
|
|
string BoardName { get; }
|
|
|
|
|
|
2013-11-06 02:15:29 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Resets the Frame and Lag counters, and any other similar counters a core might implement
|
|
|
|
|
/// </summary>
|
2013-11-03 16:29:51 +00:00
|
|
|
|
void ResetCounters();
|
2013-11-06 02:15:29 +00:00
|
|
|
|
|
2012-12-10 00:43:43 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// the corecomm module in use by this core.
|
|
|
|
|
/// </summary>
|
|
|
|
|
CoreComm CoreComm { get; }
|
2014-10-19 01:22:47 +00:00
|
|
|
|
}
|
2011-01-11 02:55:51 +00:00
|
|
|
|
}
|