Hi all,
I’m tryng to reproduce the effect of a sound coming from another room. One of my task was to duplicate a sound coming from an adiacent room and append it to the door to simulate the occlusion of the wall. I have impemented my own class soundSource that let me handle some features that i needed for the game, like applyng filters, setting parameters and some other useful stuff.
On the door i have attached this script:
void Start ()
{
StartCoroutine ("test");
}
IEnumerator test ()
{
appendSoundSource (ssDoor);
yield return new WaitForSeconds (1.1f);
removeSoundSource (ssDoor);
}
public void appendSoundSource (FMOD_SoundSource originalSS)
{
ssDoor = gameObject.AddComponent<FMOD_SoundSource> ();
ssDoor.duplicateFrom (originalSS);
ssDoor.applyFilter (1, 20000, 20);
ssDoor.start ();
}
public void removeSoundSource (FMOD_SoundSource ssDoor)
{
PVPair pvp = new PVPair ("EndTrigger", 1);
ssDoor.setParameterValue (pvp);
}
For testing purpose i’ve created a coroutine that append the soundSource and then call remooveSoundSource that let the event go out of the loop region. Here’s a screenshoot of my fmod project:
My problem is that if i remove the yield instruction everything works as i expected to, but if i keep that line it does not. It looks strange because unity doesn’t give me errors, and it seems that the parameter “EndTrigger” is modified correctly, but i can’t figure out why it doesn’t go out of the loop region.
I hope that i have been clear enough and on the other hand also synthetic enough
Does somebody have any tips to solve my problem?
Thanks