示例#1
0
 public FmodService()
 {
     _latestService = this;
 }
示例#2
0
        public static RESULT GNHEventCallback(EVENT_CALLBACK_TYPE type, EventInstance _event, IntPtr parameters)
        {
            RESULT      result;
            FmodService service = _latestService;

            if (service == null)
            {
                return(RESULT.ERR_UNSUPPORTED);
            }

            //lock(service.eventInstanceLock)
            //{
            if (type == EVENT_CALLBACK_TYPE.STOPPED || type == EVENT_CALLBACK_TYPE.START_FAILED)
            {
                for (int i = 0; i < GHConstants.MaxNormalImmediateSoundInstances; i++)
                {
                    if (i >= service.immediateInstances.Count)
                    {
                        break;
                    }

                    if (service.immediateInstances[i].instance.handle == _event.handle)
                    {
                        service.immediateInstances[i].stopped = true;
                        for (int j = i - 1; j >= 0; j--)
                        {
                            if (service.immediateInstances[j].queued)
                            {
                                service.immediateInstances[j].queued = false;
                                result = service.immediateInstances[j].instance.start();
                                result = _system.update();
                                return(RESULT.OK);
                            }
                        }
                    }
                }
                for (int i = 0; i < GHConstants.MaxLongImmediateSoundInstances; i++)
                {
                    if (i >= service.longImmediateInstances.Count)
                    {
                        break;
                    }

                    if (service.longImmediateInstances[i].instance.handle == _event.handle)
                    {
                        service.longImmediateInstances[i].stopped = true;
                        for (int j = i - 1; j >= 0; j--)
                        {
                            if (service.longImmediateInstances[j].queued)
                            {
                                service.longImmediateInstances[j].queued = false;
                                result = service.longImmediateInstances[j].instance.start();
                                result = _system.update();
                                return(RESULT.OK);
                            }
                        }
                    }
                }
            }
            return(RESULT.OK);
            //}
        }