mirror of
https://github.com/MrPatben8/konduktor.git
synced 2026-11-27 10:22:51 +01:00
Implemented standalone builds
This commit is contained in:
1 parent
43213f6220
commit
f1c8e2c575
37 files changed
+5771
-10
No files matched your search
@@ -82,6 +82,22 @@ export function PrepStrip({ track, playRequest = 0, onError }: Props) {
|
||||
return audioCtxRef.current
|
||||
}
|
||||
|
||||
// Tear everything down when the strip itself unmounts (e.g. the collection
|
||||
// picker early-returns and replaces the whole UI). Without this, the playback
|
||||
// source keeps running in an AudioContext that's never closed, so a fresh
|
||||
// remount plays a SECOND track on top of the orphaned one. Closing both
|
||||
// contexts is the surefire kill; runs once, on unmount.
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
playbackRef.current?.pause()
|
||||
scratchRef.current?.dispose()
|
||||
void audioCtxRef.current?.close()
|
||||
void scratchCtxRef.current?.close()
|
||||
audioCtxRef.current = null
|
||||
scratchCtxRef.current = null
|
||||
}
|
||||
}, [])
|
||||
|
||||
// The scratch engine gets its OWN AudioContext: a ScriptProcessorNode is
|
||||
// unreliable sharing a context with the playback source node (it goes silent
|
||||
// once a source has played), so we keep them fully separate.
|
||||
|
||||
Reference in new issue
Block a user