UNPKG

2.63 kBTypeScriptView Raw
1import { Volume } from "../../component/channel/Volume.js";
2import { Decibels } from "../type/Units.js";
3import { Gain } from "./Gain.js";
4import { Param } from "./Param.js";
5import { ToneAudioNode, ToneAudioNodeOptions } from "./ToneAudioNode.js";
6interface DestinationOptions extends ToneAudioNodeOptions {
7 volume: Decibels;
8 mute: boolean;
9}
10/**
11 * A single master output which is connected to the
12 * AudioDestinationNode (aka your speakers).
13 * It provides useful conveniences such as the ability
14 * to set the volume and mute the entire application.
15 * It also gives you the ability to apply master effects to your application.
16 *
17 * @example
18 * const oscillator = new Tone.Oscillator().start();
19 * // the audio will go from the oscillator to the speakers
20 * oscillator.connect(Tone.getDestination());
21 * // a convenience for connecting to the master output is also provided:
22 * oscillator.toDestination();
23 * @category Core
24 */
25export declare class DestinationClass extends ToneAudioNode<DestinationOptions> {
26 readonly name: string;
27 input: Volume;
28 output: Gain;
29 /**
30 * The volume of the master output in decibels. -Infinity is silent, and 0 is no change.
31 * @example
32 * const osc = new Tone.Oscillator().toDestination();
33 * osc.start();
34 * // ramp the volume down to silent over 10 seconds
35 * Tone.getDestination().volume.rampTo(-Infinity, 10);
36 */
37 volume: Param<"decibels">;
38 constructor(options: Partial<DestinationOptions>);
39 static getDefaults(): DestinationOptions;
40 /**
41 * Mute the output.
42 * @example
43 * const oscillator = new Tone.Oscillator().start().toDestination();
44 * setTimeout(() => {
45 * // mute the output
46 * Tone.Destination.mute = true;
47 * }, 1000);
48 */
49 get mute(): boolean;
50 set mute(mute: boolean);
51 /**
52 * Add a master effects chain. NOTE: this will disconnect any nodes which were previously
53 * chained in the master effects chain.
54 * @param args All arguments will be connected in a row and the Master will be routed through it.
55 * @example
56 * // route all audio through a filter and compressor
57 * const lowpass = new Tone.Filter(800, "lowpass");
58 * const compressor = new Tone.Compressor(-18);
59 * Tone.Destination.chain(lowpass, compressor);
60 */
61 chain(...args: Array<AudioNode | ToneAudioNode>): this;
62 /**
63 * The maximum number of channels the system can output
64 * @example
65 * console.log(Tone.Destination.maxChannelCount);
66 */
67 get maxChannelCount(): number;
68 /**
69 * Clean up
70 */
71 dispose(): this;
72}
73export {};