Format
This commit is contained in:
parent
0f652e8b5b
commit
a2b76bde14
3 changed files with 25 additions and 18 deletions
|
|
@ -42,9 +42,9 @@ const extensions = {
|
||||||
isMultiCursorEnabled: (on) =>
|
isMultiCursorEnabled: (on) =>
|
||||||
on
|
on
|
||||||
? [
|
? [
|
||||||
EditorState.allowMultipleSelections.of(true),
|
EditorState.allowMultipleSelections.of(true),
|
||||||
EditorView.clickAddsSelectionRange.of((ev) => ev.metaKey || ev.ctrlKey),
|
EditorView.clickAddsSelectionRange.of((ev) => ev.metaKey || ev.ctrlKey),
|
||||||
]
|
]
|
||||||
: [],
|
: [],
|
||||||
};
|
};
|
||||||
const compartments = Object.fromEntries(Object.keys(extensions).map((key) => [key, new Compartment()]));
|
const compartments = Object.fromEntries(Object.keys(extensions).map((key) => [key, new Compartment()]));
|
||||||
|
|
|
||||||
|
|
@ -262,18 +262,18 @@ export function repl({
|
||||||
|
|
||||||
export const getTrigger =
|
export const getTrigger =
|
||||||
({ getTime, defaultOutput }) =>
|
({ getTime, defaultOutput }) =>
|
||||||
async (hap, deadline, duration, cps, t) => {
|
async (hap, deadline, duration, cps, t) => {
|
||||||
// ^ this signature is different from hap.context.onTrigger, as set by Pattern.onTrigger(onTrigger)
|
// ^ this signature is different from hap.context.onTrigger, as set by Pattern.onTrigger(onTrigger)
|
||||||
// TODO: get rid of deadline after https://codeberg.org/uzu/strudel/pulls/1004
|
// TODO: get rid of deadline after https://codeberg.org/uzu/strudel/pulls/1004
|
||||||
try {
|
try {
|
||||||
if (!hap.context.onTrigger || !hap.context.dominantTrigger) {
|
if (!hap.context.onTrigger || !hap.context.dominantTrigger) {
|
||||||
await defaultOutput(hap, deadline, duration, cps, t);
|
await defaultOutput(hap, deadline, duration, cps, t);
|
||||||
}
|
|
||||||
if (hap.context.onTrigger) {
|
|
||||||
// call signature of output / onTrigger is different...
|
|
||||||
await hap.context.onTrigger(hap, getTime(), cps, t);
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
errorLogger(err, 'getTrigger');
|
|
||||||
}
|
}
|
||||||
};
|
if (hap.context.onTrigger) {
|
||||||
|
// call signature of output / onTrigger is different...
|
||||||
|
await hap.context.onTrigger(hap, getTime(), cps, t);
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
errorLogger(err, 'getTrigger');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
|
||||||
|
|
@ -207,7 +207,14 @@ export function useReplContext() {
|
||||||
|
|
||||||
const handleExport = async (begin, end, sampleRate, downloadName = undefined) => {
|
const handleExport = async (begin, end, sampleRate, downloadName = undefined) => {
|
||||||
await editorRef.current.evaluate();
|
await editorRef.current.evaluate();
|
||||||
await renderPatternAudio(editorRef.current.repl.state.pattern, editorRef.current.repl.scheduler.cps, begin, end, sampleRate, downloadName)
|
await renderPatternAudio(
|
||||||
|
editorRef.current.repl.state.pattern,
|
||||||
|
editorRef.current.repl.scheduler.cps,
|
||||||
|
begin,
|
||||||
|
end,
|
||||||
|
sampleRate,
|
||||||
|
downloadName,
|
||||||
|
);
|
||||||
editorRef.current.repl.scheduler.stop();
|
editorRef.current.repl.scheduler.stop();
|
||||||
};
|
};
|
||||||
const handleShuffle = async () => {
|
const handleShuffle = async () => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue