Beispiel #1
0
        public unsafe void AddDrawCallback(libobs.draw_callback callback, IntPtr param)
        {
            // store the delegate tuple to prevent delegate getting removed
            // by garbage collector

            delegateTuple tuple = new delegateTuple(callback, param);

            delegateRefs.Add(tuple);
            libobs.obs_display_add_draw_callback(instance, tuple.Item1, tuple.Item2);
        }
Beispiel #2
0
        public unsafe void RemoveCallback()
        {
            if (!delegateRefs.Any())
            {
                return;
            }

            delegateTuple tuple = delegateRefs.First();

            libobs.obs_volmeter_remove_callback(instance, tuple.Item1, tuple.Item2);
        }
Beispiel #3
0
        public unsafe void AddCallback(libobs.obs_volmeter_updated_t callback, IntPtr param)
        {
            // store the delegate tuple to prevent delegate getting removed
            // by garbage collector

            // Currently only support one callback
            if (delegateRefs.Any())
            {
                RemoveCallback();
            }

            delegateTuple tuple = new delegateTuple(callback, param);

            delegateRefs.Add(tuple);
            libobs.obs_volmeter_add_callback(instance, tuple.Item1, tuple.Item2);
        }
Beispiel #4
0
        public unsafe void RemoveDrawCallback(libobs.draw_callback callback, IntPtr param)
        {
            // use the reference of the archived delegate.

            // if delegate was created as the method were called (user passed
            // function as a first parameter instead of the actual delegate),
            // it would not match with the callback stored in libobs.

            delegateTuple tuple = new delegateTuple(callback, param);
            int           index = delegateRefs.IndexOf(tuple);

            if (index != -1)
            {
                tuple = delegateRefs[index];
                delegateRefs.RemoveAt(index);
            }

            libobs.obs_display_remove_draw_callback(instance, tuple.Item1, tuple.Item2);
        }