mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-21 18:48:36 +00:00
nano repl now supports highlighting
This commit is contained in:
parent
acafcc9888
commit
24f8f48a2f
@ -5,6 +5,7 @@ import { useCallback, useState } from 'react';
|
|||||||
import CodeMirror, { flash } from '../../../src/components/CodeMirror6';
|
import CodeMirror, { flash } from '../../../src/components/CodeMirror6';
|
||||||
import useKeydown from '../../../src/hooks/useKeydown.mjs';
|
import useKeydown from '../../../src/hooks/useKeydown.mjs';
|
||||||
import useStrudel from '../../../src/hooks/useStrudel';
|
import useStrudel from '../../../src/hooks/useStrudel';
|
||||||
|
import useHighlighting from '../../../src/hooks/useHighlighting';
|
||||||
import './style.css';
|
import './style.css';
|
||||||
// import { prebake } from '../../../../../repl/src/prebake.mjs';
|
// import { prebake } from '../../../../../repl/src/prebake.mjs';
|
||||||
|
|
||||||
@ -62,20 +63,29 @@ stack(
|
|||||||
.echoWith(4,.125,(x,n)=>x.gain(.15*1/(n+1))) // echo notes
|
.echoWith(4,.125,(x,n)=>x.gain(.15*1/(n+1))) // echo notes
|
||||||
//.hush()
|
//.hush()
|
||||||
)
|
)
|
||||||
.cps(2/3)`;
|
.fast(2/3)`;
|
||||||
|
|
||||||
// await prebake();
|
// await prebake();
|
||||||
|
|
||||||
const ctx = getAudioContext();
|
const ctx = getAudioContext();
|
||||||
|
const getTime = () => ctx.currentTime;
|
||||||
function App() {
|
function App() {
|
||||||
const [code, setCode] = useState(defaultTune);
|
const [code, setCode] = useState(defaultTune);
|
||||||
|
const [view, setView] = useState();
|
||||||
// const [code, setCode] = useState(`"c3".note().slow(2)`);
|
// const [code, setCode] = useState(`"c3".note().slow(2)`);
|
||||||
const { scheduler, evaluate, schedulerError, evalError, isDirty } = useStrudel({
|
const { scheduler, evaluate, schedulerError, evalError, isDirty, activeCode, pattern } = useStrudel({
|
||||||
code,
|
code,
|
||||||
defaultOutput: webaudioOutput,
|
defaultOutput: webaudioOutput,
|
||||||
getTime: () => ctx.currentTime,
|
getTime,
|
||||||
});
|
});
|
||||||
const [view, setView] = useState();
|
|
||||||
|
useHighlighting({
|
||||||
|
view,
|
||||||
|
pattern,
|
||||||
|
active: !activeCode?.includes('strudel disable-highlighting'),
|
||||||
|
getTime: () => scheduler.phase,
|
||||||
|
});
|
||||||
|
|
||||||
const error = evalError || schedulerError;
|
const error = evalError || schedulerError;
|
||||||
useKeydown(
|
useKeydown(
|
||||||
useCallback(
|
useCallback(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user