Exemplo n.º 1
0
    public List <FmodEvent> loadEventsFromFile(string assetPath, string assetName, FmodEventAsset asset)
    {
        FMOD.EventGroup       eventgroup  = null;
        FMOD.RESULT           result      = FMOD.RESULT.OK;
        List <FmodEvent>      events      = new List <FmodEvent>();
        List <FmodEventGroup> eventGroups = new List <FmodEventGroup>();
        int            numGroups          = 0;
        FmodEventGroup toAdd = null;

        FMOD.EVENT_LOADINFO loadInfo = new FMOD.EVENT_LOADINFO();
        FMOD.EventProject   project  = null;

        _loadFile(assetPath, assetName, ref loadInfo, ref project);
        _getSoundBankNames(asset);

        FMOD.EVENT_PROJECTINFO projectInfo = new FMOD.EVENT_PROJECTINFO();
        project.getInfo(ref projectInfo);
        asset.setProjectName(new string(projectInfo.name));

        result = project.getNumGroups(ref numGroups);
        ERRCHECK(result);
        for (int i = 0; i < numGroups; i++)
        {
            result = project.getGroupByIndex(i, false, ref eventgroup);
            ERRCHECK(result);
            toAdd = FmodEventGroup.CreateInstance("FmodEventGroup") as FmodEventGroup;
            toAdd.Initialize(eventgroup, null, asset);
            eventGroups.Add(toAdd);
            events.AddRange(toAdd.getAllEvents());
        }
        asset.setEventGroups(eventGroups);
        loadReverbsFromFile(asset);
        return(events);
    }
Exemplo n.º 2
0
    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();
    }