mirror of
https://codeberg.org/uzu/strudel
synced 2026-10-11 18:51:34 -04:00
minor renames
This commit is contained in:
@@ -939,10 +939,10 @@ export class Pattern {
|
||||
hap.context.onSchedule?.(scheduleHap, t, cps);
|
||||
onSchedule(scheduleHap, t, cps);
|
||||
},
|
||||
// if dominantScheduler is set to true, the default output (webaudio) will be disabled
|
||||
// if dominantSchedule is set to true, the default output (webaudio) will be disabled
|
||||
// when using multiple triggers, you cannot flip this flag to false again!
|
||||
// example: x.csound('CooLSynth').log() as well as x.log().csound('CooLSynth') should work the same
|
||||
dominantScheduler: hap.context.dominantScheduler || dominant,
|
||||
dominantSchedule: hap.context.dominantSchedule || dominant,
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
setIsStarted,
|
||||
setPattern as exposeSchedulerPattern,
|
||||
setTime,
|
||||
setSchedulerFunc,
|
||||
setScheduleFunc,
|
||||
setClockTime,
|
||||
} from './schedulerState.mjs';
|
||||
import { evalScope } from './evaluate.mjs';
|
||||
@@ -62,7 +62,7 @@ export function repl({
|
||||
};
|
||||
|
||||
const schedulerOptions = {
|
||||
onSchedule: getScheduler({ onSchedule }),
|
||||
onSchedule: getSchedule({ onSchedule }),
|
||||
getTime,
|
||||
onToggle: (started) => {
|
||||
updateState({ started });
|
||||
@@ -80,7 +80,7 @@ export function repl({
|
||||
// NeoCyclist uses a shared worker to communicate between instances, which is not supported on mobile chrome
|
||||
const scheduler =
|
||||
sync && typeof SharedWorker != 'undefined' ? new NeoCyclist(schedulerOptions) : new Cyclist(schedulerOptions);
|
||||
setSchedulerFunc(schedulerOptions.onSchedule);
|
||||
setScheduleFunc(schedulerOptions.onSchedule);
|
||||
setCpsFunc(() => scheduler.cps);
|
||||
let pPatterns = {};
|
||||
let anonymousIndex = 0;
|
||||
@@ -570,17 +570,17 @@ export function repl({
|
||||
return { scheduler, evaluate, evaluateBlock, start, stop, pause, setCps, setPattern, setCode, toggle, state };
|
||||
}
|
||||
|
||||
export const getScheduler =
|
||||
export const getSchedule =
|
||||
({ onSchedule }) =>
|
||||
async (hap, t, cps) => {
|
||||
try {
|
||||
if (!hap.context.onSchedule || !hap.context.dominantScheduler) {
|
||||
if (!hap.context.onSchedule || !hap.context.dominantSchedule) {
|
||||
await onSchedule(hap, t, cps);
|
||||
}
|
||||
if (hap.context.onSchedule) {
|
||||
await hap.context.onSchedule(hap, t, cps);
|
||||
}
|
||||
} catch (err) {
|
||||
errorLogger(err, 'getScheduler');
|
||||
errorLogger(err, 'getSchedule');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -7,7 +7,7 @@ This program is free software: you can redistribute it and/or modify it under th
|
||||
let time;
|
||||
let cpsFunc;
|
||||
let pattern;
|
||||
let schedulerFunc;
|
||||
let scheduleFunc;
|
||||
let isStarted;
|
||||
|
||||
/**
|
||||
@@ -64,12 +64,12 @@ export function getPattern() {
|
||||
return pattern;
|
||||
}
|
||||
|
||||
export function setSchedulerFunc(func) {
|
||||
schedulerFunc = func;
|
||||
export function setScheduleFunc(func) {
|
||||
scheduleFunc = func;
|
||||
}
|
||||
|
||||
export function getSchedulerFunc() {
|
||||
return schedulerFunc;
|
||||
export function getScheduleFunc() {
|
||||
return scheduleFunc;
|
||||
}
|
||||
|
||||
export function setIsStarted(val) {
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
getIsStarted,
|
||||
getPattern,
|
||||
getTime,
|
||||
getSchedulerFunc,
|
||||
getScheduleFunc,
|
||||
isPattern,
|
||||
logger,
|
||||
ref,
|
||||
@@ -570,7 +570,7 @@ const kListeners = {};
|
||||
|
||||
function _triggerKeyboard(input, cps, now, latencyCycles) {
|
||||
const pattern = getPattern();
|
||||
const schedule = getSchedulerFunc();
|
||||
const schedule = getScheduleFunc();
|
||||
if (!pattern || !schedule) {
|
||||
return false;
|
||||
}
|
||||
@@ -623,7 +623,7 @@ export async function midikeys(input) {
|
||||
noteoff ||= noteon && velocity === 0; // handle devices which may use velocity = 0 to signal noteoff
|
||||
const key = `${input}_${note}`;
|
||||
const cps = getCps() ?? 0.5;
|
||||
const triggerAvailable = !!(getPattern() && getSchedulerFunc());
|
||||
const triggerAvailable = !!(getPattern() && getScheduleFunc());
|
||||
const latencySeconds = triggerAvailable ? 0.01 : 0.06; // avoid missing notes due to cyclist / trigger latency
|
||||
const now = getTime();
|
||||
const t = now + latencySeconds * cps;
|
||||
|
||||
Reference in New Issue
Block a user