fix: clear hydra on reset
This commit is contained in:
parent
0875e805b4
commit
012b19c79e
2 changed files with 21 additions and 3 deletions
|
|
@ -17,6 +17,7 @@ import {
|
|||
import { defaultAudioDeviceName } from '../settings.mjs';
|
||||
import { getAudioDevices, setAudioDevice } from './util.mjs';
|
||||
import { StrudelMirror, defaultSettings } from '@strudel/codemirror';
|
||||
import { clearHydra } from '@strudel/hydra';
|
||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
import { settingsMap, useSettings } from '../settings.mjs';
|
||||
import {
|
||||
|
|
@ -75,6 +76,11 @@ export function Repl({ embedded = false }) {
|
|||
onUpdateState: (state) => {
|
||||
setReplState({ ...state });
|
||||
},
|
||||
onToggle: (playing) => {
|
||||
if (!playing) {
|
||||
clearHydra();
|
||||
}
|
||||
},
|
||||
afterEval: (all) => {
|
||||
const { code } = all;
|
||||
setLatestCode(code);
|
||||
|
|
@ -165,6 +171,7 @@ export function Repl({ embedded = false }) {
|
|||
const resetEditor = async () => {
|
||||
resetGlobalEffects();
|
||||
clearCanvas();
|
||||
clearHydra();
|
||||
resetLoadedSounds();
|
||||
editorRef.current.repl.setCps(0.5);
|
||||
await prebake(); // declare default samples
|
||||
|
|
@ -189,6 +196,7 @@ export function Repl({ embedded = false }) {
|
|||
setActivePattern(patternData.id);
|
||||
setViewingPatternData(patternData);
|
||||
clearCanvas();
|
||||
clearHydra();
|
||||
resetLoadedSounds();
|
||||
resetGlobalEffects();
|
||||
await prebake(); // declare default samples
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue