use performance clock for osc mode
This commit is contained in:
parent
8da1d9fbf3
commit
796f741a92
5 changed files with 19 additions and 8 deletions
|
|
@ -412,6 +412,11 @@ export class ClockCollator {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
export function getPerformanceTimeSeconds() {
|
||||
return performance.now() / 1000
|
||||
}
|
||||
|
||||
// Floating point versions, see Fraction for rational versions
|
||||
// // greatest common divisor
|
||||
// export const gcd = function (x, y, ...z) {
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ function connect() {
|
|||
return connection;
|
||||
}
|
||||
|
||||
// const collator = new ClockCollator({getTargetClockTime: () => (performance.now() + performance.timeOrigin) / 1000});
|
||||
const collator = new ClockCollator({});
|
||||
|
||||
export async function oscTrigger(t_deprecate, hap, currentTime, cps = 1, targetTime) {
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
import { oscTriggerTauri } from '../desktopbridge/oscbridge.mjs';
|
||||
import { isTauri } from '../desktopbridge/utils.mjs';
|
||||
import { getAudioContext } from '../superdough/superdough.mjs';
|
||||
import { oscTrigger } from './osc.mjs';
|
||||
|
||||
|
||||
const trigger = isTauri() ? oscTriggerTauri : oscTrigger;
|
||||
|
||||
export const superdirtOutput = (hap, deadline, hapDuration, cps, targetTime) => {
|
||||
const ctx = getAudioContext();
|
||||
const currentTime = ctx.currentTime;
|
||||
const currentTime = performance.now() / 1000
|
||||
return trigger(null, hap, currentTime, cps, targetTime);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -87,6 +87,10 @@ export const getAudioContext = () => {
|
|||
return audioContext;
|
||||
};
|
||||
|
||||
export function getAudioContextCurrentTime() {
|
||||
return getAudioContext().currentTime
|
||||
}
|
||||
|
||||
let workletsLoading;
|
||||
function loadWorklets() {
|
||||
if (!workletsLoading) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue