mirror of
https://github.com/Tonejs/Tone.js
synced 2024-12-27 03:53:07 +00:00
parent
7ec588f937
commit
26392c29a7
1 changed files with 6 additions and 0 deletions
|
@ -202,6 +202,12 @@ export class Players extends ToneAudioNode<PlayersOptions> {
|
|||
* @param name A unique name to give the player
|
||||
* @param url Either the url of the bufer or a buffer which will be added with the given name.
|
||||
* @param callback The callback to invoke when the url is loaded.
|
||||
* @example
|
||||
* const players = new Tone.Players();
|
||||
* players.add("gong", "https://tonejs.github.io/audio/berklee/gong_1.mp3", () => {
|
||||
* console.log("gong loaded");
|
||||
* players.get("gong").start();
|
||||
* });
|
||||
*/
|
||||
add(name: string, url: string | ToneAudioBuffer | AudioBuffer, callback?: () => void): this {
|
||||
assert(!this._buffers.has(name), "A buffer with that name already exists on this object");
|
||||
|
|
Loading…
Reference in a new issue