UNPKG

1.56 kBTypeScriptView Raw
1import { Param } from "../core/context/Param.js";
2import { Signal, SignalOptions } from "./Signal.js";
3import { InputNode, OutputNode } from "../core/context/ToneAudioNode.js";
4/**
5 * Multiply two incoming signals. Or, if a number is given in the constructor,
6 * multiplies the incoming signal by that value.
7 *
8 * @example
9 * // multiply two signals
10 * const mult = new Tone.Multiply();
11 * const sigA = new Tone.Signal(3);
12 * const sigB = new Tone.Signal(4);
13 * sigA.connect(mult);
14 * sigB.connect(mult.factor);
15 * // output of mult is 12.
16 * @example
17 * // multiply a signal and a number
18 * const mult = new Tone.Multiply(10);
19 * const sig = new Tone.Signal(2).connect(mult);
20 * // the output of mult is 20.
21 * @category Signal
22 */
23export declare class Multiply<TypeName extends "number" | "positive" = "number"> extends Signal<TypeName> {
24 readonly name: string;
25 /**
26 * Indicates if the value should be overridden on connection
27 */
28 readonly override = false;
29 /**
30 * the input gain node
31 */
32 private _mult;
33 /**
34 * The multiplicand input.
35 */
36 input: InputNode;
37 /**
38 * The product of the input and {@link factor}
39 */
40 output: OutputNode;
41 /**
42 * The multiplication factor. Can be set directly or a signal can be connected to it.
43 */
44 factor: Param<TypeName>;
45 /**
46 * @param value Constant value to multiple
47 */
48 constructor(value?: number);
49 constructor(options?: Partial<SignalOptions<TypeName>>);
50 static getDefaults(): SignalOptions<any>;
51 dispose(): this;
52}