1 | export { getContext, setContext } from "./core/Global.js";
|
2 | import { Context } from "./core/context/Context.js";
|
3 | export * from "./classes.js";
|
4 | export * from "./version.js";
|
5 | import { getContext } from "./core/Global.js";
|
6 | import { ToneAudioBuffer } from "./core/context/ToneAudioBuffer.js";
|
7 | export { start } from "./core/Global.js";
|
8 | import { Seconds } from "./core/type/Units.js";
|
9 | export { supported } from "./core/context/AudioContext.js";
|
10 | import type { TransportClass } from "./core/clock/Transport.js";
|
11 | import type { DestinationClass } from "./core/context/Destination.js";
|
12 | import type { DrawClass } from "./core/util/Draw.js";
|
13 | import type { ListenerClass } from "./core/context/Listener.js";
|
14 |
|
15 | /**
|
16 | * The current audio context time of the global {@link BaseContext}.
|
17 | * @see {@link Context.now}
|
18 | * @category Core
|
19 | */
|
20 | export function now(): Seconds {
|
21 | return getContext().now();
|
22 | }
|
23 |
|
24 | /**
|
25 | * The current audio context time of the global {@link Context} without the {@link Context.lookAhead}
|
26 | * @see {@link Context.immediate}
|
27 | * @category Core
|
28 | */
|
29 | export function immediate(): Seconds {
|
30 | return getContext().immediate();
|
31 | }
|
32 |
|
33 | /**
|
34 | * The Transport object belonging to the global Tone.js Context.
|
35 | * @see {@link TransportClass}
|
36 | * @category Core
|
37 | * @deprecated Use {@link getTransport} instead
|
38 | */
|
39 | export const Transport = getContext().transport;
|
40 |
|
41 | /**
|
42 | * The Transport object belonging to the global Tone.js Context.
|
43 | * @see {@link TransportClass}
|
44 | * @category Core
|
45 | */
|
46 | export function getTransport(): TransportClass {
|
47 | return getContext().transport;
|
48 | }
|
49 |
|
50 | /**
|
51 | * The Destination (output) belonging to the global Tone.js Context.
|
52 | * @see {@link DestinationClass}
|
53 | * @category Core
|
54 | * @deprecated Use {@link getDestination} instead
|
55 | */
|
56 | export const Destination = getContext().destination;
|
57 |
|
58 | /**
|
59 | * @deprecated Use {@link getDestination} instead
|
60 | */
|
61 | export const Master = getContext().destination;
|
62 |
|
63 | /**
|
64 | * The Destination (output) belonging to the global Tone.js Context.
|
65 | * @see {@link DestinationClass}
|
66 | * @category Core
|
67 | */
|
68 | export function getDestination(): DestinationClass {
|
69 | return getContext().destination;
|
70 | }
|
71 |
|
72 | /**
|
73 | * The {@link ListenerClass} belonging to the global Tone.js Context.
|
74 | * @category Core
|
75 | * @deprecated Use {@link getListener} instead
|
76 | */
|
77 | export const Listener = getContext().listener;
|
78 |
|
79 | /**
|
80 | * The {@link ListenerClass} belonging to the global Tone.js Context.
|
81 | * @category Core
|
82 | */
|
83 | export function getListener(): ListenerClass {
|
84 | return getContext().listener;
|
85 | }
|
86 |
|
87 | /**
|
88 | * Draw is used to synchronize the draw frame with the Transport's callbacks.
|
89 | * @see {@link DrawClass}
|
90 | * @category Core
|
91 | * @deprecated Use {@link getDraw} instead
|
92 | */
|
93 | export const Draw = getContext().draw;
|
94 |
|
95 | /**
|
96 | * Get the singleton attached to the global context.
|
97 | * Draw is used to synchronize the draw frame with the Transport's callbacks.
|
98 | * @see {@link DrawClass}
|
99 | * @category Core
|
100 | */
|
101 | export function getDraw(): DrawClass {
|
102 | return getContext().draw;
|
103 | }
|
104 |
|
105 | /**
|
106 | * A reference to the global context
|
107 | * @see {@link Context}
|
108 | * @deprecated Use {@link getContext} instead
|
109 | */
|
110 | export const context = getContext();
|
111 |
|
112 | /**
|
113 | * Promise which resolves when all of the loading promises are resolved.
|
114 | * Alias for static {@link ToneAudioBuffer.loaded} method.
|
115 | * @category Core
|
116 | */
|
117 | export function loaded() {
|
118 | return ToneAudioBuffer.loaded();
|
119 | }
|
120 |
|
121 | // this fills in name changes from 13.x to 14.x
|
122 | import { ToneAudioBuffers } from "./core/context/ToneAudioBuffers.js";
|
123 | import { ToneBufferSource } from "./source/buffer/ToneBufferSource.js";
|
124 | /** @deprecated Use {@link ToneAudioBuffer} */
|
125 | export const Buffer: typeof ToneAudioBuffer = ToneAudioBuffer;
|
126 | /** @deprecated Use {@link ToneAudioBuffers} */
|
127 | export const Buffers: typeof ToneAudioBuffers = ToneAudioBuffers;
|
128 | /** @deprecated Use {@link ToneBufferSource} */
|
129 | export const BufferSource: typeof ToneBufferSource = ToneBufferSource;
|