UNPKG

3 kBTypeScriptView Raw
1import { AudioRange, Decibels } from "../../core/type/Units.js";
2import { InputNode, OutputNode, ToneAudioNode, ToneAudioNodeOptions } from "../../core/context/ToneAudioNode.js";
3import { Param } from "../../core/context/Param.js";
4import { Gain } from "../../core/context/Gain.js";
5export interface ChannelOptions extends ToneAudioNodeOptions {
6 pan: AudioRange;
7 volume: Decibels;
8 solo: boolean;
9 mute: boolean;
10 channelCount: number;
11}
12/**
13 * Channel provides a channel strip interface with volume, pan, solo and mute controls.
14 * @see {@link PanVol} and {@link Solo}
15 * @example
16 * // pan the incoming signal left and drop the volume 12db
17 * const channel = new Tone.Channel(-0.25, -12);
18 * @category Component
19 */
20export declare class Channel extends ToneAudioNode<ChannelOptions> {
21 readonly name: string;
22 readonly input: InputNode;
23 readonly output: OutputNode;
24 /**
25 * The soloing interface
26 */
27 private _solo;
28 /**
29 * The panning and volume node
30 */
31 private _panVol;
32 /**
33 * The L/R panning control. -1 = hard left, 1 = hard right.
34 * @min -1
35 * @max 1
36 */
37 readonly pan: Param<"audioRange">;
38 /**
39 * The volume control in decibels.
40 */
41 readonly volume: Param<"decibels">;
42 /**
43 * @param volume The output volume.
44 * @param pan the initial pan
45 */
46 constructor(volume?: Decibels, pan?: AudioRange);
47 constructor(options?: Partial<ChannelOptions>);
48 static getDefaults(): ChannelOptions;
49 /**
50 * Solo/unsolo the channel. Soloing is only relative to other {@link Channel}s and {@link Solo} instances
51 */
52 get solo(): boolean;
53 set solo(solo: boolean);
54 /**
55 * If the current instance is muted, i.e. another instance is soloed,
56 * or the channel is muted
57 */
58 get muted(): boolean;
59 /**
60 * Mute/unmute the volume
61 */
62 get mute(): boolean;
63 set mute(mute: boolean);
64 /**
65 * Store the send/receive channels by name.
66 */
67 private static buses;
68 /**
69 * Get the gain node belonging to the bus name. Create it if
70 * it doesn't exist
71 * @param name The bus name
72 */
73 private _getBus;
74 /**
75 * Send audio to another channel using a string. `send` is a lot like
76 * {@link connect}, except it uses a string instead of an object. This can
77 * be useful in large applications to decouple sections since {@link send}
78 * and {@link receive} can be invoked separately in order to connect an object
79 * @param name The channel name to send the audio
80 * @param volume The amount of the signal to send.
81 * Defaults to 0db, i.e. send the entire signal
82 * @returns Returns the gain node of this connection.
83 */
84 send(name: string, volume?: Decibels): Gain<"decibels">;
85 /**
86 * Receive audio from a channel which was connected with {@link send}.
87 * @param name The channel name to receive audio from.
88 */
89 receive(name: string): this;
90 dispose(): this;
91}