void Awake()
    {
        currentAsset = (FMODAsset)target;
        FMODEditorExtension.StopEvent();
        isPlaying = false;

        // set up parameters
        FMOD.Studio.EventDescription desc = FMODEditorExtension.GetEventDescription(currentAsset.id);
        int count;

        if (desc == null)
        {
            return;
        }

        desc.is3D(out is3D);
        desc.getMinimumDistance(out minDistance);
        desc.getMaximumDistance(out maxDistance);

        desc.getParameterCount(out count);
        parameters = new Param[count];

        for (int i = 0; i < count; ++i)
        {
            desc.getParameterByIndex(i, out parameters[i].desc);
            parameters[i].val = parameters[i].desc.minimum;
        }
    }
    void OnDrawGizmosSelected()

    {
        if (asset != null && enabled)

        {
            FMOD.Studio.EventDescription desc = null;

            desc = FMODEditorExtension.GetEventDescription(asset.id);



            if (desc != null)

            {
                float max, min;

                desc.getMaximumDistance(out max);

                desc.getMinimumDistance(out min);



                Gizmos.color = Color.blue;

                Gizmos.DrawWireSphere(transform.position, min);

                Gizmos.DrawWireSphere(transform.position, max);
            }
        }
    }
Exemplo n.º 3
0
    public static FMOD.Studio.EventDescription GetEventDescription(string idString)
    {
        FMOD.Studio.EventDescription desc = null;
        if (!events.TryGetValue(idString, out desc))
        {
            if (sFMODSystem == null)
            {
                if (!LoadAllBanks())
                {
                    return(null);
                }
            }

            FMOD.GUID id = new FMOD.GUID();
            if (!ERRCHECK(FMOD.Studio.Util.ParseID(idString, out id)))
            {
                return(null);
            }

            FMOD.RESULT res = FMODEditorExtension.sFMODSystem.getEvent(id, FMOD.Studio.LOADING_MODE.BEGIN_NOW, out desc);
            if (res == FMOD.RESULT.ERR_EVENT_NOTFOUND || desc == null || !desc.isValid() || !ERRCHECK(res))
            {
                return(null);
            }

            events[idString] = desc;
        }
        return(desc);
    }
    private void Awake()
    {
        currentAsset = (FMODAsset)target;
        FMODEditorExtension.StopEvent();

        // Seting up parameters
        FMOD.Studio.EventDescription eventDescription = FMODEditorExtension.GetEventDescription(currentAsset.id);

        if (eventDescription == null)
        {
            return;
        }

        int count;

        eventDescription.GetParameterCount(out count);

        // Fetch parameters
        parameters.Clear();
        for (int i = 0; i < count; ++i)
        {
            Param parameter = new Param();
            eventDescription.GetParameterByIndex(i, out parameter.description);
            parameter.value = parameter.description.minimum;
        }
    }
Exemplo n.º 5
0
    //public GameObject[] spawnlocations;
    // Start is called before the first frame update
    void Start()
    {
        amb = FMODUnity.RuntimeManager.CreateInstance("event:/warehouse/Warehouse Amb");

        power = FMODUnity.RuntimeManager.GetEventDescription("event:/warehouse/Warehouse Amb");
        power.getParameterDescriptionByName("Danger", out pow);
        PDW = pow.id;

        amb.setParameterByID(PDW, 0f);
        amb.start();
        GameObject[]      locationarray = GameObject.FindGameObjectsWithTag("Slot");
        List <GameObject> locationlist  = new List <GameObject>();

        foreach (GameObject item in locationarray)
        {
            locationlist.Add(item);
        }
        for (int i = 0; i < 45; i++)
        {
            int x = i % possibleitems.Length;
            int r = Random.Range(0, locationlist.Count);
            Instantiate(possibleitems[x], locationlist[r].transform.position, Quaternion.identity);
            locationlist.RemoveAt(r);
        }

        /*
         * foreach(GameObject item in locationarray)
         * {
         *  Instantiate(possibleitems[Random.Range(0, possibleitems.Length)], item.transform.position,Quaternion.identity);
         *  //Destroy(item);
         * }
         */

        SendOrder();
    }
