mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-26 13:08:28 +00:00
scheduler error handling
This commit is contained in:
parent
b5c51e231b
commit
1a1363ef77
@ -38,7 +38,7 @@ export class Cyclist {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.warn('scheduler error', e);
|
console.warn('scheduler error: ', e.message);
|
||||||
onError?.(e);
|
onError?.(e);
|
||||||
}
|
}
|
||||||
}, // called slightly before each cycle
|
}, // called slightly before each cycle
|
||||||
|
|||||||
@ -55,9 +55,13 @@ export const midi2note = (n) => {
|
|||||||
export const mod = (n, m) => ((n % m) + m) % m;
|
export const mod = (n, m) => ((n % m) + m) % m;
|
||||||
|
|
||||||
export const getPlayableNoteValue = (hap) => {
|
export const getPlayableNoteValue = (hap) => {
|
||||||
let { value: note, context } = hap;
|
let { value, context } = hap;
|
||||||
|
let note = value;
|
||||||
if (typeof note === 'object' && !Array.isArray(note)) {
|
if (typeof note === 'object' && !Array.isArray(note)) {
|
||||||
note = note.note || note.n || note.value;
|
note = note.note || note.n || note.value;
|
||||||
|
if (note === undefined) {
|
||||||
|
throw new Error(`cannot find a playable note for ${JSON.stringify(value)}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// if value is number => interpret as midi number as long as its not marked as frequency
|
// if value is number => interpret as midi number as long as its not marked as frequency
|
||||||
if (typeof note === 'number' && context.type !== 'frequency') {
|
if (typeof note === 'number' && context.type !== 'frequency') {
|
||||||
|
|||||||
@ -30,6 +30,7 @@ function useStrudel({ defaultOutput, interval, getTime, evalOnMount = false, ini
|
|||||||
setActiveCode(code);
|
setActiveCode(code);
|
||||||
setPattern(_pattern);
|
setPattern(_pattern);
|
||||||
setEvalError();
|
setEvalError();
|
||||||
|
setSchedulerError();
|
||||||
if (autolink) {
|
if (autolink) {
|
||||||
window.location.hash = '#' + encodeURIComponent(btoa(code));
|
window.location.hash = '#' + encodeURIComponent(btoa(code));
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user