Error: Event not found when using Studio::System::lookupPath


Recently I started learning how to use the FMOD API for my HTML5 project, but I am running into some problems.

I am trying to use the Studio::System::lookupPath function, but I keep getting the “Event not found” error when using it.

Here’s what my code looks like:

toPathFromGuid : function(guid) {
let pathBuffer = new Uint8Array(256);
let retrievedSize = pathBuffer.length;
let result = FMOD.ERR_TRUNCATED;

    do {
        result = gSystem.lookupPath(guid, pathBuffer, retrievedSize, retrievedSize);
    while (result === FMOD.ERR_TRUNCATED);

    return new TextDecoder().decode(pathBuffer.subarray(0, retrievedSize - 1));

My first guess was that the banks simply weren’t loaded correctly, so I tried it out by playing a sound trough looking up an EventDescription using the Studio::System::getEvent function.

This does seem to work, which should mean that the bank is loaded correctly.

Later, I also tried the Studio::System::getBankList function, but this returned an empty array.

To load the banks I followed the FMOD load_banks example code, using the Studio::System::loadBankFile function.

Thanks in advance for the help.


Are you certain that you’re loading your master banks? System.lookupPath in particular requires the master strings bank to be loaded. The load_banks HTML5 Studio API example doesn’t ever actually load the master banks, so if you’ve copied the code from that example then you may not have loaded them.

If you have loaded all of your banks appropriately, could I get you to provide your FMOD version number and which backend compiler you’re using?

Thanks for the reply!

After looking more into it, I realized I was checking for loaded banks wrong. All banks, including the Master.strings bank were loaded correctly.

After more testing I have figured out exactly what went wrong in my code, the lookupPath function was working as intended, but I was handling my pathBuffer variable wrongly.

I tried to decode it, like this:
return new TextDecoder().decode(pathBuffer.subarray(0, retrievedSize - 1));

While all I needed to do was do this:
return pathBuffer.val;

It’s working now! :sweat_smile:

1 Like