Exemplo n.º 6
0
    /// <summary>
    /// Gets the event.
    /// </summary>
    /// <param name="path">The path.</param>
    /// <returns></returns>
    public FMOD.Studio.EventInstance GetEvent(string path)
    {
        FMOD.Studio.EventInstance instance = null;

        if (string.IsNullOrEmpty(path))
        {
            Logger.LogError("Empty event path!");
            return(null);
        }

        if (eventDescriptions.ContainsKey(path))
        {
            Logger.ErrorCheck(eventDescriptions[path].CreateInstance(out instance));
        }
        else
        {
            FMOD.Studio.EventDescription desc = GetEventDescription(path);
            Logger.ErrorCheck(desc.CreateInstance(out instance));
        }

        if (instance == null)
        {
            Logger.LogMessage("GetEvent Failed: \"path\"");
        }

        return(instance);
    }
    /*-------------------------------------------*/

    // Start is called before the first frame update
    void Start()
    {
        music = FMODUnity.RuntimeManager.CreateInstance("event:/Music 2D");
        music.start();

        musicDescription = FMODUnity.RuntimeManager.GetEventDescription("event:/Music 2D");

        playJumpSound = FMODUnity.RuntimeManager.CreateInstance("event:/Jump_Sound");
    }
Exemplo n.º 8
0
    // Update is called once per frame

    private void Start()
    {
        staminaBar.maxValue = maxStamina;
        staminaBar.value    = maxStamina;
        Footsteps           = FMODUnity.RuntimeManager.CreateInstance("event:/player/footsteps");

        Speed = FMODUnity.RuntimeManager.GetEventDescription("event:/player/footsteps");
        Speed.getParameterDescriptionByName("Speed", out spd);
        SID = spd.id;
    }
Exemplo n.º 9
0
    void Start()
    {
        //SurfaceInputs.Instance.OnTouch += OnTouchReceive;
        SurfaceInputs.Instance.OnObjectAdd    += OnObjectAddReceive;
        SurfaceInputs.Instance.OnObjectRemove += OnObjectRemoveReceive;
        SurfaceInputs.Instance.OnObjectUpdate += OnObjectUpdateReceive;
        DistanceEffectsController.Instance.OnGroupingChange += HandleGroupingChanges;

        eventDescription = FMODUnity.RuntimeManager.GetEventDescription(selectEvent);
        InstanciateDictionaries();
    }
Exemplo n.º 10
0
    /// <summary>
    /// returns lenght of sound in milliseconds
    /// </summary>
    public static int GetLength(FMOD.Studio.EventInstance event_)
    {
        int lengthms = 0;

        FMOD.Studio.EventDescription ed = null;
        event_.getDescription(out ed);

        ed.getLength(out lengthms);

        return(lengthms);
    }
Exemplo n.º 11
0
    // Start is called before the first frame update
    void Start()
    {
        _initialLocation = transform.position;
        rb     = GetComponent <Rigidbody>();
        pickup = FMODUnity.RuntimeManager.CreateInstance("event:/Player/Pickup");
        Object = FMODUnity.RuntimeManager.GetEventDescription("event:/player/Pickup");
        Object.getParameterDescriptionByName("Object", out obj);
        OID = obj.id;


        pickup.setParameterByID(OID, objType);
    }
Exemplo n.º 12
0
 public RESULT getDescription(out EventDescription description)
 {
     description = null;
     IntPtr raw;
     RESULT rESULT = EventInstance.FMOD_Studio_EventInstance_GetDescription(this.rawPtr, out raw);
     if (rESULT != RESULT.OK)
     {
         return rESULT;
     }
     description = new EventDescription(raw);
     return rESULT;
 }
Exemplo n.º 13
0
    /// <summary>
    /// Gets the event.
    /// </summary>
    /// <param name="eventDescription">The event description.</param>
    /// <returns></returns>
    public FMOD.Studio.EventInstance GetEvent(FMOD.Studio.EventDescription eventDescription)
    {
        FMOD.Studio.EventInstance instance = null;

        Logger.ErrorCheck(eventDescription.CreateInstance(out instance));

        if (instance == null)
        {
            Logger.LogMessage("GetEvent Failed: \"path\"");
        }

        return(instance);
    }
