Trying to play midi file using custom sound bank, I’m supposed to pass path to .dls file via FMOD.CREATESOUNDEXINFO.dlsname but it’s a IntPtr not a string.
tried this but it doesn’t work
IntPtr pathInt = Marshal.StringToHGlobalUni(Utils.dataPath + "gm.dls");
info.dlsname = pathInt;
info.cbsize = Marshal.SizeOf(info);
FMOD.Sound sound;
lowSys.createStream(Utils.dataPath + "errors.mid", FMOD.MODE.DEFAULT, ref info, out sound);
FMOD.Channel channel;
lowSys.playSound(sound, null, false, out channel);
Marshal.FreeHGlobal(pathInt);
in fmod log I can see this eror, looks like it got only first letter of filename?
Trying to play midi file using custom sound bank, I’m supposed to pass path to .dls file via FMOD.CREATESOUNDEXINFO.dlsname but it’s a IntPtr not a string.
tried this but it doesn’t work
IntPtr pathInt = Marshal.StringToHGlobalUni(Utils.dataPath + "gm.dls");
info.dlsname = pathInt;
info.cbsize = Marshal.SizeOf(info);
FMOD.Sound sound;
lowSys.createStream(Utils.dataPath + "errors.mid", FMOD.MODE.DEFAULT, ref info, out sound);
FMOD.Channel channel;
lowSys.playSound(sound, null, false, out channel);
Marshal.FreeHGlobal(pathInt);
in fmod log I can see this eror, looks like it got only first letter of filename?
Imgur: The magic of the Internet
StringToHGlobalAnsi works better, no error in log anymore but still silence on android
Marshal.StringToHGlobalAnsi is a fix, didn’t play anything because for some reason my StreamingAssets folder didn’t get copied over to device