1 | import { SignalOperator } from "./SignalOperator.js";
|
2 | import { WaveShaper } from "./WaveShaper.js";
|
3 | /**
|
4 | * AudioToGain converts an input in AudioRange [-1,1] to NormalRange [0,1].
|
5 | * @see {@link GainToAudio}.
|
6 | * @category Signal
|
7 | */
|
8 | export class AudioToGain extends SignalOperator {
|
9 | constructor() {
|
10 | super(...arguments);
|
11 | this.name = "AudioToGain";
|
12 | /**
|
13 | * The node which converts the audio ranges
|
14 | */
|
15 | this._norm = new WaveShaper({
|
16 | context: this.context,
|
17 | mapping: (x) => (x + 1) / 2,
|
18 | });
|
19 | /**
|
20 | * The AudioRange input [-1, 1]
|
21 | */
|
22 | this.input = this._norm;
|
23 | /**
|
24 | * The GainRange output [0, 1]
|
25 | */
|
26 | this.output = this._norm;
|
27 | }
|
28 | /**
|
29 | * clean up
|
30 | */
|
31 | dispose() {
|
32 | super.dispose();
|
33 | this._norm.dispose();
|
34 | return this;
|
35 | }
|
36 | }
|
37 | //# sourceMappingURL=AudioToGain.js.map |
\ | No newline at end of file |