From 60fd4cf67dfbe3fd223791e77d4e2fe1c67c613f Mon Sep 17 00:00:00 2001 From: julian laplace Date: Sat, 5 Jul 2025 00:25:43 +0200 Subject: sine --- client/lib/organ.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'client/lib/organ.js') diff --git a/client/lib/organ.js b/client/lib/organ.js index 1e45e68..30972ba 100644 --- a/client/lib/organ.js +++ b/client/lib/organ.js @@ -1,10 +1,17 @@ import Tone from "tone"; -import output from "./output"; const oscillators = {}; +let output; let lastPlayed; + +function load(out) { + output = out; +} function play(freq) { + if (!output) { + return; + } const osc = (oscillators[freq] = oscillators[freq] || {}); if (!osc.el) { osc.el = new Tone.Oscillator(freq, "sine"); @@ -15,6 +22,7 @@ function play(freq) { lastPlayed = osc; return osc; } + function pause(freq) { if (!oscillators[freq]) return; const osc = (oscillators[freq] = oscillators[freq] || {}); -- cgit v1.2.3-70-g09d2