Answered
0
0

Hi, we’re using version 4.44.59 of Fmod through the C# wrapper and running on Android. When calling CreateStream or CreateSound (the overloads that take a string as the second parameter) we’ve noticed by using the logging versions of the library that only the first character of the name_or_data parameter is being passed down to Fmod. We’ve fixed it by changing the string marshalling from Unicode to Ansi, so what was

[DllImport(VERSION.dll, CharSet = CharSet.Unicode)]
private static extern RESULT FMOD_System_CreateStream(IntPtr system, string name_or_data, MODE mode, int exinfo, ref IntPtr sound);

is now

[DllImport(VERSION.dll, CharSet = CharSet.Ansi)]
private static extern RESULT FMOD_System_CreateStream(IntPtr system, string name_or_data, MODE mode, int exinfo, ref IntPtr sound);

This isn’t a question, but I couldn’t find the answer anywhere, so I thought I’d post it up, and hopefully the wrapper can be modified so no one else runs into this, because it’s taken ages to figure out!

  • You must to post comments
Best Answer
0
0

That’s correct, with FMOD 4 the only supported platform for C# is Windows. The C# wrapper passes in the Windows only FMOD_UNICODE flag that can handle wide characters. On Android this flag isn’t supported so you only see the first char.

Switching the marshaling to ANSI is a good workaround for this issue. With FMOD 5 we have proper support for this by only passing strings to FMOD as UTF-8 and internally resolve them as necessary.

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.