From 95db4f215940c4b2ced155cfd6b9c79fcf729eb4 Mon Sep 17 00:00:00 2001 From: alyosha-tas Date: Wed, 3 Jul 2019 20:49:27 -0400 Subject: [PATCH] Vectrex: add pcm sample playback --- BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/Audio.cs | 7 ++++++- .../Consoles/GCE/Vectrex/HW_Registers.cs | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/Audio.cs b/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/Audio.cs index 0f60a066c4..71f3522fd0 100644 --- a/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/Audio.cs +++ b/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/Audio.cs @@ -18,6 +18,9 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex private short current_sample, old_sample; + // not actually part of the AY chip, the Vectrex schematics show a line directly feeding audio from multiplexer output + public short pcm_sample; + public byte[] Register = new byte[16]; public byte port_sel; @@ -76,6 +79,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex ser.Sync(nameof(old_sample), ref old_sample); ser.Sync(nameof(master_audio_clock), ref master_audio_clock); + ser.Sync(nameof(pcm_sample), ref pcm_sample); + sync_psg_state(); ser.EndSection(); @@ -300,7 +305,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex v += (short)(sound_out_C ? VolumeTable[env_E] : 0); } - current_sample = (short)v; + current_sample = (short)(v + pcm_sample); if (current_sample != old_sample) { diff --git a/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/HW_Registers.cs b/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/HW_Registers.cs index 50de9f755a..60b9de2767 100644 --- a/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/HW_Registers.cs +++ b/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/HW_Registers.cs @@ -181,7 +181,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex { if (sel0) { - if (sel1) {/* sound line? */ } + if (sel1) {/* sound samples direct to output */ audio.pcm_sample = (short)(portA_ret << 6); } else { ppu.vec_scale = portA_ret; if (portA_ret != 0) { Console.WriteLine("scale: " + portA_ret); } } } else @@ -220,7 +220,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex { if (sel0) { - if (sel1) {/* sound line? */ } + if (sel1) {/* sound samples direct to output */ audio.pcm_sample = (short)(portA_ret << 6); } else { ppu.vec_scale = portA_ret; if (portA_ret != 0) { Console.WriteLine("scale: " + portA_ret); } } } else