Implement event-based scheduler instead of lock-step components

This commit is contained in:
Connor McLaughlin
2020-01-24 14:53:40 +10:00
parent 624888e131
commit 1b9609ef61
26 changed files with 1089 additions and 520 deletions

View File

@ -3,11 +3,12 @@
#include "common/fifo_queue.h"
#include "types.h"
#include <array>
#include <memory>
class AudioStream;
class StateWrapper;
class System;
class TimingEvent;
class DMA;
class InterruptController;
@ -27,8 +28,6 @@ public:
void DMARead(u32* words, u32 word_count);
void DMAWrite(const u32* words, u32 word_count);
void Execute(TickCount ticks);
// Render statistics debug window.
void DrawDebugStateWindow();
@ -40,6 +39,9 @@ public:
}
void EnsureCDAudioSpace(u32 num_samples);
// Executes the SPU, generating any pending samples.
void GeneratePendingSamples();
private:
static constexpr u32 RAM_SIZE = 512 * 1024;
static constexpr u32 RAM_MASK = RAM_SIZE - 1;
@ -282,11 +284,13 @@ private:
void ReadADPCMBlock(u16 address, ADPCMBlock* block);
std::tuple<s32, s32> SampleVoice(u32 voice_index);
void GenerateSample();
void Execute(TickCount ticks);
void UpdateEventInterval();
System* m_system = nullptr;
DMA* m_dma = nullptr;
InterruptController* m_interrupt_controller = nullptr;
std::unique_ptr<TimingEvent> m_sample_event = nullptr;
SPUCNT m_SPUCNT = {};
SPUSTAT m_SPUSTAT = {};