1 | import { AudioToGain } from "../signal/AudioToGain.js";
|
2 | import { optionsFromArguments } from "../core/util/Defaults.js";
|
3 | import { ModulationSynth } from "./ModulationSynth.js";
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | export class AMSynth extends ModulationSynth {
|
18 | constructor() {
|
19 | super(optionsFromArguments(AMSynth.getDefaults(), arguments));
|
20 | this.name = "AMSynth";
|
21 | this._modulationScale = new AudioToGain({
|
22 | context: this.context,
|
23 | });
|
24 |
|
25 | this.frequency.connect(this._carrier.frequency);
|
26 | this.frequency.chain(this.harmonicity, this._modulator.frequency);
|
27 | this.detune.fan(this._carrier.detune, this._modulator.detune);
|
28 | this._modulator.chain(this._modulationScale, this._modulationNode.gain);
|
29 | this._carrier.chain(this._modulationNode, this.output);
|
30 | }
|
31 | dispose() {
|
32 | super.dispose();
|
33 | this._modulationScale.dispose();
|
34 | return this;
|
35 | }
|
36 | }
|
37 |
|
\ | No newline at end of file |