You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would make working with multiple audio sprites a lil slicker. As a workaround we've got something like this:
import{soundaspixiSound}from'@pixi/sound';import{Music,SoundFx}from'./my-assetpack-generated-constants';exportclassSoundManager{/** reverse map of children -> parents */publicchildSpriteAliases=Map<Sounds,string>();publicasyncplay(alias: Music|SoundFx,options: PlayOptions={}): Promise<IMediaInstance|undefined>{constparentSound=this.childSpriteAliases.get(alias);// play spriteif(parentSound){returnpixiSound.play(parentSound,{ ...options,sprite: alias});}// play other ...returnpixiSound.play(alias,options);}// ...}
(And then in our audiosprite loader we've added some custom logic to inject those aliases on load.)
The text was updated successfully, but these errors were encountered:
It would be neat if one could somehow alias audio sprites globally, similar to the texture cache for Spritesheets.
It would make working with multiple audio sprites a lil slicker. As a workaround we've got something like this:
(And then in our audiosprite loader we've added some custom logic to inject those aliases on load.)
The text was updated successfully, but these errors were encountered: