Fix some SMS audio inaccuracies (squashed PR #3602)
* fix noise audio channel on SMS VDP * Update SN76489sms.cs also, white noise is generated by XORing bits 0 and 3, not 0 and 1, on an SMS/GG VDP * Update SN76489sms.cs reverting commit #7b857e7
This commit is contained in:
parent
dd30a389a0
commit
102dee9622
|
@ -24,8 +24,6 @@ namespace BizHawk.Emulation.Cores.Components
|
||||||
public int noise_rate;
|
public int noise_rate;
|
||||||
public bool noise_bit;
|
public bool noise_bit;
|
||||||
|
|
||||||
public ushort tone_low;
|
|
||||||
|
|
||||||
public bool A_L, B_L, C_L, noise_L;
|
public bool A_L, B_L, C_L, noise_L;
|
||||||
public bool A_R, B_R, C_R, noise_R;
|
public bool A_R, B_R, C_R, noise_R;
|
||||||
|
|
||||||
|
@ -90,8 +88,6 @@ namespace BizHawk.Emulation.Cores.Components
|
||||||
ser.Sync(nameof(noise_clock), ref noise_clock);
|
ser.Sync(nameof(noise_clock), ref noise_clock);
|
||||||
ser.Sync(nameof(noise_bit), ref noise_bit);
|
ser.Sync(nameof(noise_bit), ref noise_bit);
|
||||||
|
|
||||||
ser.Sync(nameof(tone_low), ref tone_low);
|
|
||||||
|
|
||||||
ser.Sync(nameof(psg_clock), ref psg_clock);
|
ser.Sync(nameof(psg_clock), ref psg_clock);
|
||||||
|
|
||||||
ser.Sync(nameof(A_up), ref A_up);
|
ser.Sync(nameof(A_up), ref A_up);
|
||||||
|
@ -137,7 +133,8 @@ namespace BizHawk.Emulation.Cores.Components
|
||||||
{
|
{
|
||||||
if (chan_sel < 3)
|
if (chan_sel < 3)
|
||||||
{
|
{
|
||||||
tone_low = (ushort)(value & 0xF);
|
Chan_tone[chan_sel] &= 0x3F0;
|
||||||
|
Chan_tone[chan_sel] |= (ushort)(value & 0xF);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -159,7 +156,8 @@ namespace BizHawk.Emulation.Cores.Components
|
||||||
{
|
{
|
||||||
if (chan_sel < 3)
|
if (chan_sel < 3)
|
||||||
{
|
{
|
||||||
Chan_tone[chan_sel] = (ushort)(((value & 0x3F) << 4) | tone_low);
|
Chan_tone[chan_sel] &= 0xF;
|
||||||
|
Chan_tone[chan_sel] |= (ushort)((value & 0x3F) << 4);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -193,11 +191,11 @@ namespace BizHawk.Emulation.Cores.Components
|
||||||
noise_bit = noise.Bit(0);
|
noise_bit = noise.Bit(0);
|
||||||
if (noise_type)
|
if (noise_type)
|
||||||
{
|
{
|
||||||
noise = (((noise & 1) ^ ((noise >> 1) & 1)) << 14) | (noise >> 1);
|
noise = (((noise & 1) ^ ((noise >> 3) & 1)) << 15) | (noise >> 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
noise = ((noise & 1) << 14) | (noise >> 1);
|
noise = ((noise & 1) << 15) | (noise >> 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (noise_rate == 0)
|
if (noise_rate == 0)
|
||||||
|
@ -224,21 +222,18 @@ namespace BizHawk.Emulation.Cores.Components
|
||||||
{
|
{
|
||||||
A_up = !A_up;
|
A_up = !A_up;
|
||||||
clock_A = Chan_tone[0] + 1;
|
clock_A = Chan_tone[0] + 1;
|
||||||
if (clock_A == 1) { A_up = !A_up; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clock_B == 0)
|
if (clock_B == 0)
|
||||||
{
|
{
|
||||||
B_up = !B_up;
|
B_up = !B_up;
|
||||||
clock_B = Chan_tone[1] + 1;
|
clock_B = Chan_tone[1] + 1;
|
||||||
if (clock_B == 1) { B_up = !B_up; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clock_C == 0)
|
if (clock_C == 0)
|
||||||
{
|
{
|
||||||
C_up = !C_up;
|
C_up = !C_up;
|
||||||
clock_C = Chan_tone[2] + 1;
|
clock_C = Chan_tone[2] + 1;
|
||||||
if (clock_C == 1) { C_up = !C_up; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// now calculate the volume of each channel and add them together
|
// now calculate the volume of each channel and add them together
|
||||||
|
@ -260,4 +255,4 @@ namespace BizHawk.Emulation.Cores.Components
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue