Search Unity

FMOD::Sound instance Error on Android and Editor

Discussion in 'Audio & Video' started by c_andrews, Nov 11, 2016.

  1. c_andrews

    c_andrews

    Joined:
    Jan 26, 2015
    Posts:
    42
    Hi,

    I am having some issues in Unity 5.4.2f2 trying to stream an audio clip from the StreamingAssets folder.
    In the Editor and on the device I receive the following error:

    Error: Cannot create FMOD::Sound instance for resource x∏—, (Operation could not be performed because specified sound/DSP connection is not ready. )
    UnityEngine.WWW:GetAudioClipInternal(Boolean, Boolean, Boolean, AudioType)
    UnityEngine.WWW:GetAudioClip(Boolean, Boolean, AudioType) (at /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UtilsBindings.gen.cs:356)
    UnityEngine.WWW:GetAudioClip(Boolean, Boolean) (at /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UtilsBindings.gen.cs:348)
    UnityEngine.WWW:GetAudioClip(Boolean) (at /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UtilsBindings.gen.cs:341)
    <StartStreaming>c__Iterator0:MoveNext() (at Assets/AudioTest/AudioTest.cs:37)
    UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr) (at /Users/builduser/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)

    Here is the code I am using for my test. This is in a new empty project just to make sure it wasnt my project:

    Code (CSharp):
    1.  
    2.     void Start () {
    3.  
    4.         m_audioSource = this.gameObject.GetComponent<AudioSource>();
    5.  
    6.         m_clipPath = Application.streamingAssetsPath + "/myaudioclip.mp3";
    7.  
    8.         StartCoroutine( StartStreaming());
    9.  
    10.     }
    11.  
    12.     private IEnumerator StartStreaming()
    13.     {
    14.        WWW loader = new WWW( m_clipPath );
    15.  
    16.         m_audioClip = loader.GetAudioClip( false, true );
    17.  
    18.         m_audioSource.clip = m_audioClip;
    19.  
    20.         while( loader.progress < 0.2f )
    21.         {
    22.             yield return new WaitForSeconds( 0.2f );
    23.         }
    24.  
    25.         m_audioSource.Play();
    26.     }

    I have also attached the project.
    Any help would be really appreciated.
     

    Attached Files:

  2. c_andrews

    c_andrews

    Joined:
    Jan 26, 2015
    Posts:
    42
    Ok, I now seem to have fixed the issue of streaming my audio from StreamingAssets.

    First of all I switched my function to the below. This solved the issue in the new project and removed the FMOD error but didn't in my old one:

    Code (CSharp):
    1. private IEnumerator StartStreaming()
    2.     {
    3.        WWW loader = new WWW( m_clipPath );
    4.  
    5.         while( loader.progress < 0.2f )
    6.         {
    7.             yield return new WaitForSeconds( 0.2f );
    8.         }
    9.  
    10.         m_audioClip = loader.GetAudioClip( false, true );
    11.         m_audioSource.clip = m_audioClip;
    12.         m_audioSource.Play();
    13.     }
    To get the audio to work in my main project i had to do the above and then I had to remove all of my Audio Source components from the Game Object which were not working and re add them. Im guessing something went wrong when upgrading my project from Unity 5.2.

    Thirdly make sure that the audio path has "file://" at the beginning for playing in the editor and "jar:file://" for use on Android.
     
unityunity