Exemplo n.º 14
0
    private void Start()
    {
        scoreManager = ScoreManager.GetInstance();

        gameMusicInstance = FMODUnity.RuntimeManager.CreateInstance(gameMusicEvent);
        gameMusicInstance.start();

        FMOD.Studio.EventDescription      gameMusicEventDescription = FMODUnity.RuntimeManager.GetEventDescription(gameMusicEvent);
        FMOD.Studio.PARAMETER_DESCRIPTION isPlayStateParameterDescription;
        gameMusicEventDescription.getParameterDescriptionByName("IsPlayState", out isPlayStateParameterDescription);
        isPlayStateParameterId = isPlayStateParameterDescription.id;

        TransitionToMainMenuState();
    }
Exemplo n.º 15
0
 // Start is called before the first frame update
 void Start()
 {
     masterBus = FMODUnity.RuntimeManager.GetBus("bus:/");
     breathEventDescription = FMODUnity.RuntimeManager.GetEventDescription(breathEvent);
     breathEventDescription.getParameterDescriptionByName("OxygenValue", out pARAMETEROxygenDescription);
     pARAMETEROxygenId     = pARAMETEROxygenDescription.id;
     wrenchInstance        = FMODUnity.RuntimeManager.CreateInstance(wrenchEvent);
     openDoorInstance      = FMODUnity.RuntimeManager.CreateInstance(openDoorEvent);
     pickUpInstance        = FMODUnity.RuntimeManager.CreateInstance(pickUpEvent);
     useItemInstance       = FMODUnity.RuntimeManager.CreateInstance(useItemEvent);
     weatherChangeInstance = FMODUnity.RuntimeManager.CreateInstance(weatherChangeEvent);
     breathInstance        = FMODUnity.RuntimeManager.CreateInstance(breathEvent);
     masterBus.setVolume(0.4f);
 }
Exemplo n.º 16
0
    /*
     * private void OnDrawGizmosSelected()
     * {
     *  Gizmos.DrawIcon(transform.position, "FMODEmitter.tiff", true);
     *
     *  if (is3D && OverrideAttenuation)
     *  {
     *      Gizmos.color = new Color(0.6f, 0.6f, 1f, 0.8f);
     *      if (OverrideAttenuation)
     *      {
     *          Gizmos.DrawWireSphere(transform.position, OverrideMinDistance);
     *          Gizmos.DrawWireSphere(transform.position, OverrideMaxDistance);
     *      }
     *  }
     * }
     */

    public float GetLength(string eventPath)
    {
        if (instance.isValid())
        {
            eventDescription = FMODUnity.RuntimeManager.GetEventDescription(eventPath);
            int length;
            eventDescription.getLength(out length);
            return(length / 1000f);
        }
        else
        {
            return(-1f);
        }
    }
    void Awake()
    {
        emitter = (FMOD_StudioEventEmitter)target;

        is3D = false;

        FMOD.Studio.EventDescription desc = FMODEditorExtension.GetEventDescription(emitter.asset.id);

        if (desc != null)
        {
            desc.is3D(out is3D);
            desc.getMinimumDistance(out minDistance);
            desc.getMaximumDistance(out maxDistance);
        }
    }
Exemplo n.º 18
0
    public FMOD.Studio.EventInstance GetEvent(string path)
    {
        FMOD.Studio.EventInstance instance = null;

        if (string.IsNullOrEmpty(path))
        {
            FMOD.Studio.UnityUtil.LogError("Empty event path!");
            return(null);
        }

        if (eventDescriptions.ContainsKey(path) && eventDescriptions[path].isValid())
        {
            ERRCHECK(eventDescriptions[path].createInstance(out instance));
        }
        else
        {
            Guid id = new Guid();

            if (path.StartsWith("{"))
            {
                ERRCHECK(FMOD.Studio.Util.ParseID(path, out id));
            }
            else if (path.StartsWith("event:") || path.StartsWith("snapshot:"))
            {
                ERRCHECK(system.lookupID(path, out id));
            }
            else
            {
                FMOD.Studio.UnityUtil.LogError("Expected event path to start with 'event:/' or 'snapshot:/'");
            }

            FMOD.Studio.EventDescription desc = null;
            ERRCHECK(system.getEventByID(id, out desc));

            if (desc != null && desc.isValid())
            {
                eventDescriptions[path] = desc;
                ERRCHECK(desc.createInstance(out instance));
            }
        }

        if (instance == null)
        {
            FMOD.Studio.UnityUtil.Log("GetEvent FAILED: \"" + path + "\"");
        }

        return(instance);
    }
