sync highlighting with tone draw

This commit is contained in:
Felix Roos
2022-02-27 11:52:34 +01:00
parent cad81acc44
commit 1375932c05
4 changed files with 15 additions and 7 deletions
+2 -1
View File
@@ -11,7 +11,7 @@ let s4 = () => {
.substring(1);
};
function useRepl({ tune, defaultSynth, autolink = true, onEvent }: any) {
function useRepl({ tune, defaultSynth, autolink = true, onEvent, onDraw }: any) {
const id = useMemo(() => s4(), []);
const [code, setCode] = useState<string>(tune);
const [activeCode, setActiveCode] = useState<string>();
@@ -52,6 +52,7 @@ function useRepl({ tune, defaultSynth, autolink = true, onEvent }: any) {
};
// cycle hook to control scheduling
const cycle = useCycle({
onDraw,
onEvent: useCallback(
(time, event) => {
try {