1 | import { Multiply } from "./Multiply.js";
|
2 | import { SignalOperator } from "./SignalOperator.js";
|
3 | /**
|
4 | * Negate the incoming signal. i.e. an input signal of 10 will output -10
|
5 | *
|
6 | * @example
|
7 | * const neg = new Tone.Negate();
|
8 | * const sig = new Tone.Signal(-2).connect(neg);
|
9 | * // output of neg is positive 2.
|
10 | * @category Signal
|
11 | */
|
12 | export class Negate extends SignalOperator {
|
13 | constructor() {
|
14 | super(...arguments);
|
15 | this.name = "Negate";
|
16 | /**
|
17 | * negation is done by multiplying by -1
|
18 | */
|
19 | this._multiply = new Multiply({
|
20 | context: this.context,
|
21 | value: -1,
|
22 | });
|
23 | /**
|
24 | * The input and output are equal to the multiply node
|
25 | */
|
26 | this.input = this._multiply;
|
27 | this.output = this._multiply;
|
28 | }
|
29 | /**
|
30 | * clean up
|
31 | * @returns {Negate} this
|
32 | */
|
33 | dispose() {
|
34 | super.dispose();
|
35 | this._multiply.dispose();
|
36 | return this;
|
37 | }
|
38 | }
|
39 | //# sourceMappingURL=Negate.js.map |
\ | No newline at end of file |