mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-24 12:08:28 +00:00
add cleanup to sound tab
This commit is contained in:
parent
be6b011204
commit
41d82eaadf
@ -258,7 +258,10 @@ function SoundsTab() {
|
|||||||
className="cursor-pointer hover:opacity-50"
|
className="cursor-pointer hover:opacity-50"
|
||||||
onMouseDown={async () => {
|
onMouseDown={async () => {
|
||||||
const ctx = getAudioContext();
|
const ctx = getAudioContext();
|
||||||
trigRef.current = Promise.resolve(onTrigger(ctx.currentTime + 0.05, { freq: 220, s: name, clip: 1 }));
|
const params = { freq: 220, s: name, clip: 1, release: 0.5 };
|
||||||
|
const time = ctx.currentTime + 0.05;
|
||||||
|
const onended = () => trigRef.current?.node?.disconnect();
|
||||||
|
trigRef.current = Promise.resolve(onTrigger(time, params, onended));
|
||||||
trigRef.current.then((ref) => {
|
trigRef.current.then((ref) => {
|
||||||
ref?.node.connect(ctx.destination);
|
ref?.node.connect(ctx.destination);
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user