Is there a way to pass 2-byte unicode file path to the [i:gfjwi3uh]FMOD::Studio::System::loadBankFile[/i:gfjwi3uh] like there is with [i:gfjwi3uh]FMOD_UNICODE[/i:gfjwi3uh] flag for [i:gfjwi3uh]FMOD::System::createSound[/i:gfjwi3uh]?
I know I can use [i:gfjwi3uh]FMOD::Studio::System::loadBankCustom[/i:gfjwi3uh], but I’d like to avoid redundant implementing of all the callbacks, since they would be pretty standard.

  • You must to post comments
Best Answer

As of version 1.05.00, all FMOD functions dealing with file names and paths now accept UTF-8 encoded strings. All arguments that take or return UTF-16 encoded strings have actually been removed, as have related flags like FMOD_UNICODE.

Now you can just use UTF-8 strings everywhere. If you have a UTF-16 (wide string) file path, just convert it to UTF-8 encoding and pass that to FMOD::Studio::System::loadBankFile().

On Windows, you could do something like…

FMOD::Studio::Bank* LoadBankWide(FMOD::Studio::System* system, const wchar_t* filenameW)
    char filename[MAX_PATH];
    WideCharToMultiByte(CP_UTF8, 0, filenameW, -1, filename, sizeof(filename), NULL, NULL);

    FMOD::Studio::Bank* bank = NULL;
    system->loadBankFile(filename, FMOD_STUDIO_LOAD_BANK_NORMAL, &bank);

    return bank;
  • You must to post comments

Currently the Studio API does not provide a way to specify a UTF-16 path to FMOD::Studio::System::loadBankFile().

We are planning to add full Unicode support to Studio in the near future. Actually we have decided on the UTF-8 standard, rather than UTF-16, as this encoding is more compatible with our existing API (which generally uses char* for string arguments), and is somewhat more portable across all platforms. In any case, it is relatively easy to convert between UTF-16 and UTF-8 encodings.

For now, your best option is to use FMOD::Studio::System::loadBankCustom(), as you have suggested.

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.