UNPKG

1.21 kBJavaScriptView Raw
1import { Gain } from "../core/context/Gain.js";
2import { connect, disconnect, } from "../core/context/ToneAudioNode.js";
3import { optionsFromArguments } from "../core/util/Defaults.js";
4import { SignalOperator } from "./SignalOperator.js";
5/**
6 * Tone.Zero outputs 0's at audio-rate. The reason this has to be
7 * it's own class is that many browsers optimize out Tone.Signal
8 * with a value of 0 and will not process nodes further down the graph.
9 * @category Signal
10 */
11export class Zero extends SignalOperator {
12 constructor() {
13 super(optionsFromArguments(Zero.getDefaults(), arguments));
14 this.name = "Zero";
15 /**
16 * The gain node which connects the constant source to the output
17 */
18 this._gain = new Gain({ context: this.context });
19 /**
20 * Only outputs 0
21 */
22 this.output = this._gain;
23 /**
24 * no input node
25 */
26 this.input = undefined;
27 connect(this.context.getConstant(0), this._gain);
28 }
29 /**
30 * clean up
31 */
32 dispose() {
33 super.dispose();
34 disconnect(this.context.getConstant(0), this._gain);
35 return this;
36 }
37}
38//# sourceMappingURL=Zero.js.map
\No newline at end of file