2024-05-03 18:31:14 +00:00
|
|
|
export { getContext, setContext } from "./core/Global.js";
|
|
|
|
import { Context } from "./core/context/Context.js";
|
|
|
|
export * from "./classes.js";
|
|
|
|
export * from "./version.js";
|
|
|
|
import { getContext } from "./core/Global.js";
|
|
|
|
import { ToneAudioBuffer } from "./core/context/ToneAudioBuffer.js";
|
|
|
|
export { start } from "./core/Global.js";
|
|
|
|
import { Seconds } from "./core/type/Units.js";
|
|
|
|
export { supported } from "./core/context/AudioContext.js";
|
|
|
|
import type { TransportClass } from "./core/clock/Transport.js";
|
|
|
|
import type { DestinationClass } from "./core/context/Destination.js";
|
|
|
|
import type { DrawClass } from "./core/util/Draw.js";
|
|
|
|
import type { ListenerClass } from "./core/context/Listener.js";
|
2019-08-30 16:01:51 +00:00
|
|
|
|
2019-07-11 15:05:03 +00:00
|
|
|
/**
|
2024-04-30 13:44:57 +00:00
|
|
|
* The current audio context time of the global {@link BaseContext}.
|
2024-04-29 17:34:53 +00:00
|
|
|
* @see {@link Context.now}
|
2019-11-16 21:42:19 +00:00
|
|
|
* @category Core
|
2019-07-11 15:05:03 +00:00
|
|
|
*/
|
2020-06-17 03:14:34 +00:00
|
|
|
export function now(): Seconds {
|
|
|
|
return getContext().now();
|
|
|
|
}
|
2019-07-25 15:29:36 +00:00
|
|
|
|
2019-07-25 22:26:03 +00:00
|
|
|
/**
|
2024-04-29 17:34:53 +00:00
|
|
|
* The current audio context time of the global {@link Context} without the {@link Context.lookAhead}
|
|
|
|
* @see {@link Context.immediate}
|
2019-11-16 21:42:19 +00:00
|
|
|
* @category Core
|
2019-10-29 18:30:12 +00:00
|
|
|
*/
|
2020-06-17 03:14:34 +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.
|
2024-04-29 16:59:49 +00:00
|
|
|
* @see {@link TransportClass}
|
2019-11-16 21:42:19 +00:00
|
|
|
* @category Core
|
2024-04-28 17:05:26 +00:00
|
|
|
* @deprecated Use {@link getTransport} instead
|
2019-07-25 22:26:03 +00:00
|
|
|
*/
|
2019-07-25 15:29:36 +00:00
|
|
|
export const Transport = getContext().transport;
|
2019-07-25 22:26:03 +00:00
|
|
|
|
2020-06-17 03:14:34 +00:00
|
|
|
/**
|
|
|
|
* The Transport object belonging to the global Tone.js Context.
|
2024-04-29 16:59:49 +00:00
|
|
|
* @see {@link TransportClass}
|
2020-06-17 03:14:34 +00:00
|
|
|
* @category Core
|
|
|
|
*/
|
2024-04-30 13:44:57 +00:00
|
|
|
export function getTransport(): TransportClass {
|
2020-06-17 03:14:34 +00:00
|
|
|
return getContext().transport;
|
|
|
|
}
|
|
|
|
|
2019-07-25 22:26:03 +00:00
|
|
|
/**
|
2019-10-29 18:30:12 +00:00
|
|
|
* The Destination (output) belonging to the global Tone.js Context.
|
2024-04-29 16:59:49 +00:00
|
|
|
* @see {@link DestinationClass}
|
2019-11-16 21:42:19 +00:00
|
|
|
* @category Core
|
2024-04-28 17:05:26 +00:00
|
|
|
* @deprecated Use {@link getDestination} instead
|
2019-07-25 22:26:03 +00:00
|
|
|
*/
|
2019-07-25 15:29:36 +00:00
|
|
|
export const Destination = getContext().destination;
|
2019-10-28 16:12:27 +00:00
|
|
|
|
2020-06-25 15:26:38 +00:00
|
|
|
/**
|
2024-04-28 17:05:26 +00:00
|
|
|
* @deprecated Use {@link getDestination} instead
|
2020-06-25 15:26:38 +00:00
|
|
|
*/
|
|
|
|
export const Master = getContext().destination;
|
|
|
|
|
2020-06-17 03:14:34 +00:00
|
|
|
/**
|
|
|
|
* The Destination (output) belonging to the global Tone.js Context.
|
2024-04-29 16:59:49 +00:00
|
|
|
* @see {@link DestinationClass}
|
2020-06-17 03:14:34 +00:00
|
|
|
* @category Core
|
|
|
|
*/
|
2024-04-30 13:44:57 +00:00
|
|
|
export function getDestination(): DestinationClass {
|
2020-06-17 03:14:34 +00:00
|
|
|
return getContext().destination;
|
|
|
|
}
|
|
|
|
|
2019-12-22 02:01:45 +00:00
|
|
|
/**
|
2024-04-29 14:48:37 +00:00
|
|
|
* The {@link ListenerClass} belonging to the global Tone.js Context.
|
2019-12-22 02:01:45 +00:00
|
|
|
* @category Core
|
2024-04-28 17:05:26 +00:00
|
|
|
* @deprecated Use {@link getListener} instead
|
2019-12-22 02:01:45 +00:00
|
|
|
*/
|
|
|
|
export const Listener = getContext().listener;
|
|
|
|
|
2020-06-17 03:14:34 +00:00
|
|
|
/**
|
2024-04-29 14:48:37 +00:00
|
|
|
* The {@link ListenerClass} belonging to the global Tone.js Context.
|
2020-06-17 03:14:34 +00:00
|
|
|
* @category Core
|
|
|
|
*/
|
2024-04-30 13:44:57 +00:00
|
|
|
export function getListener(): ListenerClass {
|
2020-06-17 03:14:34 +00:00
|
|
|
return getContext().listener;
|
|
|
|
}
|
|
|
|
|
2019-10-28 16:12:27 +00:00
|
|
|
/**
|
2024-04-30 13:44:57 +00:00
|
|
|
* Draw is used to synchronize the draw frame with the Transport's callbacks.
|
2024-04-29 16:59:49 +00:00
|
|
|
* @see {@link DrawClass}
|
2019-11-16 21:42:19 +00:00
|
|
|
* @category Core
|
2024-04-28 17:05:26 +00:00
|
|
|
* @deprecated Use {@link getDraw} instead
|
2019-10-28 16:12:27 +00:00
|
|
|
*/
|
|
|
|
export const Draw = getContext().draw;
|
2019-10-30 18:48:41 +00:00
|
|
|
|
2020-06-17 03:14:34 +00:00
|
|
|
/**
|
2024-04-30 13:44:57 +00:00
|
|
|
* Get the singleton attached to the global context.
|
|
|
|
* Draw is used to synchronize the draw frame with the Transport's callbacks.
|
2024-04-29 16:59:49 +00:00
|
|
|
* @see {@link DrawClass}
|
2020-06-17 03:14:34 +00:00
|
|
|
* @category Core
|
|
|
|
*/
|
2024-04-30 13:44:57 +00:00
|
|
|
export function getDraw(): DrawClass {
|
2020-06-17 03:14:34 +00:00
|
|
|
return getContext().draw;
|
|
|
|
}
|
|
|
|
|
2019-10-30 18:48:41 +00:00
|
|
|
/**
|
|
|
|
* A reference to the global context
|
2024-04-29 17:34:53 +00:00
|
|
|
* @see {@link Context}
|
2024-04-28 17:05:26 +00:00
|
|
|
* @deprecated Use {@link getContext} instead
|
2019-10-30 18:48:41 +00:00
|
|
|
*/
|
|
|
|
export const context = getContext();
|
2019-11-16 21:42:19 +00:00
|
|
|
|
|
|
|
/**
|
2024-04-30 13:44:57 +00:00
|
|
|
* Promise which resolves when all of the loading promises are resolved.
|
2024-04-29 14:48:37 +00:00
|
|
|
* Alias for static {@link ToneAudioBuffer.loaded} method.
|
2019-11-16 21:42:19 +00:00
|
|
|
* @category Core
|
|
|
|
*/
|
2020-06-25 15:26:38 +00:00
|
|
|
export function loaded() {
|
|
|
|
return ToneAudioBuffer.loaded();
|
|
|
|
}
|
2020-02-02 16:41:24 +00:00
|
|
|
|
|
|
|
// this fills in name changes from 13.x to 14.x
|
2024-05-03 18:31:14 +00:00
|
|
|
import { ToneAudioBuffers } from "./core/context/ToneAudioBuffers.js";
|
|
|
|
import { ToneBufferSource } from "./source/buffer/ToneBufferSource.js";
|
2024-04-28 17:05:26 +00:00
|
|
|
/** @deprecated Use {@link ToneAudioBuffer} */
|
2020-02-02 16:41:24 +00:00
|
|
|
export const Buffer: typeof ToneAudioBuffer = ToneAudioBuffer;
|
2024-04-28 17:05:26 +00:00
|
|
|
/** @deprecated Use {@link ToneAudioBuffers} */
|
2020-02-02 16:41:24 +00:00
|
|
|
export const Buffers: typeof ToneAudioBuffers = ToneAudioBuffers;
|
2024-04-28 17:05:26 +00:00
|
|
|
/** @deprecated Use {@link ToneBufferSource} */
|
2020-02-02 16:41:24 +00:00
|
|
|
export const BufferSource: typeof ToneBufferSource = ToneBufferSource;
|