new IPSG interface ahead of trying to A/B a version of the ColecoHawk AY-3-8910

This commit is contained in:
Asnivor 2018-03-13 14:00:29 +00:00
parent 4e088574cf
commit a7ed14cfe1
5 changed files with 70 additions and 3 deletions

View File

@ -258,6 +258,7 @@
<Compile Include="Computers\Commodore64\User\UserPortDevice.cs" />
<Compile Include="Computers\SinclairSpectrum\Hardware\Abstraction\IJoystick.cs" />
<Compile Include="Computers\SinclairSpectrum\Hardware\Abstraction\IPortIODevice.cs" />
<Compile Include="Computers\SinclairSpectrum\Hardware\Abstraction\IPSG.cs" />
<Compile Include="Computers\SinclairSpectrum\Hardware\Input\CursorJoystick.cs" />
<Compile Include="Computers\SinclairSpectrum\Hardware\Input\SinclairJoystick2.cs" />
<Compile Include="Computers\SinclairSpectrum\Hardware\Input\SinclairJoystick1.cs" />

View File

@ -0,0 +1,66 @@
using BizHawk.Common;
using BizHawk.Emulation.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
/// <summary>
/// Represents a PSG device (in this case an AY-3-891x)
/// </summary>
public interface IPSG : ISoundProvider
{
/// <summary>
/// Initlization routine
/// </summary>
/// <param name="sampleRate"></param>
/// <param name="tStatesPerFrame"></param>
void Init(int sampleRate, int tStatesPerFrame);
/// <summary>
/// Activates a register
/// </summary>
int SelectedRegister { get; set; }
/// <summary>
/// Writes to the PSG
/// </summary>
/// <param name="value"></param>
void PortWrite(int value);
/// <summary>
/// Reads from the PSG
/// </summary>
int PortRead();
/// <summary>
/// Resets the PSG
/// </summary>
void Reset();
/// <summary>
/// Called at the start of a frame
/// </summary>
void StartFrame();
/// <summary>
/// called at the end of a frame
/// </summary>
void EndFrame();
/// <summary>
/// Updates the sound based on number of frame cycles
/// </summary>
/// <param name="frameCycle"></param>
void UpdateSound(int frameCycle);
/// <summary>
/// IStatable serialization
/// </summary>
/// <param name="ser"></param>
void SyncState(Serializer ser);
}
}

View File

@ -594,7 +594,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
_machine.Spectrum.OSD_TapePlayingAuto();
}
_monitorTimeOut = 90;
_monitorTimeOut = 50;
}
}
else

View File

@ -7,7 +7,7 @@ using System.Linq;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
public class AY38912 : ISoundProvider
public class AY38912 : IPSG
{
private int _tStatesPerFrame;
private int _sampleRate;

View File

@ -42,7 +42,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
/// <summary>
/// Device representing the AY-3-8912 chip found in the 128k and up spectrums
/// </summary>
public AY38912 AYDevice { get; set; }
public IPSG AYDevice { get; set; }
/// <summary>
/// The spectrum keyboard