LLE DSP: Handle cycle drifting

This commit is contained in:
wheremyfoodat 2024-10-04 18:03:10 +03:00
parent 3e72323653
commit 6bb3198006

View file

@ -85,7 +85,9 @@ namespace Audio {
// Run 1 slice of DSP instructions and schedule the next audio frame // Run 1 slice of DSP instructions and schedule the next audio frame
void runAudioFrame(u64 eventTimestamp) override { void runAudioFrame(u64 eventTimestamp) override {
runSlice(); runSlice();
scheduler.addEvent(Scheduler::EventType::RunDSP, scheduler.currentTimestamp + Audio::lleSlice * 2); // How many cycles we were late
const u64 cycleDrift = scheduler.currentTimestamp - eventTimestamp;
scheduler.addEvent(Scheduler::EventType::RunDSP, scheduler.currentTimestamp + Audio::lleSlice * 2 - cycleDrift);
} }
void setAudioEnabled(bool enable) override; void setAudioEnabled(bool enable) override;