Exemplo n.º 19
0
    public FMOD.Studio.EventInstance GetEvent(string path)
    {
        FMOD.Studio.EventInstance instance = null;

        if (string.IsNullOrEmpty(path))
        {
            FMOD.Studio.UnityUtil.LogError("Empty event path!");
            return(null);
        }

        if (eventDescriptions.ContainsKey(path))
        {
            ERRCHECK(eventDescriptions[path].createInstance(out instance));
        }
        else
        {
            FMOD.GUID id = new FMOD.GUID();

            if (path.StartsWith("{"))
            {
                ERRCHECK(FMOD.Studio.Util.ParseID(path, out id));
            }
            else if (path.StartsWith("event:"))
            {
                ERRCHECK(system.lookupID(path, out id));
            }
            else
            {
                FMOD.Studio.UnityUtil.LogError("Expected event path to start with 'event:/'");
            }

            FMOD.Studio.EventDescription desc = null;
            ERRCHECK(system.getEvent(id, FMOD.Studio.LOADING_MODE.BEGIN_NOW, out desc));

            if (desc != null && desc.isValid())
            {
                eventDescriptions.Add(path, desc);
                ERRCHECK(desc.createInstance(out instance));
            }
        }

        if (instance == null)
        {
            FMOD.Studio.UnityUtil.Log("GetEvent FAILED: \"path\"");
        }

        return(instance);
    }
Exemplo n.º 20
0
    public void PlayMusic()
    {
        EventDescription = RuntimeManager.GetEventDescription(Event);                       //this assigns the EventDescription from the Event string variable that we set in the editor
        EventDescription.createInstance(out EventInstance);                                 //this creates an EventInstance from the EventDescription
        EventInstance.start();                                                              //this starts the event

        FMOD.Studio.EVENT_CALLBACK callback;                                                //special type of variable defined by FMOD.studio called EVENT_CALLBACK
        callback = new FMOD.Studio.EVENT_CALLBACK(BeatEventCallBack);                       //pointer to the function that we're going to callback which is MusicEventCallBack

        EventInstance.setCallback(callback, FMOD.Studio.EVENT_CALLBACK_TYPE.TIMELINE_BEAT); // sets a callback on the event that is created with the flag to call this on every Timeline beat

        FMOD.Studio.PARAMETER_DESCRIPTION distanceToClue_fmodParam;
        EventDescription.getParameter("DistanceToClue", out distanceToClue_fmodParam);
        maxClueDistance = distanceToClue_fmodParam.maximum; // sets maxClueDistance to the maximum value of the game parameter in the fmod parameter (30)
        print("Max Distance to Clue = " + maxClueDistance);
    }
Exemplo n.º 21
0
    void Start()
    {
        cachedRigidBody = GetComponent <Rigidbody>();
        health          = StartingHealth;

        //--------------------------------------------------------------------
        // 4: This shows how to create an instance of an Event and manually
        //    start it.
        //--------------------------------------------------------------------
        playerState = FMODUnity.RuntimeManager.CreateInstance(PlayerStateEvent);
        playerState.start();

        playerIntro = FMODUnity.RuntimeManager.CreateInstance(PlayerIntroEvent);
        playerIntro.start();

        //--------------------------------------------------------------------
        // 5: The RuntimeManager can track Event Instances and update their
        //    positions to match a given Game Object every frame. This is
        //    an easier alternative to manually doing this for every Instance
        //    such as shown in (8).
        //--------------------------------------------------------------------
        FMODUnity.RuntimeManager.AttachInstanceToGameObject(playerIntro, GetComponent <Transform>(), GetComponent <Rigidbody>());

        //--------------------------------------------------------------------
        //    Cache a handle to the "health" parameter for usage in Update()
        //    as shown in (9). Using the handle is much better for performance
        //    than trying to set the parameter by name every update.
        //--------------------------------------------------------------------
        FMOD.Studio.EventDescription healthEventDescription;
        playerState.getDescription(out healthEventDescription);
        FMOD.Studio.PARAMETER_DESCRIPTION healthParameterDescription;
        healthEventDescription.getParameterDescriptionByName("health", out healthParameterDescription);
        healthParameterId = healthParameterDescription.id;

        //--------------------------------------------------------------------
        //    Cache a handle to the "FullHeal" parameter for usage in
        //    ReceiveHealth() as shown in (13). Even though the event instance
        //    is recreated each time it is played, the parameter handle will
        //    always remain the same.
        //--------------------------------------------------------------------
        FMOD.Studio.EventDescription      fullHealEventDescription = FMODUnity.RuntimeManager.GetEventDescription(HealEvent);
        FMOD.Studio.PARAMETER_DESCRIPTION fullHealParameterDescription;
        fullHealEventDescription.getParameterDescriptionByName("FullHeal", out fullHealParameterDescription);
        fullHealthParameterId = fullHealParameterDescription.id;
    }
