mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-25 12:38:35 +00:00
use new getTime callback in repl + mini repl
This commit is contained in:
parent
7b0c80c8be
commit
ec4cfe6f86
@ -8,6 +8,7 @@ import 'tailwindcss/tailwind.css';
|
|||||||
import './style.css';
|
import './style.css';
|
||||||
import styles from './MiniRepl.module.css';
|
import styles from './MiniRepl.module.css';
|
||||||
import { Icon } from './Icon';
|
import { Icon } from './Icon';
|
||||||
|
import { Tone } from '@strudel.cycles/tone';
|
||||||
|
|
||||||
export function MiniRepl({ tune, defaultSynth, hideOutsideView = false, theme, init, onEvent, enableKeyboard }) {
|
export function MiniRepl({ tune, defaultSynth, hideOutsideView = false, theme, init, onEvent, enableKeyboard }) {
|
||||||
const { code, setCode, pattern, activeCode, activateCode, evaluateOnly, error, cycle, dirty, togglePlay, stop } =
|
const { code, setCode, pattern, activeCode, activateCode, evaluateOnly, error, cycle, dirty, togglePlay, stop } =
|
||||||
@ -31,7 +32,12 @@ export function MiniRepl({ tune, defaultSynth, hideOutsideView = false, theme, i
|
|||||||
}
|
}
|
||||||
return isVisible || wasVisible.current;
|
return isVisible || wasVisible.current;
|
||||||
}, [isVisible, hideOutsideView]);
|
}, [isVisible, hideOutsideView]);
|
||||||
useHighlighting({ view, pattern, active: cycle.started && !activeCode?.includes('strudel disable-highlighting') });
|
useHighlighting({
|
||||||
|
view,
|
||||||
|
pattern,
|
||||||
|
active: cycle.started && !activeCode?.includes('strudel disable-highlighting'),
|
||||||
|
getTime: () => Tone.getTransport().seconds,
|
||||||
|
});
|
||||||
|
|
||||||
// set active pattern on ctrl+enter
|
// set active pattern on ctrl+enter
|
||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
|
|||||||
@ -144,7 +144,12 @@ function App() {
|
|||||||
return () => window.removeEventListener('keydown', handleKeyPress, true);
|
return () => window.removeEventListener('keydown', handleKeyPress, true);
|
||||||
}, [pattern, code, activateCode, cycle, view]);
|
}, [pattern, code, activateCode, cycle, view]);
|
||||||
|
|
||||||
useHighlighting({ view, pattern, active: cycle.started && !activeCode?.includes('strudel disable-highlighting') });
|
useHighlighting({
|
||||||
|
view,
|
||||||
|
pattern,
|
||||||
|
active: cycle.started && !activeCode?.includes('strudel disable-highlighting'),
|
||||||
|
getTime: () => Tone.getTransport().seconds,
|
||||||
|
});
|
||||||
|
|
||||||
useWebMidi({
|
useWebMidi({
|
||||||
ready: useCallback(
|
ready: useCallback(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user