resonance-audio / resonance-audio-unity-sdk

Resonance Audio SDK for Unity
https://resonance-audio.github.io/resonance-audio/develop/unity/getting-started
Other
297 stars 38 forks source link

Idle / stopped sounds cause audio listener rotation to stop working #55

Open bcjordan opened 5 years ago

bcjordan commented 5 years ago

If I have an AudioSource which I call Play() on:

image

image

After it finishes playing, the Resonance scene stops updating the positions of the other items in the scene.

If I enable looping, the problem doesn't happen.

Any ideas?

bcjordan commented 5 years ago

Another person encountered this here: https://stackoverflow.com/questions/50761118/resonance-audio-spatialization-trouble-with-too-many-audiosources

bcjordan commented 5 years ago

Workaround that somehow works:

using UnityEngine;

public class ToggleAfterDonePlaying : MonoBehaviour
{
    private AudioSource _audioSource;
    private bool _needsToReset;

    private void Start()
    {
        _audioSource = GetComponent<AudioSource>();
    }

    void Update()
    {
        if (_audioSource.isPlaying)
        {
            _needsToReset = true;
        }
        else
        {
            if (_needsToReset)
            {
                gameObject.SetActive(false);
                gameObject.SetActive(true);
                _needsToReset = false;
            }
        }
    }
}
bcjordan commented 5 years ago

Another user confirmed this fix approach is both required and works.

Wonder what the underlying issue is?

bonickhausen commented 5 years ago

So, any ETA for a fix?

I'm considering not using Resonance because of this issue.

CrazyOldMaurice commented 5 years ago

So, good news is that we've implemented a fix in 2019.1+. On previous versions the work around will be needed. On a plus side the workaround is fairly simple. On your audio sources be sure to call source.SetSpatialize(false) after the sound is done playing and be sure to call source.SetSpatialize(true) before you play another sound through that audio source. The issue is that the Resonance may get it's audio listener coordinates from a stale audio source. So something like MySpatializedAudioSource.SetSpatialize(false) when it's finished playing a sound.

purplejamltd commented 5 years ago

This hasn't been fixed for me. Still getting spatialisation stopping.

taridyn commented 5 years ago

I think I ran into this problem as well. I figured it would help the Developers to get a clean example of the problem, so I made a simple unity scene which shows the problem with as little complication as possible:

https://drive.google.com/open?id=1NstEdtPWj6D7iNm8J8oDXQF1m3Dv9Gzy

I also made some videos showing the problem:

https://www.youtube.com/watch?v=ta1S7yTfsVA&feature=youtu.be https://www.youtube.com/watch?v=e7jJpK_HN0U&feature=youtu.be

Follow up: Found answer on other thread. Upgraded to 2019.1.12, it seems to have fixed the problem. I guess I will just leave this here for reference if the Devs need an example of it or something.

PhilippFors commented 4 years ago

Hello, this issue is still present for me on Unity version 2019.2.12f1 and can only be fixed by resetting every audio source in the scene.