0

everyone. I'm trying to get an external sound to play in Unity, however I get an error when I try to play it: "Wwise: Cannot open file: Gong_2.wem"

My Project Settings has the input path set up for all of my files to ExternalSources.wsources, which is as follows:


<?xml version="1.0" encoding="UTF-8"?>
<ExternalSourcesList SchemaVersion="1" Root="..\Assets\WwiseExternalSources">
    <Source Path="SeedDrop.wav" Conversion="Default Conversion Settings" />
    <Source Path="Gong_2.wav" Conversion="Default Conversion Settings" />
    <Source Path="shyApplauseTemp.wav" Conversion="Default Conversion Settings" />
</ExternalSourcesList>

The output path is set to the D:\game\WwiseProject\GeneratedSoundBanks\Windows folder of my Unity project, and I see that all wem file is present in that folder after generating soundbanks.

The following is the code I'm using to play the sound:

            AkExternalSourceInfo source = new AkExternalSourceInfo();
            source.iExternalSrcCookie = AkSoundEngine.GetIDFromString("External_Source");
            source.szFile = "Gong_2.wem";
            source.idCodec = AkSoundEngine.AKCODECID_PCM;
            AkSoundEngine.PostEvent("Play_Voice", gameObject, 0, null, null, 1, source);

The sound bank is loaded in and the Play_Voice event is happening, but it is throwing an error on finding the Gong_2.wem file.

Is there something wrong with my setup? Where is it looking for the Gong_2.wem file?

Sound should play and no error in console

1 Answers1

1

2021Wwise And 2021.3.4f1c1Unity You can visit: unity (\Assets\StreamingAssets\Audio\GeneratedSoundBanks\Windows) wwise project path(\GeneratedSoundBanks\Windows)

My version of the code may be different from yours, but I have verified that it can play external sounds:

AkExternalSourceInfo sourceInfo = new AkExternalSourceInfo();
sourceInfo.iExternalSrcCookie = AkSoundEngine.GetIDFromString("External_Source");
sourceInfo.szFile = "music.wem";
sourceInfo.idCodec = AkSoundEngine.AKCODECID_PCM;
AkExternalSourceInfoArray externalSources = new AkExternalSourceInfoArray(1);
externalSources[0] = sourceInfo;
AkSoundEngine.PostEvent(eventName, gameObject, 0, null, null, 1, externalSources);
xuan
  • 26
  • 1
  • In the end of the day, I understood thanks path are metter. so I had `\Assets\StreamingAssets\Audio\GeneratedSoundBanks\Windows\ExternalSources`. After removing last part `\ExternalSources` from path, it's worked. Thanks! See you soon space cowboy) – Arcueid D'athemon Apr 21 '23 at 01:01