Loading from assembly

Im trying to create a Sound from bytes loaded from the dll assembly but I keep on getting an invalid param error, any ideas?

byte[] bytes = EmbeddedAssetBundle.LoadFromAssembly(Assembly.GetExecutingAssembly(), location);
CREATESOUNDEXINFO exInfo = new CREATESOUNDEXINFO()
{
 cbsize = System.Runtime.InteropServices.Marshal.SizeOf(typeof(CREATESOUNDEXINFO))
};
RuntimeManager.CoreSystem.createSound(bytes, MODE._3D | MODE.LOOP_NORMAL | MODE.OPENMEMORY, ref exInfo, out Sound sound);

I can see you aren’t setting the CREATESOUNDEXINFO.length, which is a requirement when using the FMOD_OPENMEMORY flag. If you tick Enable API Error Logging and set your Logging Level to “Log” you should be getting an error like “ERROR - Tried to use FMOD_OPENMEMORY or FMOD_OPENMEMORY_POINT without setting length with FMOD_CREATESOUNDEXINFO.”
Please try specifying the length and let me know if you are still running into issues.

1 Like