public void freeWholeGroup() { if (m_runtimeEventGroup != null) { ERRCHECK(m_runtimeEventGroup.freeEventData(false)); using (FmodEventSystemHandle handle = new FmodEventSystemHandle()) { if (handle.getEventSystem() != null && handle.getEventSystem().wasCleaned() == false) { handle.getEventSystem().releaseAllEventsFromGroup(this); } } m_runtimeEventGroup = null; } }
public RESULT getParentGroup(ref EventGroup group) { RESULT result = RESULT.OK; IntPtr eventgroupraw = new IntPtr(); EventGroup eventgroupnew = null; try { result = FMOD_Event_GetParentGroup(eventraw, ref eventgroupraw); } catch { result = RESULT.ERR_INVALID_PARAM; } if (result != RESULT.OK) { return result; } if (group == null) { eventgroupnew = new EventGroup(); eventgroupnew.setRaw(eventgroupraw); group = eventgroupnew; } else { group.setRaw(eventgroupraw); } return result; }
public RESULT getGroup(string name, bool cacheevents, ref EventGroup group) { RESULT result = RESULT.OK; IntPtr eventgroupraw = new IntPtr(); EventGroup eventgroupnew = null; try { result = FMOD_EventSystem_GetGroup(eventsystemraw, name, (cacheevents ? 1 : 0), ref eventgroupraw); } catch { result = RESULT.ERR_INVALID_PARAM; } if (result != RESULT.OK) { return result; } if (group == null) { eventgroupnew = new EventGroup(); eventgroupnew.setRaw(eventgroupraw); group = eventgroupnew; } else { group.setRaw(eventgroupraw); } return result; }
public RESULT getGroupByIndex(int index, bool cacheevents, ref EventGroup group) { RESULT result = RESULT.OK; IntPtr eventgroupraw = new IntPtr(); EventGroup eventgroupnew = null; try { result = FMOD_EventProject_GetGroupByIndex(eventprojectraw, index, (cacheevents ? 1 : 0), ref eventgroupraw); } catch { result = RESULT.ERR_INVALID_PARAM; } if (result != RESULT.OK) { return result; } if (group == null) { eventgroupnew = new EventGroup(); eventgroupnew.setRaw(eventgroupraw); group = eventgroupnew; } else { group.setRaw(eventgroupraw); } return result; }
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); }
public void setEventGroup(FMOD.EventGroup eventGroup) { if (!isInit()) { m_runtimeEventGroup = eventGroup; } }
private static bool PlayEvent(string eventName, Func <Vector3> getPosFunc, int?stateInfo) { //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; string newEvent_FullFevPath = 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) { bool searchGroup(FMOD.EventGroup grp) { fres = grp.getEvent(eventName, EVENT_MODE.DEFAULT, ref newEvent); if (fres == RESULT.OK) { newEvent_FullFevPath = _loadedFEVs_FullPaths[fevName]; return(true); // Returning from searchGroup() lol } int numInnerGroups = 0; fres = grp.getNumGroups(ref numInnerGroups); if (fres == RESULT.OK) { for (int j = 0; j < numInnerGroups; j++) { FMOD.EventGroup innerInnerGroup = null; fres = grp.getGroupByIndex(j, false, ref innerInnerGroup); if (fres == RESULT.OK) { if (searchGroup(innerInnerGroup)) { newEvent_FullFevPath = _loadedFEVs_FullPaths[fevName]; return(true); } } } } return(false); } for (int i = 0; i < groupCount; i++) { FMOD.EventGroup innerGroup = null; fres = evProject.getGroupByIndex(i, cacheevents: false, ref innerGroup); if (fres == RESULT.OK) { if (searchGroup(innerGroup)) { foundEvent = true; break; } } } } } } if (!foundEvent) { result = false; return; } lock (_lock_MediaRoot) { UpdateMediaRoot(Path.GetDirectoryName(newEvent_FullFevPath)); ERRCHECK(newEvent.setVolume(BaseSoundVolume * (AdjustSoundVolume / 100))); if (getPosFunc != null) { lock (_lock_eventsToUpdate) { _eventsToUpdate.Add(new FmodEventUpdater(newEvent, getPosFunc, eventName, stateInfo)); } } ERRCHECK(newEvent.start()); result = true; } })); return(result); }