setUserData() public method

public setUserData ( IntPtr userData ) : RESULT
userData System.IntPtr
return RESULT
Beispiel #1
0
 void OnDestroy()
 {
     FMODmusic.setUserData(IntPtr.Zero);
     FMODmusic.stop(FMOD.Studio.STOP_MODE.IMMEDIATE);
     FMODmusic.release();
     timelineHandle.Free();
 }
 private void OnDestroy()
 {
     musicInstance.setUserData(IntPtr.Zero);
     musicInstance.stop(FMOD.Studio.STOP_MODE.IMMEDIATE);
     musicInstance.release();
     timelineHandle.Free();
 }
Beispiel #3
0
 /// <summary>
 ///  Stops the instance from playing any more sound, and releases the instance from the timelineHandle.
 /// </summary>
 public void StopAndClear(FMOD.Studio.EventInstance instance)
 {
     instance.setUserData(IntPtr.Zero);
     instance.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT);
     instance.release();
     timelineHandle.Free();
 }
    void Start()
    {
        markerOnEvent = new UnityEvent();
        barEvent      = new UnityEvent();
        markerOnEvent.AddListener(fireNote);
        instance = this;
        marker   = "";


        //FMOD shit
        timelineInfo = new TimelineInfo();

        // Explicitly create the delegate object and assign it to a member so it doesn't get freed
        // by the garbage collected while it's being used
        beatCallback = new FMOD.Studio.EVENT_CALLBACK(BeatEventCallback);

        musicInstance = FMODUnity.RuntimeManager.CreateInstance(LevelStateEvent);

        // Pin the class that will store the data modified during the callback
        timelineHandle = GCHandle.Alloc(timelineInfo, GCHandleType.Pinned);
        // Pass the object through the userdata of the instance
        musicInstance.setUserData(GCHandle.ToIntPtr(timelineHandle));

        musicInstance.setCallback(beatCallback, FMOD.Studio.EVENT_CALLBACK_TYPE.TIMELINE_BEAT | FMOD.Studio.EVENT_CALLBACK_TYPE.TIMELINE_MARKER);
        //Debug.Log("CALLBACK");

        musicInstance.start();

        //missInstance = FMODUnity.RuntimeManager.CreateInstance("event:/NoteMiss");

        //
    }
Beispiel #5
0
 public void AssignBeatEvent(FMOD.Studio.EventInstance instance)
 {
     timelineInfo   = new TimelineInfo();
     timelineHandle = GCHandle.Alloc(timelineInfo, GCHandleType.Pinned);
     beatCallback   = new FMOD.Studio.EVENT_CALLBACK(BeatEventCallback);
     instance.setUserData(GCHandle.ToIntPtr(timelineHandle));
     instance.setCallback(beatCallback, FMOD.Studio.EVENT_CALLBACK_TYPE.TIMELINE_BEAT | FMOD.Studio.EVENT_CALLBACK_TYPE.TIMELINE_MARKER);
 }
Beispiel #6
0
    public void FMODMusicChange(string path)
    {
        FMODmusic.release();
        FMODmusic = FMODUnity.RuntimeManager.CreateInstance(path);
        FMODmusic.setUserData(GCHandle.ToIntPtr(timelineHandle));

        FMODmusic.setCallback(beatCallback, FMOD.Studio.EVENT_CALLBACK_TYPE.TIMELINE_BEAT | FMOD.Studio.EVENT_CALLBACK_TYPE.TIMELINE_MARKER);
    }
    private void AddInstance()
    {
        FMOD.Studio.EventInstance instance = FMODUnity.RuntimeManager.CreateInstance(path);
        instance.setCallback(callback, FMOD.Studio.EVENT_CALLBACK_TYPE.STOPPED);
        instance.setUserData(stackPtr);

        foreach (KeyValuePair <string, Parameter> parameter in parameters)
        {
            instance.setParameterByID(parameter.Value.id, parameter.Value.value);
        }

        instances.Add(instance);
        stoppedInstances.Push(instance);
    }
    // Start is called before the first frame update
    void Start()
    {
        timelineInfo = new TimelineInfo();
        // Explicitly create the delegate object and assign it to a member so it doesn't get freed
        // by the garbage collected while it's being used
        beatCallback = new FMOD.Studio.EVENT_CALLBACK(BeatEventCallback);
        musicEvent   = FMODUnity.RuntimeManager.CreateInstance(musicPath);

        // Pin the class that will store the data modified during the callback
        timelineHandle = GCHandle.Alloc(timelineInfo, GCHandleType.Pinned);
        // Pass the object through the userdata of the instance
        musicEvent.setUserData(GCHandle.ToIntPtr(timelineHandle));

        musicEvent.setCallback(beatCallback, FMOD.Studio.EVENT_CALLBACK_TYPE.TIMELINE_BEAT | FMOD.Studio.EVENT_CALLBACK_TYPE.TIMELINE_MARKER);
        musicEvent.start();

        gm = GameObject.Find("GameManager").GetComponent <GameManager>();
    }
    //THE SINGLETON HAS APPEARED: This allows for everything to access this SINGLE INSTANCE of the script and access its variables
    //The drawback is that if this script ever gets destroyed, it's gonna mean everything that relies on the information provided
    //by this script is gonna break.
    //public static FMODVibeTracker vt;

    /*
     * void Awake()
     * {
     *     vt = this;
     * }
     */
    // Start is called before the first frame update
    void Start()
    {
        timelineInfo = new TimelineInfo();

        //Explicitly create the delegate object and assign it to a member so it doesn't get freed
        //by the garbage collected while it's being used
        beatCallback = new FMOD.Studio.EVENT_CALLBACK(BeatEventCallback);

        musicInstance = FMODUnity.RuntimeManager.CreateInstance(music);

        //Pin the class that will store the data modified during the callback
        timelineHandle = GCHandle.Alloc(timelineInfo, GCHandleType.Pinned);
        //Pass the object through the userdata of the instance
        musicInstance.setUserData(GCHandle.ToIntPtr(timelineHandle));

        musicInstance.setCallback(beatCallback, FMOD.Studio.EVENT_CALLBACK_TYPE.TIMELINE_BEAT | FMOD.Studio.EVENT_CALLBACK_TYPE.TIMELINE_MARKER);
        musicInstance.start();

        musicInstance.getDescription(out descriptionCallback);
        descriptionCallback.getLength(out int length);

        timelineInfo.songLength = length;
    }