Skip to content

Commit

Permalink
LLE DSP: Handle cycle drifting
Browse files Browse the repository at this point in the history
  • Loading branch information
wheremyfoodat committed Oct 4, 2024
1 parent 3e72323 commit 6bb3198
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion include/audio/teakra_core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ namespace Audio {
// Run 1 slice of DSP instructions and schedule the next audio frame
void runAudioFrame(u64 eventTimestamp) override {
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;
Expand Down

0 comments on commit 6bb3198

Please sign in to comment.