Exemplo n.º 22
0
    // Start is called before the first frame update
    void Start()
    {
        currState = requestedState;
        //// Create and initialize the FMOD instance
        instance_e = FMODUnity.RuntimeManager.CreateInstance("event:/ShellMusic");
        instance_e.start();

        ////Chace a handle to the intesity parameter
        FMOD.Studio.EventDescription      ShellMusicDescription = FMODUnity.RuntimeManager.GetEventDescription("event:/ShellMusic");
        FMOD.Studio.PARAMETER_DESCRIPTION intensityParameterDescription;
        ShellMusicDescription.getParameterDescriptionByName("Intensity", out intensityParameterDescription);
        intensityParamID = intensityParameterDescription.id;

        ////Chace a handle to the state parameter
        FMOD.Studio.PARAMETER_DESCRIPTION stateParameterDescription;
        ShellMusicDescription.getParameterDescriptionByName("GameMusicState", out stateParameterDescription);
        stateParamID = stateParameterDescription.id;
    }
Exemplo n.º 23
0
        public static FMOD.Studio.EventInstance CreateInstance(Guid guid)
        {
            FMOD.Studio.EventDescription eventDesc = GetEventDescription(guid);
            FMOD.Studio.EventInstance    newInstance;
            eventDesc.createInstance(out newInstance);

            #if UNITY_EDITOR
            bool is3D = false;
            eventDesc.is3D(out is3D);
            if (is3D)
            {
                // Set position to 1e+18F, set3DAttributes should be called by the dev after this.
                newInstance.set3DAttributes(RuntimeUtils.To3DAttributes(new Vector3(1e+18F, 1e+18F, 1e+18F)));
                instance.eventPositionWarnings.Add(newInstance);
            }
            #endif

            return(newInstance);
        }
    void Awake()
    {
        currentAsset = (FMODAsset)target;
        FMODEditorExtension.StopEvent();
        isPlaying = false;

        // set up parameters
        FMOD.Studio.EventDescription desc = FMODEditorExtension.GetEventDescription(currentAsset.id);
        int count;

        desc.getParameterCount(out count);
        parameters = new Param[count];

        for (int i = 0; i < count; ++i)
        {
            desc.getParameterByIndex(i, out parameters[i].desc);
            parameters[i].val = parameters[i].desc.minimum;
        }
    }
Exemplo n.º 25
0
        public static FMOD.RESULT TryGetEventDescription(string path, out FMOD.Studio.EventDescription eventDesc)
        {
            try
            {
                Guid        zGuid;
                FMOD.RESULT zResult = PathToGUID(path, out zGuid);
                if (zResult == RESULT.OK)
                {
                    return(TryGetEventDescription(zGuid, out eventDesc));
                }

                eventDesc = new EventDescription();
                return(zResult);
            }
            catch (EventNotFoundException)
            {
                throw new EventNotFoundException(path);
            }
        }
