Dont continue until Sound has stopped


I have a problem with the VO of a game I have been doing. I want to program it so the event its called and played once. After this, the code continues to happen. A example would be -“Oh, the elevator is coming”- And then load a new level. I could workaround with a routine that changes the map after X seconds (VO line duration) but it seems too complex.

What I mean is, I’m trying to do a function, loop or coroutine that waits until the sound has finished (FMOD_PLAYBACKSTATE_STOPPED) to continue, for example, to change the map without cutting VO lines.
I have tried with a while(!sound.FMOD_PLAYBACKSTATE_STOPPED) and it went infinite. I don’t know how to proceed on this one.