summaryrefslogtreecommitdiff
path: root/client/lib/organ.js
diff options
context:
space:
mode:
Diffstat (limited to 'client/lib/organ.js')
-rw-r--r--client/lib/organ.js39
1 files changed, 19 insertions, 20 deletions
diff --git a/client/lib/organ.js b/client/lib/organ.js
index 0048abf..1e45e68 100644
--- a/client/lib/organ.js
+++ b/client/lib/organ.js
@@ -1,27 +1,26 @@
-import Tone from 'tone'
-import output from './output'
+import Tone from "tone";
+import output from "./output";
-const oscillators = {}
+const oscillators = {};
-let lastPlayed
-function play (freq) {
- const osc = oscillators[freq] = oscillators[freq] || {}
+let lastPlayed;
+function play(freq) {
+ const osc = (oscillators[freq] = oscillators[freq] || {});
if (!osc.el) {
- osc.el = new Tone.Oscillator(freq, "sine")
- osc.el.connect(output)
+ osc.el = new Tone.Oscillator(freq, "sine");
+ osc.el.connect(output);
}
- osc.el.start()
- osc.playing = true
- lastPlayed = osc
- return osc
+ osc.el.start();
+ osc.playing = true;
+ lastPlayed = osc;
+ return osc;
}
-function pause (freq) {
- if (!oscillators[freq]) return
- const osc = oscillators[freq] = oscillators[freq] || {}
- if (osc.el) osc.el.stop()
- osc.playing = false
- return osc
+function pause(freq) {
+ if (!oscillators[freq]) return;
+ const osc = (oscillators[freq] = oscillators[freq] || {});
+ if (osc.el) osc.el.stop();
+ osc.playing = false;
+ return osc;
}
-export default { play, pause, oscillators }
-
+export default { play, pause, oscillators };