1 | import { Tone } from "../Tone.js";
|
2 | import { ToneAudioBuffer } from "./ToneAudioBuffer.js";
|
3 | export interface ToneAudioBuffersUrlMap {
|
4 | [name: string]: string | AudioBuffer | ToneAudioBuffer;
|
5 | [name: number]: string | AudioBuffer | ToneAudioBuffer;
|
6 | }
|
7 | interface ToneAudioBuffersOptions {
|
8 | urls: ToneAudioBuffersUrlMap;
|
9 | onload: () => void;
|
10 | onerror?: (error: Error) => void;
|
11 | baseUrl: string;
|
12 | }
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 | export declare class ToneAudioBuffers extends Tone {
|
39 | readonly name: string;
|
40 | |
41 |
|
42 |
|
43 | private _buffers;
|
44 | |
45 |
|
46 |
|
47 | baseUrl: string;
|
48 | |
49 |
|
50 |
|
51 | private _loadingCount;
|
52 | |
53 |
|
54 |
|
55 |
|
56 |
|
57 | constructor(urls?: ToneAudioBuffersUrlMap, onload?: () => void, baseUrl?: string);
|
58 | constructor(options?: Partial<ToneAudioBuffersOptions>);
|
59 | static getDefaults(): ToneAudioBuffersOptions;
|
60 | /**
|
61 | * True if the buffers object has a buffer by that name.
|
62 | * @param name The key or index of the buffer.
|
63 | */
|
64 | has(name: string | number): boolean;
|
65 | /**
|
66 | * Get a buffer by name. If an array was loaded,
|
67 | * then use the array index.
|
68 | * @param name The key or index of the buffer.
|
69 | */
|
70 | get(name: string | number): ToneAudioBuffer;
|
71 | /**
|
72 | * A buffer was loaded. decrement the counter.
|
73 | */
|
74 | private _bufferLoaded;
|
75 | /**
|
76 | * If the buffers are loaded or not
|
77 | */
|
78 | get loaded(): boolean;
|
79 | /**
|
80 | * Add a buffer by name and url to the Buffers
|
81 | * @param name A unique name to give the buffer
|
82 | * @param url Either the url of the bufer, or a buffer which will be added with the given name.
|
83 | * @param callback The callback to invoke when the url is loaded.
|
84 | * @param onerror Invoked if the buffer can't be loaded
|
85 | */
|
86 | add(name: string | number, url: string | AudioBuffer | ToneAudioBuffer, callback?: () => void, onerror?: (e: Error) => void): this;
|
87 | dispose(): this;
|
88 | }
|
89 | export {};
|