MiniRepl: add punchcard flag for implicit vis

+ reintroduce editPattern
+ add punchcards to mini-notation.mdx
This commit is contained in:
Felix Roos 2023-01-13 15:13:39 +01:00
parent e4f538b674
commit b2c6d87633
10 changed files with 323 additions and 310 deletions

View file

@ -13,7 +13,8 @@ import { logger } from '@strudel.cycles/core';
const getTime = () => getAudioContext().currentTime;
export function MiniRepl({ tune, hideOutsideView = false, enableKeyboard, drawTime, canvasHeight = 200 }) {
export function MiniRepl({ tune, hideOutsideView = false, enableKeyboard, drawTime, punchcard, canvasHeight = 200 }) {
drawTime = drawTime || (punchcard ? [0, 4] : undefined);
const {
code,
setCode,
@ -32,6 +33,7 @@ export function MiniRepl({ tune, hideOutsideView = false, enableKeyboard, drawTi
} = useStrudel({
initialCode: tune,
defaultOutput: webaudioOutput,
editPattern: (pat) => (punchcard ? pat.punchcard() : pat),
getTime,
evalOnMount: !!drawTime,
drawContext: !!drawTime ? (canvasId) => document.querySelector('#' + canvasId)?.getContext('2d') : null,