private static extern RESULT FMOD_EventSystem_GetInfo(IntPtr eventsystem, ref EVENT_SYSTEMINFO info);
protected void _getSoundBankNames(FmodEventAsset asset) { FMOD.EVENT_SYSTEMINFO sysinfo = new FMOD.EVENT_SYSTEMINFO(); FMOD.EVENT_WAVEBANKINFO[] bankinfos = new FMOD.EVENT_WAVEBANKINFO[MAX_SOUND_BANKS_PER_FILE]; IntPtr bankInfosPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(FMOD.EVENT_WAVEBANKINFO)) * bankinfos.Length); IntPtr c = new IntPtr(bankInfosPtr.ToInt32()); FMOD.RESULT result = FMOD.RESULT.OK; List<string> soundBankList = new List<string>(); for (int i = 0; i < bankinfos.Length; i++) { Marshal.StructureToPtr(bankinfos[i], c, true); c = new IntPtr(c.ToInt32() + Marshal.SizeOf(typeof(FMOD.EVENT_WAVEBANKINFO))); } sysinfo.maxwavebanks = MAX_SOUND_BANKS_PER_FILE; sysinfo.wavebankinfo = bankInfosPtr; result = getEventSystem().getInfo(ref sysinfo); ERRCHECK (result); if (result == FMOD.RESULT.OK) { for (int i = 0; i < sysinfo.maxwavebanks; i++) { bankinfos[i] = (FMOD.EVENT_WAVEBANKINFO)Marshal.PtrToStructure(new IntPtr(bankInfosPtr.ToInt32() + i * Marshal.SizeOf(typeof(FMOD.EVENT_WAVEBANKINFO))), typeof(FMOD.EVENT_WAVEBANKINFO)); string newString = new string(bankinfos[i].name); int index = newString.IndexOf('\0'); string adjustedString = new string(bankinfos[i].name, 0, index); soundBankList.Add(adjustedString); } asset.setSoundBankList(soundBankList); } }
public RESULT getInfo(ref EVENT_SYSTEMINFO info) { return FMOD_EventSystem_GetInfo(eventsystemraw, ref info); }