Hi FMOD community,
For the unity webgl build I am getting above error.
I am using player instrument to play dialogues, this works fine in editor, but it’s throwing following errors in webgl build
[FMOD] FMOD_OS_File_Open : fopen failed to open ‘RIFFئf’, errno = 44
[FMOD] System::createSound(RIFFئf, 128, 0xa5deb8, 0xa5dea8) returned ERR_FILE_NOTFOUND for SYSTEM (0x4D43920).
[FMOD] EventInstance::createProgrammerSoundImpl : Programmer sound callback for instrument ‘0’ returned no sound.
PFA code for the same.
Any help is appreciated.
internal void PlayVoiceAudioClip(string key, Action _callback)
{
if(_voiceEventReference.IsNull){ return;}
StopVoiceAudio();
_voiceEventInstance = FMODUnity.RuntimeManager.CreateInstance(_voiceEventReference);
GCHandle stringHandle = GCHandle.Alloc(key, GCHandleType.Pinned);
_voiceEventInstance.setUserData(GCHandle.ToIntPtr(stringHandle));
_voiceEventInstance.setCallback(_voiceCallback);
_voiceEventInstance.start();
_voiceEventInstance.release();
}
[AOT.MonoPInvokeCallback(typeof(FMOD.Studio.EVENT_CALLBACK))]
static FMOD.RESULT VoiceCallback(FMOD.Studio.EVENT_CALLBACK_TYPE type, IntPtr instancePtr, IntPtr parameterPtr)
{
FMOD.Studio.EventInstance instance = new FMOD.Studio.EventInstance(instancePtr);
// Retrieve the user data
IntPtr stringPtr;
instance.getUserData(out stringPtr);
// Get the string object
GCHandle stringHandle = GCHandle.FromIntPtr(stringPtr);
String key = stringHandle.Target as String;
switch (type)
{
case FMOD.Studio.EVENT_CALLBACK_TYPE.CREATE_PROGRAMMER_SOUND:
{
FMOD.MODE soundMode = FMOD.MODE.LOOP_NORMAL | FMOD.MODE.CREATECOMPRESSEDSAMPLE | FMOD.MODE.NONBLOCKING;
var parameter = (FMOD.Studio.PROGRAMMER_SOUND_PROPERTIES)Marshal.PtrToStructure(parameterPtr, typeof(FMOD.Studio.PROGRAMMER_SOUND_PROPERTIES));
FMOD.Studio.SOUND_INFO dialogueSoundInfo;
FMOD.RESULT keyResult = FMOD.RESULT.ERR_NOTREADY;
keyResult = FMODUnity.RuntimeManager.StudioSystem.getSoundInfo(key, out dialogueSoundInfo);
if (keyResult != FMOD.RESULT.OK)
{
break;
}
FMOD.Sound dialogueSound;
var soundResult = FMODUnity.RuntimeManager.CoreSystem.createSound(dialogueSoundInfo.name_or_data, soundMode | dialogueSoundInfo.mode, ref dialogueSoundInfo.exinfo, out dialogueSound);
if (soundResult == FMOD.RESULT.OK)
{
var sound = new FMOD.Sound(parameter.sound);
parameter.sound = dialogueSound.handle;
parameter.subsoundIndex = dialogueSoundInfo.subsoundindex;
Marshal.StructureToPtr(parameter, parameterPtr, false);
}
break;
}
case FMOD.Studio.EVENT_CALLBACK_TYPE.DESTROY_PROGRAMMER_SOUND:
{
var parameter = (FMOD.Studio.PROGRAMMER_SOUND_PROPERTIES)Marshal.PtrToStructure(parameterPtr, typeof(FMOD.Studio.PROGRAMMER_SOUND_PROPERTIES));
var sound = new FMOD.Sound(parameter.sound);
sound.release();
//CompanionCharacter.Instance.NarrationProgrammerSoundEnded();
break;
}
case FMOD.Studio.EVENT_CALLBACK_TYPE.DESTROYED:
{
// Now the event has been destroyed, unpin the string memory so it can be garbage collected
stringHandle.Free();
break;
}
}
return FMOD.RESULT.OK;
}