EventInstance.getPlaybackState doesn't retrieve PLAYBACK_STATE.STOPPING

AHDSR and fadeout is working.
But playback_state changed to STOPED immediately.

I want to make a coroutine to wait while previours music is stopping, then play next music to change music.

When will the playback_state changed to STOPPING? And How can I detect the event is fadeout stopping?

unity version: 2021.3.8f1c1
fmod api version: 2.02.09
fmod studio version: 2.02.09

Hi,

How many seconds have you got the Release option set to on your AHDSR modulator? This value is how long you can expect to receive STOPPING for e.g. 1 second up to 60. Could I also get a code snippet of how you are checking the PLAYBACK_STATE?

It“s 3.4 seconds:
2022113-151600

this is my code in a class that Inherited StudioEventEmitter

		PLAYBACK_STATE state;

		void Update() {
			PLAYBACK_STATE newState;
			EventInstance.getPlaybackState(out newState);
			if (state != newState) {
				state = newState;
				Debug.Log(newState);
			}
		}

		public void Stop(bool allowFadeout = true) {
			AllowFadeout = allowFadeout;
			base.Stop();
		}

When I execute the Stop() function, console print:

STOPPED

:cry:

Hi,

This does seem to be a bug, I have passed it on to our dev team to look into further. In the meantime a solution is in StudioEventEmitter.cs on lines 304 - 306, change instance to EventInstance.

Hope this helps!

Thank you!

1 Like