Пример #1
0
        private static void Windows_Data_PropertyChangedEventArgs_Delegate_Handler(IntPtr result, IntPtr pNative)
        {
            List <EventHandler <PropertyChangedEventArgs> > list = null;

            AudioBeamFrameReader.Windows_Data_PropertyChangedEventArgs_Delegate_callbacks.TryGetValue(pNative, out list);
            object obj = list;

            lock (obj)
            {
                AudioBeamFrameReader     objThis = NativeObjectCache.GetObject <AudioBeamFrameReader>(pNative);
                PropertyChangedEventArgs args    = new PropertyChangedEventArgs(result);
                using (List <EventHandler <PropertyChangedEventArgs> > .Enumerator enumerator = list.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        EventHandler <PropertyChangedEventArgs> func = enumerator.Current;
                        EventPump.Instance.Enqueue(delegate
                        {
                            try
                            {
                                func(objThis, args);
                            }
                            catch
                            {
                            }
                        });
                    }
                }
            }
        }
Пример #2
0
    void OnDestroy()
    {
        if (audioReader != null)
        {
            this.audioReader.Dispose();
            this.audioReader = null;

            //Debug.Log("KinectAudio destroyed.");
        }
    }
Пример #3
0
 // Token: 0x06002A6E RID: 10862 RVA: 0x000D75B0 File Offset: 0x000D59B0
 private void Dispose(bool disposing)
 {
     if (this._pNative == IntPtr.Zero)
     {
         return;
     }
     this.__EventCleanup();
     NativeObjectCache.RemoveObject <AudioBeamFrameReader>(this._pNative);
     if (disposing)
     {
         AudioBeamFrameReader.Windows_Kinect_AudioBeamFrameReader_Dispose(this._pNative);
     }
     AudioBeamFrameReader.Windows_Kinect_AudioBeamFrameReader_ReleaseObject(ref this._pNative);
     this._pNative = IntPtr.Zero;
 }
Пример #4
0
        // Token: 0x06002A82 RID: 10882 RVA: 0x000D7BD0 File Offset: 0x000D5FD0
        private void __EventCleanup()
        {
            AudioBeamFrameReader.Windows_Kinect_AudioBeamFrameArrivedEventArgs_Delegate_callbacks.TryAddDefault(this._pNative);
            List <EventHandler <AudioBeamFrameArrivedEventArgs> > list = AudioBeamFrameReader.Windows_Kinect_AudioBeamFrameArrivedEventArgs_Delegate_callbacks[this._pNative];
            object obj = list;

            lock (obj)
            {
                if (list.Count > 0)
                {
                    list.Clear();
                    if (this._pNative != IntPtr.Zero)
                    {
                        IntPtr pNative = this._pNative;
                        if (AudioBeamFrameReader.f__mg2 == null)
                        {
                            AudioBeamFrameReader.f__mg2 = new AudioBeamFrameReader._Windows_Kinect_AudioBeamFrameArrivedEventArgs_Delegate(AudioBeamFrameReader.Windows_Kinect_AudioBeamFrameArrivedEventArgs_Delegate_Handler);
                        }
                        AudioBeamFrameReader.Windows_Kinect_AudioBeamFrameReader_add_FrameArrived(pNative, AudioBeamFrameReader.f__mg2, true);
                    }
                    AudioBeamFrameReader._Windows_Kinect_AudioBeamFrameArrivedEventArgs_Delegate_Handle.Free();
                }
            }
            AudioBeamFrameReader.Windows_Data_PropertyChangedEventArgs_Delegate_callbacks.TryAddDefault(this._pNative);
            List <EventHandler <PropertyChangedEventArgs> > list2 = AudioBeamFrameReader.Windows_Data_PropertyChangedEventArgs_Delegate_callbacks[this._pNative];
            object obj2 = list2;

            lock (obj2)
            {
                if (list2.Count > 0)
                {
                    list2.Clear();
                    if (this._pNative != IntPtr.Zero)
                    {
                        IntPtr pNative2 = this._pNative;
                        if (AudioBeamFrameReader.f__mg3 == null)
                        {
                            AudioBeamFrameReader.f__mg3 = new AudioBeamFrameReader._Windows_Data_PropertyChangedEventArgs_Delegate(AudioBeamFrameReader.Windows_Data_PropertyChangedEventArgs_Delegate_Handler);
                        }
                        AudioBeamFrameReader.Windows_Kinect_AudioBeamFrameReader_add_PropertyChanged(pNative2, AudioBeamFrameReader.f__mg3, true);
                    }
                    AudioBeamFrameReader._Windows_Data_PropertyChangedEventArgs_Delegate_Handle.Free();
                }
            }
        }
Пример #5
0
        // Token: 0x06002A7F RID: 10879 RVA: 0x000D7AF8 File Offset: 0x000D5EF8
        public IList <AudioBeamFrame> AcquireLatestBeamFrames()
        {
            if (this._pNative == IntPtr.Zero)
            {
                throw new ObjectDisposedException("AudioBeamFrameReader");
            }
            int num = AudioBeamFrameReader.Windows_Kinect_AudioBeamFrameReader_AcquireLatestBeamFrames_Length(this._pNative);

            IntPtr[]         array  = new IntPtr[num];
            AudioBeamFrame[] array2 = new AudioBeamFrame[num];
            num = AudioBeamFrameReader.Windows_Kinect_AudioBeamFrameReader_AcquireLatestBeamFrames(this._pNative, array, num);
            ExceptionHelper.CheckLastError();
            for (int i = 0; i < num; i++)
            {
                if (!(array[i] == IntPtr.Zero))
                {
                    AudioBeamFrame audioBeamFrame = NativeObjectCache.CreateOrGetObject <AudioBeamFrame>(array[i], (IntPtr n) => new AudioBeamFrame(n));
                    array2[i] = audioBeamFrame;
                }
            }
            return(array2);
        }
Пример #6
0
    void Start()
    {
        Kinect2Interface sensorInterface = KinectManager.Instance.GetSensorData().sensorInterface as Kinect2Interface;

        Windows.Kinect.KinectSensor kinectSensor = sensorInterface != null ? sensorInterface.kinectSensor : null;

        if (kinectSensor != null)
        {
            this.audioSource = kinectSensor.AudioSource;
            this.audioReader = audioSource.OpenReader();

            Debug.Log("AudioSource IsActive: " + audioSource.IsActive);

            if (audioReader != null)
            {
                Debug.Log("KinectAudio successfully initialized.");
            }
            else
            {
                Debug.Log("KinectAudio initialization failed.");
            }
        }
    }
Пример #7
0
 // Token: 0x06002A69 RID: 10857 RVA: 0x000D755E File Offset: 0x000D595E
 internal AudioBeamFrameReader(IntPtr pNative)
 {
     this._pNative = pNative;
     AudioBeamFrameReader.Windows_Kinect_AudioBeamFrameReader_AddRefObject(ref this._pNative);
 }