Apple II - a bad attempt at wiring up sound, not hooked up since it crashes, also checking in some code that visual studio wants to be in the .sln because I am tired of reverting it

This commit is contained in:
adelikat 2015-03-27 23:24:58 +00:00
parent b74e0a3b3d
commit d30d5ba06d
3 changed files with 21 additions and 5 deletions

View File

@ -1,7 +1,9 @@
using System.IO;
using System.Linq;
using BizHawk.Emulation.Common;
using Jellyfish.Virtu;
using Jellyfish.Virtu.Services;
using System;
namespace BizHawk.Emulation.Cores.Computers.AppleII
{
@ -30,11 +32,12 @@ namespace BizHawk.Emulation.Cores.Computers.AppleII
_machine = new Machine();
var vidService = new BizVideoService(_machine);
_soundService = new BizAudioService(_machine);
var gpService = new Jellyfish.Virtu.Services.GamePortService(_machine);
var kbService = new BizKeyboardService(_machine);
_machine.Services.AddService(typeof(Jellyfish.Virtu.Services.DebugService), new Jellyfish.Virtu.Services.DebugService(_machine));
_machine.Services.AddService(typeof(Jellyfish.Virtu.Services.AudioService), new BizAudioService(_machine));
_machine.Services.AddService(typeof(Jellyfish.Virtu.Services.AudioService), _soundService);
_machine.Services.AddService(typeof(Jellyfish.Virtu.Services.VideoService), vidService);
_machine.Services.AddService(typeof(Jellyfish.Virtu.Services.GamePortService), gpService);
_machine.Services.AddService(typeof(Jellyfish.Virtu.Services.KeyboardService), kbService);
@ -55,6 +58,7 @@ namespace BizHawk.Emulation.Cores.Computers.AppleII
private readonly byte[] _disk1;
private readonly byte[] _appleIIRom;
private readonly byte[] _diskIIRom;
private readonly BizAudioService _soundService;
private static readonly ControllerDefinition AppleIIController =
new ControllerDefinition
@ -81,13 +85,26 @@ namespace BizHawk.Emulation.Cores.Computers.AppleII
}
}
private class BizAudioService : AudioService
private class BizAudioService : AudioService, ISyncSoundProvider
{
public BizAudioService(Machine _machine) : base(_machine) { }
public override void SetVolume(float volume)
{
}
public void GetSamples(out short[] samples, out int nsamp)
{
samples = Array.ConvertAll(Source, b => (short)b); // TODO: is it really 8 bit?
nsamp = Source.Length;
}
public void DiscardSamples()
{
//TODO
//Source.DiscardSamples();
}
}
private void FrameAdv(bool render, bool rendersound)

View File

@ -86,5 +86,7 @@ namespace Jellyfish.Virtu
private int _totalCycles;
private long _lastCycles;
private float _volume;
public AudioService AudioService { get { return _audioService; } }
}
}

View File

@ -138,9 +138,6 @@ Global
{E6B436B1-A3CD-4C9A-8F76-5D7154726884} = {0540A9A6-977E-466D-8BD3-1D8590BD5282}
{B95649F5-A0AE-41EB-B62B-578A2AFF5E18} = {B51F1139-3D2C-41BE-A762-EF1F9B41EACA}
EndGlobalSection
GlobalSection(Performance) = preSolution
HasPerformanceSessions = true
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = BizHawk.Client.EmuHawk\BizHawk.Client.EmuHawk.csproj
EndGlobalSection