Compare commits

..

1 Commits

Author SHA1 Message Date
Felix Roos 070b4364fe fix: codemirror does not vanish anymore on hot reload 2024-01-12 19:31:10 +01:00
4 changed files with 20 additions and 21 deletions
+1
View File
@@ -323,6 +323,7 @@ export class StrudelMirror {
this.editor.dispatch({ changes });
}
clear() {
this.stop();
this.onStartRepl && document.removeEventListener('start-repl', this.onStartRepl);
}
}
+1 -6
View File
@@ -87,12 +87,7 @@ const generic_params = [
*/
['gain'],
/**
* Gain applied before effect sends (delay, reverb ...)
*
*/
['pregain'],
/**
* Gain applied after effect sends (delay, reverb ...)
* Gain applied after all effects have been processed.
*
* @name postgain
* @example
+7 -14
View File
@@ -272,8 +272,7 @@ export const superdough = async (value, deadline, hapDuration) => {
bank,
source,
gain = 0.8,
pregain = 1,
postgain,
postgain = 1,
density = 0.03,
// filters
ftype = '12db',
@@ -471,15 +470,16 @@ export const superdough = async (value, deadline, hapDuration) => {
chain.push(phaserFX);
}
// pre fx gain
const pre = new GainNode(ac, { gain: pregain });
chain.push(pre);
// last gain
const post = new GainNode(ac, { gain: postgain });
chain.push(post);
connectToDestination(post, channels);
// delay
let delaySend;
if (delay > 0 && delaytime > 0 && delayfeedback > 0) {
const delyNode = getDelay(orbit, delaytime, delayfeedback, t);
delaySend = effectSend(pre, delyNode, delay);
delaySend = effectSend(post, delyNode, delay);
}
// reverb
let reverbSend;
@@ -496,16 +496,9 @@ export const superdough = async (value, deadline, hapDuration) => {
roomIR = await loadBuffer(url, ac, ir, 0);
}
const reverbNode = getReverb(orbit, roomsize, roomfade, roomlp, roomdim, roomIR);
reverbSend = effectSend(pre, reverbNode, room);
reverbSend = effectSend(post, reverbNode, room);
}
let post = pre;
if (postgain !== undefined) {
// post fx gain
post = new GainNode(ac, { gain: postgain });
chain.push(post);
}
connectToDestination(post, channels);
// analyser
let analyserSend;
if (analyze) {
+11 -1
View File
@@ -100,6 +100,16 @@ export function Repl({ embedded = false }) {
});
editorRef.current = editor;
if (import.meta.hot) {
import.meta.hot.dispose(() => {
editorRef.current.clear();
setTimeout(() => {
delete editorRef.current;
delete containerRef.current;
});
});
}
}, []);
const [replState, setReplState] = useState({});
@@ -199,7 +209,7 @@ export function Repl({ embedded = false }) {
id="code"
ref={(el) => {
containerRef.current = el;
if (!editorRef.current) {
if (!editorRef.current && containerRef.current) {
init();
}
}}