fix mini repl draw + tutorial

This commit is contained in:
Felix Roos 2022-02-27 11:57:30 +01:00
parent 1375932c05
commit e719cea0de
4 changed files with 20 additions and 17 deletions

View file

@ -11,13 +11,15 @@ const defaultSynth = new Tone.PolySynth().chain(new Tone.Gain(0.5), Tone.Destina
},
});
// "balanced" | "interactive" | "playback";
Tone.setContext(new Tone.Context({ latencyHint: 'playback', lookAhead: 1 }));
function MiniRepl({ tune, maxHeight = 500 }) {
const [editor, setEditor] = useState<any>();
const { code, setCode, activateCode, activeCode, setPattern, error, cycle, dirty, log, togglePlay, hash } = useRepl({
tune,
defaultSynth,
autolink: false,
onEvent: useCallback(markEvent(editor), [editor]),
onDraw: useCallback(markEvent(editor), [editor]),
});
const lines = code.split('\n').length;
const height = Math.min(lines * 30 + 30, maxHeight);