nano-repl add modules + proper eval
This commit is contained in:
parent
48bf17614f
commit
e3e3a8404a
2 changed files with 33 additions and 10 deletions
|
|
@ -1,15 +1,32 @@
|
|||
import * as strudel from '@strudel.cycles/core';
|
||||
import * as webaudio from '@strudel.cycles/webaudio';
|
||||
import '@strudel.cycles/core';
|
||||
import controls from '@strudel.cycles/core/controls.mjs';
|
||||
import { evalScope } from '@strudel.cycles/eval';
|
||||
import { webaudioOutput } from '@strudel.cycles/webaudio';
|
||||
import { useState } from 'react';
|
||||
import useScheduler from '../../../src/hooks/useScheduler';
|
||||
import useEvaluator from '../../../src/hooks/useEvaluator';
|
||||
// import { prebake } from '../../../../../repl/src/prebake.mjs';
|
||||
|
||||
Object.assign(globalThis, strudel, webaudio); // add strudel to eval scope
|
||||
await evalScope(
|
||||
controls,
|
||||
import('@strudel.cycles/core'),
|
||||
import('@strudel.cycles/tone'),
|
||||
import('@strudel.cycles/tonal'),
|
||||
import('@strudel.cycles/mini'),
|
||||
import('@strudel.cycles/midi'),
|
||||
import('@strudel.cycles/xen'),
|
||||
import('@strudel.cycles/webaudio'),
|
||||
import('@strudel.cycles/osc'),
|
||||
import('@strudel.cycles/webdirt'),
|
||||
import('@strudel.cycles/serial'),
|
||||
import('@strudel.cycles/soundfonts'),
|
||||
);
|
||||
|
||||
// await prebake();
|
||||
|
||||
function App() {
|
||||
const [code, setCode] = useState(`seq('c3','eb3').note()`);
|
||||
const { evaluate, pattern, isDirty, error: evaluatorError } = useEvaluator(code);
|
||||
const [code, setCode] = useState(`"c3 [eb3,g3]".note()`);
|
||||
const { evaluate, pattern, isDirty, error: evaluatorError } = useEvaluator({ code });
|
||||
const { scheduler, error: schedulerError } = useScheduler(pattern, webaudioOutput);
|
||||
const error = evaluatorError || schedulerError;
|
||||
return (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue