Skip to content

Commit

Permalink
context
Browse files Browse the repository at this point in the history
  • Loading branch information
stephband committed Sep 17, 2023
1 parent ea805d9 commit babbddc
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions modules/context.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,7 @@ Returns a time just ahead of context.currentTime that compensates
for block jitter caused by cueing everything to currentTime.
*/

const safetyTime = 0;
let discrepancy = 0;
let discrepancy = 0;
export function getDejitterTime(context) {
// FOR SOME REASON THERE IS a 200ms discrepancy betweeen this currentTime
// and the currentTime it is by the time the sequence starts, and I cant
Expand All @@ -174,11 +173,11 @@ export function getDejitterTime(context) {

// A rolling diff that always chases the max
if (diff > discrepancy) {
print('Rolling latency', diff.toFixed(3));
print('Rolling latency', diff.toFixed(6), context.baseLatency, context.outputLatency);
discrepancy = diff > discrepancy ? diff : discrepancy ;
}

const time = stamp.contextTime + discrepancy + safetyTime + 128 / context.sampleRate;;
const time = stamp.contextTime + discrepancy + 128 / context.sampleRate;;

if (time < currentTime) {
console.log('Something is really wrong');
Expand Down

0 comments on commit babbddc

Please sign in to comment.