Exemplo n.º 26
0
    public FMOD.Studio.EventInstance getEvent(string path)
    {
        FMOD.Studio.EventInstance instance = null;

        if (string.IsNullOrEmpty(path))
        {
            Debug.LogError("Empty event path!");
            return(null);
        }

        if (eventDescriptions.ContainsKey(path))
        {
            ERRCHECK(eventDescriptions[path].createInstance(out instance));
        }
        else
        {
            FMOD.GUID id = new FMOD.GUID();

            if (path.StartsWith("{"))
            {
                ERRCHECK(FMOD.Studio.Util.ParseID(path, out id));
            }
            else if (path.StartsWith("/"))
            {
                ERRCHECK(system.lookupEventID(path, out id));
            }
            else
            {
                Debug.LogError("Expected event path to start with '/'");
            }

            FMOD.Studio.EventDescription desc = null;
            ERRCHECK(system.getEvent(id, FMOD.Studio.LOADING_MODE.BEGIN_NOW, out desc));

            eventDescriptions.Add(path, desc);
            ERRCHECK(desc.createInstance(out instance));
        }

//		Debug.Log("get event: " + (instance != null ? "suceeded!!" : "failed!!")); //PAS

        return(instance);
    }
Exemplo n.º 27
0
    static void DrawGizmo(FMOD_StudioEventEmitter studioEmitter, GizmoType gizmoType)
    {
        if (studioEmitter.asset != null && studioEmitter.enabled &&
            (!UnityEditor.EditorApplication.isPlayingOrWillChangePlaymode || UnityEditor.EditorApplication.isPlaying))
        {
            FMOD.Studio.EventDescription desc = null;
            desc = FMODEditorExtension.GetEventDescription(studioEmitter.asset.id);

            if (desc != null)
            {
                float max, min;
                desc.getMaximumDistance(out max);
                desc.getMinimumDistance(out min);

                Gizmos.color = Color.blue;
                Gizmos.DrawWireSphere(studioEmitter.transform.position, min);
                Gizmos.DrawWireSphere(studioEmitter.transform.position, max);
            }
        }
    }
    void OnDrawGizmosSelected()
    {
        if (asset != null && enabled &&
            (!UnityEditor.EditorApplication.isPlayingOrWillChangePlaymode || UnityEditor.EditorApplication.isPlaying))
        {
            FMOD.Studio.EventDescription desc = null;
            desc = FMODEditorExtension.GetEventDescription(asset.id);

            if (desc != null)
            {
                float max, min;
                desc.getMaximumDistance(out max);
                desc.getMinimumDistance(out min);

                Gizmos.color = Color.blue;
                Gizmos.DrawWireSphere(transform.position, min);
                Gizmos.DrawWireSphere(transform.position, max);
            }
        }
    }
    public static FMOD.Studio.EventDescription GetEventDescription(string idString)
    {
        FMOD.Studio.EventDescription desc = null;
        if (!events.TryGetValue(idString, out desc))
        {
            if (sFMODSystem == null)
            {
                LoadAllBanks();
            }
            FMOD.GUID id = new FMOD.GUID();
            ERRCHECK(FMOD.Studio.Util.ParseID(idString, out id));

            FMOD.RESULT res = FMODEditorExtension.sFMODSystem.getEvent(id, FMOD.Studio.LOADING_MODE.BEGIN_NOW, out desc);
            if (res == FMOD.RESULT.OK && desc != null && desc.isValid())
            {
                events[idString] = desc;
            }
        }
        return(desc);
    }
Exemplo n.º 30
0
    void Start()
    {
        target  = GameObject.FindGameObjectWithTag("Player").transform;
        driving = FMODUnity.RuntimeManager.CreateInstance("event:/Robits/Driving");
        danger  = FMODUnity.RuntimeManager.CreateInstance("event:/misc/music/chase");
        death   = FMODUnity.RuntimeManager.CreateInstance("event:/player/Death");

        speaking = FMODUnity.RuntimeManager.CreateInstance("event:/Robits/speaking");
        spotted  = FMODUnity.RuntimeManager.GetEventDescription("event:/Robits/speaking");
        spotted.getParameterDescriptionByName("Spotted", out spt);
        spot = spt.id;

        safe = FMODUnity.RuntimeManager.GetEventDescription("event:/misc/music/chase");
        safe.getParameterDescriptionByName("safe", out sfe);
        SID = sfe.id;

        Chase = FMODUnity.RuntimeManager.GetEventDescription("event:/Robits/Driving");
        Chase.getParameterDescriptionByName("Chase", out Chs);
        CID = Chs.id;
    }
