public void Initialize(FMOD.EventGroup eventgroup, FmodEventGroup parentGroup, FmodEventAsset asset) { FMOD.EventGroup childEventgroup = null; FMOD.RESULT result = FMOD.RESULT.OK; FmodEventGroup child = null; int numChildrenGroups = 0; int numEvents = 0; FMOD.Event e = null; FmodEvent toAdd = null; hideFlags = HideFlags.HideInHierarchy; m_projectName = asset.getProjectName(); m_parent = parentGroup; _getName(eventgroup); result = eventgroup.loadEventData(); ERRCHECK(result); result = eventgroup.getNumEvents(ref numEvents); ERRCHECK(result); for (int j = 0; j < numEvents; j++) { e = null; result = eventgroup.getEventByIndex(j, FMOD.EVENT_MODE.DEFAULT | FMOD.EVENT_MODE.ERROR_ON_DISKACCESS, ref e); ERRCHECK(result); if (result != FMOD.RESULT.OK) { result = FMOD.RESULT.OK; } toAdd = FmodEvent.CreateInstance("FmodEvent") as FmodEvent; if (e != null) { toAdd.Initialize(e, this, j, asset); e.release(); } else { toAdd.Initialize(this, j, asset); } m_events.Add(toAdd); } result = eventgroup.freeEventData(false); ERRCHECK(result); result = eventgroup.getNumGroups(ref numChildrenGroups); for (int k = 0; k < numChildrenGroups; k++) { result = eventgroup.getGroupByIndex(k, false, ref childEventgroup); ERRCHECK(result); child = FmodEventGroup.CreateInstance("FmodEventGroup") as FmodEventGroup; child.Initialize(childEventgroup, this, asset); m_children.Add(child); } name = getFullName(); }
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; } }
private void timer1_Tick(object sender, System.EventArgs e) { if (!initialised) { ERRCHECK(result = FMOD.Event_Factory.EventSystem_Create(ref eventsystem)); ERRCHECK(result = eventsystem.init(64, FMOD.INITFLAGS.NORMAL, (IntPtr)null, FMOD.EVENT_INITFLAGS.NORMAL)); ERRCHECK(result = eventsystem.setMediaPath("../../../../examples/media/")); ERRCHECK(result = eventsystem.load("examples.fev")); ERRCHECK(result = eventsystem.getGroup("examples/AdvancedTechniques", false, ref eventgroup)); ERRCHECK(result = eventgroup.getEvent("car", FMOD.EVENT_MODE.DEFAULT, ref car)); ERRCHECK(result = eventsystem.getCategory("master", ref mastercategory)); ERRCHECK(result = car.getParameter("load", ref load)); ERRCHECK(result = load.getRange(ref load_min, ref load_max)); ERRCHECK(result = load.setValue(load_max)); ERRCHECK(result = car.getParameterByIndex(0, ref rpm)); ERRCHECK(result = rpm.getRange(ref rpm_min, ref rpm_max)); ERRCHECK(result = rpm.setValue(1000.0f)); trackBarRPM.Minimum = (int)rpm_min; trackBarRPM.Maximum = (int)rpm_max; trackBarLoad.Minimum = (int)load_min; trackBarLoad.Maximum = (int)load_max; trackBarRPM.Value = 1000; trackBarLoad.Value = (int)load_max; ERRCHECK(result = car.start()); initialised = true; } /* * "Main Loop" */ if (trackbarscroll) { ERRCHECK(result = rpm.setValue((float)trackBarRPM.Value)); ERRCHECK(result = load.setValue((float)trackBarLoad.Value)); trackbarscroll = false; } float rpmvalue = 0.0f; ERRCHECK(result = rpm.getValue(ref rpmvalue)); statusBar.Text = "RPM Value = " + rpmvalue; ERRCHECK(result = eventsystem.update()); /* * Clean up and exit */ if (exit) { ERRCHECK(result = eventgroup.freeEventData()); ERRCHECK(result = eventsystem.release()); Application.Exit(); } }