While I know my way around Unity, I’m completely new to fmod. I have played around with the Unity integration today and got stuck trying to pause/resume emitters. I need to pause certain emitters when the player toggles the pause menu to prevent their sounds from getting out of sync.
I was quite surprised to find out that emitters only have StartEvent() and Stop() methods, but no Play()/Pause() ones.
Anyway, eventually I got a working solution, but looking at it I feel like there must be an easier, more efficient way of doing this.
FMOD_StudioEventEmitter emitter = GetComponent<FMOD_StudioEventEmitter>();
FMOD_StudioSystem audioSystem = FMOD_StudioSystem.instance;
audioSystem.System.lookupID(emitter.asset.path, out guid);
audioSystem.System.getEvent(guid, FMOD.Studio.LOADING_MODE.BEGIN_NOW, out eventDescription);
instance.setPaused(true); // Accessing at index 0 is just a placeholder for testing
It basically takes me 8 lines of code to access the instance. Is there a shorter way?
My plan is to have a static class that holds a list of all the instances that need to be paused. Whenever the player hits the pause key I could just iterate through it to pause all of them easily.
Sorry if this is a dumb question with an obvious answer, but neither Google nor the API documentation where of much help.
I hope anyone here can help me. Thanks.
- TheSniperFan asked 4 years ago
- You must login to post comments