mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-18 09:08:30 +00:00
dont autolink minirepl
This commit is contained in:
parent
da2c5c738b
commit
cd815d064d
@ -12,17 +12,10 @@ const defaultSynth = new Tone.PolySynth().chain(new Tone.Gain(0.5), Tone.Destina
|
|||||||
});
|
});
|
||||||
|
|
||||||
function MiniRepl({ tune, height = 100 }) {
|
function MiniRepl({ tune, height = 100 }) {
|
||||||
/* const defaultSynth = useMemo(() => {
|
|
||||||
return new Tone.PolySynth().chain(new Tone.Gain(0.5), Tone.Destination).set({
|
|
||||||
oscillator: { type: 'triangle' },
|
|
||||||
envelope: {
|
|
||||||
release: 0.01,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}, []); */
|
|
||||||
const { code, setCode, activateCode, activeCode, setPattern, error, cycle, dirty, log, togglePlay } = useRepl({
|
const { code, setCode, activateCode, activeCode, setPattern, error, cycle, dirty, log, togglePlay } = useRepl({
|
||||||
tune,
|
tune,
|
||||||
defaultSynth,
|
defaultSynth,
|
||||||
|
autolink: false,
|
||||||
});
|
});
|
||||||
return (
|
return (
|
||||||
<div className="flex space-y-0 overflow-auto" style={{ height }}>
|
<div className="flex space-y-0 overflow-auto" style={{ height }}>
|
||||||
|
|||||||
@ -12,7 +12,7 @@ let s4 = () => {
|
|||||||
.substring(1);
|
.substring(1);
|
||||||
};
|
};
|
||||||
|
|
||||||
function useRepl({ tune, defaultSynth }) {
|
function useRepl({ tune, defaultSynth, autolink = true }) {
|
||||||
const id = useMemo(() => s4(), []);
|
const id = useMemo(() => s4(), []);
|
||||||
const [code, setCode] = useState<string>(tune);
|
const [code, setCode] = useState<string>(tune);
|
||||||
const [activeCode, setActiveCode] = useState<string>();
|
const [activeCode, setActiveCode] = useState<string>();
|
||||||
@ -30,7 +30,9 @@ function useRepl({ tune, defaultSynth }) {
|
|||||||
try {
|
try {
|
||||||
const parsed = evaluate(_code);
|
const parsed = evaluate(_code);
|
||||||
setPattern(() => parsed.pattern);
|
setPattern(() => parsed.pattern);
|
||||||
window.location.hash = '#' + encodeURIComponent(btoa(code));
|
if (autolink) {
|
||||||
|
window.location.hash = '#' + encodeURIComponent(btoa(code));
|
||||||
|
}
|
||||||
setError(undefined);
|
setError(undefined);
|
||||||
setActiveCode(_code);
|
setActiveCode(_code);
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user