Skip to content

Commit

Permalink
Faster, TODOs
Browse files Browse the repository at this point in the history
  • Loading branch information
mattgodbolt committed Dec 31, 2024
1 parent 7b3710b commit 1e12384
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/web/audio-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ class SoundChipProcessor extends AudioWorkletProcessor {
this._queueSizeBytes = 0;
this.dropped = 0;
this.underruns = 0;
this.targetLatencyMs = 1000 * (2 / 50); // Two frames
this.targetLatencyMs = 1000 * (1 / 50); // One frame
this.startQueueSizeBytes = this.inputSampleRate / this.targetLatencyMs / 2;
this.running = false;
this.maxQueueSizeBytes = this.inputSampleRate * 0.25;
this.port.onmessage = (event) => {
// TODO: even better than this, send over register settings/catch up and run the audio work _here_
this.onBuffer(event.data.time, event.data.buffer);
};
this.nextStats = 0;
Expand Down

0 comments on commit 1e12384

Please sign in to comment.