Exemplo n.º 31
0
    static void GatherNewAssets(string filePath, List <FMODAsset> newAssets)
    {
        if (System.String.IsNullOrEmpty(filePath))
        {
            FMOD.Studio.UnityUtil.LogError("No build folder specified");
            return;
        }

        foreach (var bank in loadedBanks)
        {
            int count = 0;
            ERRCHECK(bank.getEventCount(out count));

            FMOD.Studio.EventDescription[] descriptions = new FMOD.Studio.EventDescription[count];
            ERRCHECK(bank.getEventList(out descriptions));

            foreach (var desc in descriptions)
            {
                string      path;
                FMOD.RESULT result = desc.getPath(out path);

                if (result == FMOD.RESULT.ERR_EVENT_NOTFOUND || desc == null || !desc.isValid() || !ERRCHECK(result))
                {
                    continue;
                }
                ERRCHECK(result);

                FMOD.GUID id;
                ERRCHECK(desc.getID(out id));

                var asset = ScriptableObject.CreateInstance <FMODAsset>();
                asset.name = path.Substring(path.LastIndexOf('/') + 1);
                asset.path = path;
                asset.id   = new System.Guid((int)id.Data1, (short)id.Data2, (short)id.Data3, id.Data4).ToString("B");
                //Debug.Log("name = " + asset.name + ", id = " + asset.id);

                newAssets.Add(asset);
            }
        }
    }
Exemplo n.º 32
0
        public RESULT getEventByID(Guid guid, out EventDescription _event)
        {
            _event = null;

            IntPtr eventraw = new IntPtr();
			RESULT result = FMOD_Studio_System_GetEventByID(rawPtr, guid.ToByteArray(), out eventraw);
            if (result != RESULT.OK)
            {
                return result;
            }

            _event = new EventDescription(eventraw);
            return result;
        }
Exemplo n.º 33
0
        public RESULT getEvent(string path, out EventDescription _event)
        {
            _event = null;

            IntPtr eventraw = new IntPtr();
            RESULT result = FMOD_Studio_System_GetEvent(rawPtr, Encoding.UTF8.GetBytes(path + Char.MinValue), out eventraw);
            if (result != RESULT.OK)
            {
                return result;
            }

            _event = new EventDescription(eventraw);
            return result;
        }
Exemplo n.º 34
0
        public RESULT getEventList(out EventDescription[] array)
        {
            array = null;

            RESULT result;
            int capacity;
            result = FMOD_Studio_Bank_GetEventCount(rawPtr, out capacity);
            if (result != RESULT.OK)
            {
                return result;
            }
            if (capacity == 0)
            {
                array = new EventDescription[0];
                return result;
            }

            IntPtr[] rawArray = new IntPtr[capacity];
            int actualCount;
            result = FMOD_Studio_Bank_GetEventList(rawPtr, rawArray, capacity, out actualCount);
            if (result != RESULT.OK)
            {
                return result;
            }
            if (actualCount > capacity) // More items added since we queried just now?
            {
                actualCount = capacity;
            }
            array = new EventDescription[actualCount];
            for (int i=0; i<actualCount; ++i)
            {
                array[i] = new EventDescription(rawArray[i]);
            }
            return RESULT.OK;
        }
Exemplo n.º 35
0
        public RESULT getDescription(out EventDescription description)
        {
            description = null;

            IntPtr newPtr;
            RESULT result = FMOD_Studio_EventInstance_GetDescription(rawPtr, out newPtr);
            if (result != RESULT.OK)
            {
                return result;
            }
            description = new EventDescription(newPtr);
            return result;
        }
Exemplo n.º 36
0
        public RESULT getEvent(GUID guid, LOADING_MODE mode, out EventDescription _event)
        {
            _event = null;

            IntPtr eventraw = new IntPtr();
            RESULT result = FMOD_Studio_System_GetEvent(rawPtr, ref guid, mode, out eventraw);
            if (result != RESULT.OK)
            {
                return result;
            }

            _event = new EventDescription(eventraw);
            return result;
        }