Atari 2600: Sketchy implementation of audio output (mode 0x01 only)
This commit is contained in:
parent
516735d3b6
commit
2d94018eaa
|
@ -71,7 +71,40 @@ namespace BizHawk
|
|||
public int BufferWidth { get { return 320; } }
|
||||
public int BufferHeight { get { return 262; } }
|
||||
public int BackgroundColor { get { return 0; } }
|
||||
public void GetSamples(short[] samples) { }
|
||||
public void GetSamples(short[] samples)
|
||||
{
|
||||
int freqDiv = 0;
|
||||
byte myP4 = 0x00;
|
||||
|
||||
short[] moreSamples = new short[1000];
|
||||
for (int i = 0; i < 1000; i++)
|
||||
{
|
||||
if (++freqDiv == (tia.audioFreqDiv * 2))
|
||||
{
|
||||
freqDiv = 0;
|
||||
myP4 = (byte)(((myP4 & 0x0f) != 0) ? ((myP4 << 1) | ((((myP4 & 0x08) != 0) ? 1 : 0) ^ (((myP4 & 0x04) != 0) ? 1 : 0))) : 1);
|
||||
}
|
||||
|
||||
moreSamples[i] = (short)(((myP4 & 0x08) != 0) ? 32767 : 0);
|
||||
|
||||
}
|
||||
|
||||
for (int i = 0; i < samples.Length/2; i++)
|
||||
{
|
||||
//samples[i] = 0;
|
||||
if (tia.audioEnabled)
|
||||
{
|
||||
samples[i*2] = moreSamples[(int)(((double)moreSamples.Length / (double)(samples.Length/2)) * i)];
|
||||
//samples[i * 2 + 1] = moreSamples[(int)((moreSamples.Length / (samples.Length / 2)) * i)];
|
||||
//samples[i] = (short)(Math.Sin(((((32000.0 / (tia.audioFreqDiv+1)) / 60.0) * Math.PI) / samples.Length) * i) * MaxVolume + MaxVolume);
|
||||
}
|
||||
else
|
||||
{
|
||||
samples[i] = 0;
|
||||
}
|
||||
}
|
||||
//samples = tia.samples;
|
||||
}
|
||||
public void DiscardSamples() { }
|
||||
public int MaxVolume { get; set; }
|
||||
private IList<MemoryDomain> memoryDomains;
|
||||
|
|
|
@ -11,6 +11,9 @@ namespace BizHawk.Emulation.Consoles.Atari
|
|||
{
|
||||
Atari2600 core;
|
||||
|
||||
public bool audioEnabled = false;
|
||||
public byte audioFreqDiv = 0;
|
||||
|
||||
UInt32 PF; // PlayField data
|
||||
byte BKcolor, PFcolor;
|
||||
bool PFpriority = false;
|
||||
|
@ -536,6 +539,14 @@ namespace BizHawk.Emulation.Consoles.Atari
|
|||
{
|
||||
ball.pos = (byte)(scanlinePos - 68 + 4);
|
||||
}
|
||||
else if (maskedAddr == 0x15) // AUDC0
|
||||
{
|
||||
audioEnabled = value != 0;
|
||||
}
|
||||
else if (maskedAddr == 0x17) // AUDF0
|
||||
{
|
||||
audioFreqDiv = (byte)(value + 1);
|
||||
}
|
||||
else if (maskedAddr == 0x1B) // GRP0
|
||||
{
|
||||
player0.grp = value;
|
||||
|
|
Loading…
Reference in New Issue