UNPKG

2.24 kBTypeScriptView Raw
1import { Signal, SignalOptions } from "./Signal.js";
2import { NormalRange, Time, TransportTime, UnitMap, UnitName } from "../core/type/Units.js";
3import { OutputNode } from "../core/context/ToneAudioNode.js";
4/**
5 * Adds the ability to synchronize the signal to the {@link TransportClass}
6 * @category Signal
7 */
8export declare class SyncedSignal<TypeName extends UnitName = "number"> extends Signal<TypeName> {
9 readonly name: string;
10 /**
11 * Don't override when something is connected to the input
12 */
13 readonly override = false;
14 readonly output: OutputNode;
15 /**
16 * Keep track of the last value as an optimization.
17 */
18 private _lastVal;
19 /**
20 * The ID returned from scheduleRepeat
21 */
22 private _synced;
23 /**
24 * Remember the callback value
25 */
26 private _syncedCallback;
27 /**
28 * @param value Initial value of the signal
29 * @param units The unit name, e.g. "frequency"
30 */
31 constructor(value?: UnitMap[TypeName], units?: TypeName);
32 constructor(options?: Partial<SignalOptions<TypeName>>);
33 /**
34 * Callback which is invoked every tick.
35 */
36 private _onTick;
37 /**
38 * Anchor the value at the start and stop of the Transport
39 */
40 private _anchorValue;
41 getValueAtTime(time: TransportTime): UnitMap[TypeName];
42 setValueAtTime(value: UnitMap[TypeName], time: TransportTime): this;
43 linearRampToValueAtTime(value: UnitMap[TypeName], time: TransportTime): this;
44 exponentialRampToValueAtTime(value: UnitMap[TypeName], time: TransportTime): this;
45 setTargetAtTime(value: any, startTime: TransportTime, timeConstant: number): this;
46 cancelScheduledValues(startTime: TransportTime): this;
47 setValueCurveAtTime(values: UnitMap[TypeName][], startTime: TransportTime, duration: Time, scaling: NormalRange): this;
48 cancelAndHoldAtTime(time: TransportTime): this;
49 setRampPoint(time: TransportTime): this;
50 exponentialRampTo(value: UnitMap[TypeName], rampTime: Time, startTime?: TransportTime): this;
51 linearRampTo(value: UnitMap[TypeName], rampTime: Time, startTime?: TransportTime): this;
52 targetRampTo(value: UnitMap[TypeName], rampTime: Time, startTime?: TransportTime): this;
53 dispose(): this;
54}