How to trigger SoundComponent Events?

Hello I am trying to make a audioManager to wrap/simplify all the project audio related needs in a class that uses just a few basic functions…

I want to add to it the boolean getter isPlaying, to know in real time whether any of the audio channels is playing a sample from its audioslots.

My question is how to attach events like play, end or resume on the sound component of the current entity… Mouse/keyboard events feature event trigger constants like pc.EVENT_KEYUP however the same cannot be said for sounds (or for any other events for the pc classes)…

An example of one of them could probably guide me and serve as a template to this and other non mouse/ keyboard events…


The api does appear to have events on the sound component

end Fired when a sound instance stops playing because it reached its ending.
pause Fired when a sound instance is paused.
play Fired when a sound instance starts playing
resume Fired when a sound instance is resumed.
stop Fired when a sound instance is stopped.

1 Like