diff --git a/src/App.tsx b/src/App.tsx index 53a48d63..ac0c882e 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,6 +1,6 @@ import { useState, useRef } from 'react' import { useStore } from '@nanostores/react' -import { Square, Archive, Dices, Sparkles } from 'lucide-react' +import { Square, Archive, Dices, Sparkles, Blend } from 'lucide-react' import { DownloadService } from './services/DownloadService' import { generateRandomFormula } from './utils/bytebeatFormulas' import { BytebeatTile } from './components/tile/BytebeatTile' @@ -55,7 +55,7 @@ function App() { } }) - const { saveCurrentParams, loadParams, handleEngineChange, handleEffectChange, randomizeParams, randomizeAllParams } = + const { saveCurrentParams, loadParams, handleEngineChange, handleEffectChange, randomizeParams, randomizeAllParams, interpolateParams } = useParameterSync({ tiles, setTiles, @@ -171,9 +171,18 @@ function App() { } } + const handleRegenerate = (row: number, col: number) => { + const newTile = regenerateTile(row, col) + const tileId = getTileId(row, col) + + if (playing === tileId) { + play(newTile.formula, tileId, newTile) + } + } + const handleKeyboardR = () => { if (focusedTile !== 'custom') { - regenerateTile(focusedTile.row, focusedTile.col) + handleRegenerate(focusedTile.row, focusedTile.col) } } @@ -200,6 +209,7 @@ function App() { onShiftR: handleRandom, onC: handleKeyboardC, onShiftC: randomizeAllParams, + onI: interpolateParams, onEscape: exitMappingMode }) @@ -296,6 +306,12 @@ function App() { > + +