public GambatteLink(CoreComm comm, GameInfo leftinfo, byte[] leftrom, GameInfo rightinfo, byte[] rightrom, object settings, object syncSettings, bool deterministic) { ServiceProvider = new BasicServiceProvider(this); GambatteLinkSettings linkSettings = (GambatteLinkSettings)settings ?? new GambatteLinkSettings(); GambatteLinkSyncSettings linkSyncSettings = (GambatteLinkSyncSettings)syncSettings ?? new GambatteLinkSyncSettings(); L = new Gameboy(comm, leftinfo, leftrom, linkSettings.L, linkSyncSettings.L, deterministic); R = new Gameboy(comm, rightinfo, rightrom, linkSettings.R, linkSyncSettings.R, deterministic); // connect link cable LibGambatte.gambatte_linkstatus(L.GambatteState, 259); LibGambatte.gambatte_linkstatus(R.GambatteState, 259); L.ConnectInputCallbackSystem(_inputCallbacks); R.ConnectInputCallbackSystem(_inputCallbacks); L.ConnectMemoryCallbackSystem(_memorycallbacks); R.ConnectMemoryCallbackSystem(_memorycallbacks); RomDetails = "LEFT:\r\n" + L.RomDetails + "RIGHT:\r\n" + R.RomDetails; LinkConnected = true; Frame = 0; LagCount = 0; IsLagFrame = false; _blipLeft = new BlipBuffer(1024); _blipRight = new BlipBuffer(1024); _blipLeft.SetRates(2097152 * 2, 44100); _blipRight.SetRates(2097152 * 2, 44100); SetMemoryDomains(); }
private void InitSound() { _blipL = new BlipBuffer(1024); _blipL.SetRates(TICKSPERSECOND, 44100); _blipR = new BlipBuffer(1024); _blipR.SetRates(TICKSPERSECOND, 44100); }
public void Dispose() { if (blip != null) { blip.Dispose(); blip = null; } }
public void DisposeSound() { _blip_L.Clear(); _blip_R.Clear(); _blip_L.Dispose(); _blip_R.Dispose(); _blip_L = null; _blip_R = null; }
private void SetupAudio() { Period = 1.0 / SampleRate; SamplesPerFrame = (int)(SampleRate / refreshRate); CyclesPerSample = (double)ClockPerFrame / (double)SamplesPerFrame; SampleBuffer = new short[SamplesPerFrame]; _blip = new BlipBuffer(SamplesPerFrame); _blip.SetRates(ClockPerFrame * refreshRate, SampleRate); }
/// <summary> /// Constructor /// </summary> /// <param name="blipSampleRate">The sample rate to pass to blipbuffer (this should be 44100 for ISoundProvider)</param> /// <param name="clocksPerFrame">The number of (usually CPU) clocked cycles in one frame</param> /// <param name="framesPerSecond">The number of frames per second (usually either 60 or 50)</param> /// <param name="beeperId">Unique name for this instance (needed for serialization as some cores have more than one active instance of the beeper)</param> public OneBitBeeper(int blipSampleRate, int clocksPerFrame, int framesPerSecond, string beeperId) { _beeperId = beeperId; _sampleRate = blipSampleRate; _clocksPerFrame = clocksPerFrame; _framesPerSecond = framesPerSecond; _blip = new BlipBuffer(blipSampleRate / framesPerSecond); _blip.SetRates(clocksPerFrame * 50, blipSampleRate); }
private void SetupResampler(double fps, double sps) { Console.WriteLine("FPS {0} SPS {1}", fps, sps); _outSampBuf = new short[44100]; // big enough _blipL = new BlipBuffer(44100); _blipL.SetRates(sps, 44100); _blipR = new BlipBuffer(44100); _blipR.SetRates(sps, 44100); }
public MagicSoundProvider(NES nes, uint infreq) { this.nes = nes; blip = new BlipBuffer(blipbuffsize); blip.SetRates(infreq, 44100); //var actualMetaspu = new Sound.MetaspuSoundProvider(Sound.ESynchMethod.ESynchMethod_V); //1.789773mhz NTSC //resampler = new Sound.Utilities.SpeexResampler(2, infreq, 44100 * APU.DECIMATIONFACTOR, infreq, 44100, actualMetaspu.buffer.enqueue_samples); //output = new Sound.Utilities.DCFilter(actualMetaspu); }
void DisposeSound() { if (blipL != null) { blipL.Dispose(); blipL = null; } if (blipR != null) { blipR.Dispose(); blipR = null; } }
private void DisposeSound() { if (_blipL != null) { _blipL.Dispose(); _blipL = null; } if (_blipR != null) { _blipR.Dispose(); _blipR = null; } }
public GambatteLink(CoreComm comm, GameInfo leftinfo, byte[] leftrom, GameInfo rightinfo, byte[] rightrom, object Settings, object SyncSettings, bool deterministic) { ServiceProvider = new BasicServiceProvider(this); GambatteLinkSettings _Settings = (GambatteLinkSettings)Settings ?? new GambatteLinkSettings(); GambatteLinkSyncSettings _SyncSettings = (GambatteLinkSyncSettings)SyncSettings ?? new GambatteLinkSyncSettings(); CoreComm = comm; L = new Gameboy(new CoreComm(comm.ShowMessage, comm.Notify), leftinfo, leftrom, _Settings.L, _SyncSettings.L, deterministic); R = new Gameboy(new CoreComm(comm.ShowMessage, comm.Notify), rightinfo, rightrom, _Settings.R, _SyncSettings.R, deterministic); // connect link cable LibGambatte.gambatte_linkstatus(L.GambatteState, 259); LibGambatte.gambatte_linkstatus(R.GambatteState, 259); L.Controller = LCont; R.Controller = RCont; L.ConnectInputCallbackSystem(_inputCallbacks); R.ConnectInputCallbackSystem(_inputCallbacks); L.ConnectMemoryCallbackSystem(_memorycallbacks); R.ConnectMemoryCallbackSystem(_memorycallbacks); comm.VsyncNum = L.CoreComm.VsyncNum; comm.VsyncDen = L.CoreComm.VsyncDen; comm.RomStatusAnnotation = null; comm.RomStatusDetails = "LEFT:\r\n" + L.CoreComm.RomStatusDetails + "RIGHT:\r\n" + R.CoreComm.RomStatusDetails; comm.NominalWidth = L.CoreComm.NominalWidth + R.CoreComm.NominalWidth; comm.NominalHeight = L.CoreComm.NominalHeight; LinkConnected = true; Frame = 0; LagCount = 0; IsLagFrame = false; blip_left = new BlipBuffer(1024); blip_right = new BlipBuffer(1024); blip_left.SetRates(2097152 * 2, 44100); blip_right.SetRates(2097152 * 2, 44100); SetMemoryDomains(); }
public GambatteLink(CoreLoadParameters <GambatteLink.GambatteLinkSettings, GambatteLink.GambatteLinkSyncSettings> lp) { if (lp.Roms.Count != 2) { throw new InvalidOperationException("Wrong number of roms"); } ServiceProvider = new BasicServiceProvider(this); GambatteLinkSettings linkSettings = (GambatteLinkSettings)lp.Settings ?? new GambatteLinkSettings(); GambatteLinkSyncSettings linkSyncSettings = (GambatteLinkSyncSettings)lp.SyncSettings ?? new GambatteLinkSyncSettings(); L = new Gameboy(lp.Comm, lp.Roms[0].Game, lp.Roms[0].RomData, linkSettings.L, linkSyncSettings.L, lp.DeterministicEmulationRequested); R = new Gameboy(lp.Comm, lp.Roms[1].Game, lp.Roms[1].RomData, linkSettings.R, linkSyncSettings.R, lp.DeterministicEmulationRequested); // connect link cable LibGambatte.gambatte_linkstatus(L.GambatteState, 259); LibGambatte.gambatte_linkstatus(R.GambatteState, 259); L.ConnectInputCallbackSystem(_inputCallbacks); R.ConnectInputCallbackSystem(_inputCallbacks); L.ConnectMemoryCallbackSystem(_memorycallbacks); R.ConnectMemoryCallbackSystem(_memorycallbacks); RomDetails = "LEFT:\r\n" + L.RomDetails + "RIGHT:\r\n" + R.RomDetails; LinkConnected = true; Frame = 0; LagCount = 0; IsLagFrame = false; _blipLeft = new BlipBuffer(1024); _blipRight = new BlipBuffer(1024); _blipLeft.SetRates(2097152 * 2, 44100); _blipRight.SetRates(2097152 * 2, 44100); SetMemoryDomains(); }
public void DisposeSound() { _blip.Clear(); _blip.Dispose(); _blip = null; }
public void DisposeSound() { _blip_C.Clear(); _blip_C.Dispose(); _blip_C = null; }
public GambatteLink(CoreLoadParameters <GambatteLinkSettings, GambatteLinkSyncSettings> lp) { if (lp.Roms.Count < MIN_PLAYERS || lp.Roms.Count > MAX_PLAYERS) { throw new InvalidOperationException("Wrong number of roms"); } _numCores = lp.Roms.Count; _serviceProvider = new BasicServiceProvider(this); _settings = lp.Settings ?? new GambatteLinkSettings(); _syncSettings = lp.SyncSettings ?? new GambatteLinkSyncSettings(); _linkedCores = new Gameboy[_numCores]; _linkedConts = new SaveController[_numCores]; _linkedBlips = new BlipBuffer[_numCores]; _linkedLatches = new int[_numCores]; _linkedOverflow = new int[_numCores]; RomDetails = ""; var scopes = new string[_numCores * 7]; for (int i = 0; i < _numCores; i++) { scopes[i * 7 + 0] = $"P{i + 1} System Bus"; scopes[i * 7 + 1] = $"P{i + 1} ROM"; scopes[i * 7 + 2] = $"P{i + 1} VRAM"; scopes[i * 7 + 3] = $"P{i + 1} SRAM"; scopes[i * 7 + 4] = $"P{i + 1} WRAM"; scopes[i * 7 + 5] = $"P{i + 1} OAM"; scopes[i * 7 + 6] = $"P{i + 1} HRAM"; } _memoryCallbacks = new MemoryCallbackSystem(scopes); for (int i = 0; i < _numCores; i++) { _linkedCores[i] = new Gameboy(lp.Comm, lp.Roms[i].Game, lp.Roms[i].RomData, _settings._linkedSettings[i], _syncSettings._linkedSyncSettings[i], lp.DeterministicEmulationRequested); _linkedCores[i].ConnectInputCallbackSystem(_inputCallbacks); _linkedCores[i].ConnectMemoryCallbackSystem(_memoryCallbacks, i); _linkedConts[i] = new SaveController(Gameboy.CreateControllerDefinition(false, false)); _linkedBlips[i] = new BlipBuffer(1024); _linkedBlips[i].SetRates(2097152 * 2, 44100); _linkedOverflow[i] = 0; _linkedLatches[i] = 0; RomDetails += $"P{i + 1}:\r\n" + _linkedCores[i].RomDetails; } LinkConnected = true; Frame = 0; LagCount = 0; IsLagFrame = false; SoundBuffer = new short[MaxSampsPerFrame * _numCores]; FrameBuffer = CreateVideoBuffer(); VideoBuffer = CreateVideoBuffer(); GBLinkController = CreateControllerDefinition(); _linkedSaveRam = new LinkedSaveRam(_linkedCores, _numCores); _serviceProvider.Register <ISaveRam>(_linkedSaveRam); _linkedMemoryDomains = new LinkedMemoryDomains(_linkedCores, _numCores); _serviceProvider.Register <IMemoryDomains>(_linkedMemoryDomains); _linkedDebuggable = new LinkedDebuggable(_linkedCores, _numCores, _memoryCallbacks); _serviceProvider.Register <IDebuggable>(_linkedDebuggable); }