@pixi/sound
Version:
WebAudio API playback library with filters
34 lines (32 loc) • 826 B
JavaScript
class SoundSprite {
/**
* @param parent - The parent sound
* @param options - Data associated with object.
*/
constructor(parent, options) {
this.parent = parent;
Object.assign(this, options);
this.duration = this.end - this.start;
console.assert(this.duration > 0, "End time must be after start time");
}
/**
* Play the sound sprite.
* @param {Function} [complete] - Function call when complete
* @return Sound instance being played.
*/
play(complete) {
return this.parent.play({
complete,
speed: this.speed || this.parent.speed,
end: this.end,
start: this.start,
loop: this.loop
});
}
/** Destroy and don't use after this */
destroy() {
this.parent = null;
}
}
export { SoundSprite };
//# sourceMappingURL=SoundSprite.mjs.map