Tone.js/Tone/index.ts

125 lines
3.5 KiB
TypeScript
Raw Normal View History

export { getContext, setContext } from "./core/Global";
2019-08-30 16:01:51 +00:00
export * from "./classes";
2019-11-07 20:43:46 +00:00
export * from "./version";
import { getContext } from "./core/Global";
import { ToneAudioBuffer } from "./core/context/ToneAudioBuffer";
2019-07-30 14:26:13 +00:00
export { start } from "./core/Global";
import { Seconds } from "./core/type/Units";
export { supported } from "./core/context/AudioContext";
2019-08-30 16:01:51 +00:00
/**
2019-10-29 18:30:12 +00:00
* The current audio context time of the global [[Context]].
* See [[Context.now]]
* @category Core
*/
export function now(): Seconds {
return getContext().now();
}
2019-07-25 15:29:36 +00:00
/**
2019-10-29 18:30:12 +00:00
* The current audio context time of the global [[Context]] without the [[Context.lookAhead]]
* See [[Context.immediate]]
* @category Core
2019-10-29 18:30:12 +00:00
*/
export function immediate(): Seconds {
return getContext().immediate();
}
2019-10-29 18:30:12 +00:00
/**
* The Transport object belonging to the global Tone.js Context.
* See [[TransportClass]]
* @category Core
* @deprecated Use {@link getTransport} instead
*/
2019-07-25 15:29:36 +00:00
export const Transport = getContext().transport;
/**
* The Transport object belonging to the global Tone.js Context.
* See [[TransportClass]]
* @category Core
*/
export function getTransport(): import("./core/clock/Transport").TransportClass {
return getContext().transport;
}
/**
2019-10-29 18:30:12 +00:00
* The Destination (output) belonging to the global Tone.js Context.
* See [[DestinationClass]]
* @category Core
* @deprecated Use {@link getDestination} instead
*/
2019-07-25 15:29:36 +00:00
export const Destination = getContext().destination;
/**
* @deprecated Use {@link getDestination} instead
*/
export const Master = getContext().destination;
/**
* The Destination (output) belonging to the global Tone.js Context.
* See [[DestinationClass]]
* @category Core
*/
export function getDestination(): import("./core/context/Destination").DestinationClass {
return getContext().destination;
}
/**
* The [[ListenerClass]] belonging to the global Tone.js Context.
* @category Core
* @deprecated Use {@link getListener} instead
*/
export const Listener = getContext().listener;
/**
* The [[ListenerClass]] belonging to the global Tone.js Context.
* @category Core
*/
export function getListener(): import("./core/context/Listener").ListenerClass {
return getContext().listener;
}
/**
* Draw is used to synchronize the draw frame with the Transport's callbacks.
* See [[DrawClass]]
* @category Core
* @deprecated Use {@link getDraw} instead
*/
export const Draw = getContext().draw;
2019-10-30 18:48:41 +00:00
/**
* Get the singleton attached to the global context.
* Draw is used to synchronize the draw frame with the Transport's callbacks.
* See [[DrawClass]]
* @category Core
*/
export function getDraw(): import("./core/util/Draw").DrawClass {
return getContext().draw;
}
2019-10-30 18:48:41 +00:00
/**
* A reference to the global context
* See [[Context]]
* @deprecated Use {@link getContext} instead
2019-10-30 18:48:41 +00:00
*/
export const context = getContext();
/**
* Promise which resolves when all of the loading promises are resolved.
* Alias for static [[ToneAudioBuffer.loaded]] method.
* @category Core
*/
export function loaded() {
return ToneAudioBuffer.loaded();
}
// this fills in name changes from 13.x to 14.x
import { ToneAudioBuffers } from "./core/context/ToneAudioBuffers";
import { ToneBufferSource } from "./source/buffer/ToneBufferSource";
/** @deprecated Use {@link ToneAudioBuffer} */
export const Buffer: typeof ToneAudioBuffer = ToneAudioBuffer;
/** @deprecated Use {@link ToneAudioBuffers} */
export const Buffers: typeof ToneAudioBuffers = ToneAudioBuffers;
/** @deprecated Use {@link ToneBufferSource} */
export const BufferSource: typeof ToneBufferSource = ToneBufferSource;