/// <summary> /// Loads a new FMOD sound system. /// </summary> /// <param name="eventName"> /// The name of the event to call. /// </param> /// <param name="paramName"> /// The name of the param that will be applied on our sound . /// </param> public void load(string eventName, string paramName, ref FMOD.Event evt, ref FMOD.EventParameter evtParam) { // Acces to the Gem EVENT eventgroup.getEvent(eventName, FMOD.EVENT_MODE.DEFAULT, ref evt); // Acces to the master CATEGORY eventsystem.getCategory("master", ref mastercategory); // We CALL our param to handle evt.getParameter(paramName, ref evtParam); }
private static bool PlayEvent(string eventName, Func <Vector3> getPosFunc = null) { if (!(GameDataManager.GameType == GameDataManager.GameTypes.DS1 || GameDataManager.GameType == GameDataManager.GameTypes.DS1R || GameDataManager.GameType == GameDataManager.GameTypes.DS3 || GameDataManager.GameType == GameDataManager.GameTypes.SDT)) { return(false); } bool result = false; Main.WinForm.Invoke(new Action(() => { FMOD.EventProject evProject = null; bool foundEvent = false; FMOD.Event newEvent = null; foreach (var fevName in LoadedFEVs) { var fres = _eventSystem.getProject(fevName, ref evProject); if (fres == RESULT.OK) { int groupCount = 0; fres = evProject.getNumGroups(ref groupCount); if (fres == RESULT.OK) { for (int i = 0; i < groupCount; i++) { FMOD.EventGroup innerGroup = null; fres = evProject.getGroupByIndex(i, cacheevents: false, ref innerGroup); if (fres == RESULT.OK) { fres = innerGroup.getEvent(eventName, EVENT_MODE.DEFAULT, ref newEvent); if (fres == RESULT.OK) { foundEvent = true; break; } } } } } } if (!foundEvent) { result = false; return; } ERRCHECK(newEvent.setVolume(BaseSoundVolume * AdjustSoundVolume)); if (getPosFunc != null) { lock (_lock_eventsToUpdate) { _eventsToUpdate.Add(new FmodEventUpdater(newEvent, getPosFunc, eventName)); } } ERRCHECK(newEvent.start()); result = true; })); return(result); }