# Efficient way of pausing playback

**URL:** <https://qa.fmod.com/t/efficient-way-of-pausing-playback/11513>\
**Category:** Unity\
**Created:** [June 20, 2014, 9:42pm UTC](https://qa.fmod.com/t/efficient-way-of-pausing-playback/11513 "2014-06-20T21:42:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheSniperFan](https://avatars.discourse-cdn.com/v4/letter/t/b38774/32.png) [@TheSniperFan](https://qa.fmod.com/u/TheSniperFan)\
**Post date:** [June 20, 2014, 9:42pm UTC](https://qa.fmod.com/t/efficient-way-of-pausing-playback/11513/1 "2014-06-20T21:42:35Z")

</div>

Hello.  
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.

```auto
//...
FMOD_StudioEventEmitter emitter = GetComponent<FMOD_StudioEventEmitter>();
FMOD_StudioSystem audioSystem = FMOD_StudioSystem.instance;
FMOD.GUID guid;
FMOD.Studio.EventInstance[] instance;
FMOD.Studio.EventDescription eventDescription;

audioSystem.System.lookupID(emitter.asset.path, out guid);
audioSystem.System.getEvent(guid, FMOD.Studio.LOADING_MODE.BEGIN_NOW, out eventDescription);
eventDescription.getInstanceList(out instance);
instance[0].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.

---

<div class="post-metadata">

**Author:** ![paul.masristone](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/paul.masristone/32/2165_2.png) [@paul.masristone](https://qa.fmod.com/u/paul.masristone)\
**Post date:** [June 25, 2021, 12:01pm UTC](https://qa.fmod.com/t/efficient-way-of-pausing-playback/11513/2 "2021-06-25T12:01:42Z")

</div>

I know the OP was 7 years ago and FMOD has undoubtedly changed in that time, but it was a relevant question for me just now.

My solution is:

```auto
var emitter = GetComponent<FMODUnity.StudioEventEmitter>();
var instance = emitter.EventInstance;
instance.setPaused(true);

```

In my case, I add the following component to a GameObject and drag references to all the SFX & Music emitters that need pausing.

```auto
public class FMODPause : MonoBehaviour
{
	public FMODUnity.StudioEventEmitter[] studioEventEmitters;

	public void Pause(bool state)
	{
		foreach (var emitter in studioEventEmitters)
		{
			var instance = emitter.EventInstance;
			instance.setPaused(state);
		}
	}
}

```
