import { IMediaInstance } from './interfaces' ; import { CompleteCallback , Sound } from './Sound' ; /** Data for adding new sound sprites. */ interface SoundSpriteData { /** The start time in seconds. */ start : number ; /** The end time in seconds. */ end : number ; /** The optional speed, if not speed, uses the default speed of the parent. */ speed ? : number ; } type SoundSprites = Record < string , SoundSprite > ; /**
 * Object that represents a single Sound's sprite. To add sound sprites
 * use the  Sound method.
 *  example class SoundSprite { readonly public parent : Sound ; readonly public start : number ; readonly public end : number ; readonly public speed : number ; readonly public duration : number ; readonly public loop : boolean ; param parent param options 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' ) ; } param { Function } complete return public 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 */ public destroy ( ) { this . parent = null ; } } export type { SoundSprites , SoundSpriteData } ; export { SoundSprite } ;