UNPKG

1.73 kBTypeScriptView Raw
1import { InputNode, OutputNode, ToneAudioNodeOptions } from "../core/context/ToneAudioNode.js";
2import { Add } from "./Add.js";
3import { Multiply } from "./Multiply.js";
4import { SignalOperator } from "./SignalOperator.js";
5export interface ScaleOptions extends ToneAudioNodeOptions {
6 min: number;
7 max: number;
8}
9/**
10 * Performs a linear scaling on an input signal.
11 * Scales a NormalRange input to between
12 * outputMin and outputMax.
13 *
14 * @example
15 * const scale = new Tone.Scale(50, 100);
16 * const signal = new Tone.Signal(0.5).connect(scale);
17 * // the output of scale equals 75
18 * @category Signal
19 */
20export declare class Scale<Options extends ScaleOptions = ScaleOptions> extends SignalOperator<Options> {
21 readonly name: string;
22 input: InputNode;
23 output: OutputNode;
24 /**
25 * Hold the multiple
26 */
27 protected _mult: Multiply;
28 /**
29 * Hold the adder
30 */
31 protected _add: Add;
32 /**
33 * Private reference to the min value
34 */
35 private _min;
36 /**
37 * Private reference to the max value
38 */
39 private _max;
40 /**
41 * @param min The output value when the input is 0.
42 * @param max The output value when the input is 1.
43 */
44 constructor(min?: number, max?: number);
45 constructor(options?: Partial<ScaleOptions>);
46 static getDefaults(): ScaleOptions;
47 /**
48 * The minimum output value. This number is output when the value input value is 0.
49 */
50 get min(): number;
51 set min(min: number);
52 /**
53 * The maximum output value. This number is output when the value input value is 1.
54 */
55 get max(): number;
56 set max(max: number);
57 /**
58 * set the values
59 */
60 private _setRange;
61 dispose(): this;
62}