프로젝트

일반

사용자정보

통계
| 개정판:

t1 / TFDContents / Assets / Standard Assets / Windows / Kinect / AudioBeamSubFrame.cs @ 9

이력 | 보기 | 이력해설 | 다운로드 (9.58 KB)

1 3 KTH
#if !(UNITY_WSA_10_0 && NETFX_CORE)
2
using RootSystem = System;
3
using System.Linq;
4
using System.Collections.Generic;
5
namespace Windows.Kinect
6
{
7
    //
8
    // Windows.Kinect.AudioBeamSubFrame
9
    //
10
    public sealed partial class AudioBeamSubFrame : RootSystem.IDisposable, Helper.INativeWrapper
11
12
    {
13
        internal RootSystem.IntPtr _pNative;
14
        RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } }
15
16
        // Constructors and Finalizers
17
        internal AudioBeamSubFrame(RootSystem.IntPtr pNative)
18
        {
19
            _pNative = pNative;
20
            Windows_Kinect_AudioBeamSubFrame_AddRefObject(ref _pNative);
21
        }
22
23
        ~AudioBeamSubFrame()
24
        {
25
            Dispose(false);
26
        }
27
28
        [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
29
        private static extern void Windows_Kinect_AudioBeamSubFrame_ReleaseObject(ref RootSystem.IntPtr pNative);
30
        [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
31
        private static extern void Windows_Kinect_AudioBeamSubFrame_AddRefObject(ref RootSystem.IntPtr pNative);
32
        private void Dispose(bool disposing)
33
        {
34
            if (_pNative == RootSystem.IntPtr.Zero)
35
            {
36
                return;
37
            }
38
39
            __EventCleanup();
40
41
            Helper.NativeObjectCache.RemoveObject<AudioBeamSubFrame>(_pNative);
42
43
            if (disposing)
44
            {
45
                Windows_Kinect_AudioBeamSubFrame_Dispose(_pNative);
46
            }
47
                Windows_Kinect_AudioBeamSubFrame_ReleaseObject(ref _pNative);
48
49
            _pNative = RootSystem.IntPtr.Zero;
50
        }
51
52
53
        // Public Properties
54
        [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
55
        private static extern Windows.Kinect.AudioBeamMode Windows_Kinect_AudioBeamSubFrame_get_AudioBeamMode(RootSystem.IntPtr pNative);
56
        public  Windows.Kinect.AudioBeamMode AudioBeamMode
57
        {
58
            get
59
            {
60
                if (_pNative == RootSystem.IntPtr.Zero)
61
                {
62
                    throw new RootSystem.ObjectDisposedException("AudioBeamSubFrame");
63
                }
64
65
                return Windows_Kinect_AudioBeamSubFrame_get_AudioBeamMode(_pNative);
66
            }
67
        }
68
69
        [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
70
        private static extern int Windows_Kinect_AudioBeamSubFrame_get_AudioBodyCorrelations(RootSystem.IntPtr pNative, [RootSystem.Runtime.InteropServices.Out] RootSystem.IntPtr[] outCollection, int outCollectionSize);
71
        [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
72
        private static extern int Windows_Kinect_AudioBeamSubFrame_get_AudioBodyCorrelations_Length(RootSystem.IntPtr pNative);
73
        public  RootSystem.Collections.Generic.IList<Windows.Kinect.AudioBodyCorrelation> AudioBodyCorrelations
74
        {
75
            get
76
            {
77
                if (_pNative == RootSystem.IntPtr.Zero)
78
                {
79
                    throw new RootSystem.ObjectDisposedException("AudioBeamSubFrame");
80
                }
81
82
                int outCollectionSize = Windows_Kinect_AudioBeamSubFrame_get_AudioBodyCorrelations_Length(_pNative);
83
                var outCollection = new RootSystem.IntPtr[outCollectionSize];
84
                var managedCollection = new Windows.Kinect.AudioBodyCorrelation[outCollectionSize];
85
86
                outCollectionSize = Windows_Kinect_AudioBeamSubFrame_get_AudioBodyCorrelations(_pNative, outCollection, outCollectionSize);
87
                Helper.ExceptionHelper.CheckLastError();
88
                for(int i=0;i<outCollectionSize;i++)
89
                {
90
                    if(outCollection[i] == RootSystem.IntPtr.Zero)
91
                    {
92
                        continue;
93
                    }
94
95
                    var obj = Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.AudioBodyCorrelation>(outCollection[i], n => new Windows.Kinect.AudioBodyCorrelation(n));
96
97
                    managedCollection[i] = obj;
98
                }
99
                return managedCollection;
100
            }
101
        }
102
103
        [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
104
        private static extern float Windows_Kinect_AudioBeamSubFrame_get_BeamAngle(RootSystem.IntPtr pNative);
105
        public  float BeamAngle
106
        {
107
            get
108
            {
109
                if (_pNative == RootSystem.IntPtr.Zero)
110
                {
111
                    throw new RootSystem.ObjectDisposedException("AudioBeamSubFrame");
112
                }
113
114
                return Windows_Kinect_AudioBeamSubFrame_get_BeamAngle(_pNative);
115
            }
116
        }
117
118
        [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
119
        private static extern float Windows_Kinect_AudioBeamSubFrame_get_BeamAngleConfidence(RootSystem.IntPtr pNative);
120
        public  float BeamAngleConfidence
121
        {
122
            get
123
            {
124
                if (_pNative == RootSystem.IntPtr.Zero)
125
                {
126
                    throw new RootSystem.ObjectDisposedException("AudioBeamSubFrame");
127
                }
128
129
                return Windows_Kinect_AudioBeamSubFrame_get_BeamAngleConfidence(_pNative);
130
            }
131
        }
132
133
        [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
134
        private static extern long Windows_Kinect_AudioBeamSubFrame_get_Duration(RootSystem.IntPtr pNative);
135
        public  RootSystem.TimeSpan Duration
136
        {
137
            get
138
            {
139
                if (_pNative == RootSystem.IntPtr.Zero)
140
                {
141
                    throw new RootSystem.ObjectDisposedException("AudioBeamSubFrame");
142
                }
143
144
                return RootSystem.TimeSpan.FromMilliseconds(Windows_Kinect_AudioBeamSubFrame_get_Duration(_pNative));
145
            }
146
        }
147
148
        [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
149
        private static extern uint Windows_Kinect_AudioBeamSubFrame_get_FrameLengthInBytes(RootSystem.IntPtr pNative);
150
        public  uint FrameLengthInBytes
151
        {
152
            get
153
            {
154
                if (_pNative == RootSystem.IntPtr.Zero)
155
                {
156
                    throw new RootSystem.ObjectDisposedException("AudioBeamSubFrame");
157
                }
158
159
                return Windows_Kinect_AudioBeamSubFrame_get_FrameLengthInBytes(_pNative);
160
            }
161
        }
162
163
        [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
164
        private static extern long Windows_Kinect_AudioBeamSubFrame_get_RelativeTime(RootSystem.IntPtr pNative);
165
        public  RootSystem.TimeSpan RelativeTime
166
        {
167
            get
168
            {
169
                if (_pNative == RootSystem.IntPtr.Zero)
170
                {
171
                    throw new RootSystem.ObjectDisposedException("AudioBeamSubFrame");
172
                }
173
174
                return RootSystem.TimeSpan.FromMilliseconds(Windows_Kinect_AudioBeamSubFrame_get_RelativeTime(_pNative));
175
            }
176
        }
177
178
179
        // Public Methods
180
        [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
181
        private static extern void Windows_Kinect_AudioBeamSubFrame_CopyFrameDataToArray(RootSystem.IntPtr pNative, RootSystem.IntPtr frameData, int frameDataSize);
182
        public void CopyFrameDataToArray(byte[] frameData)
183
        {
184
            if (_pNative == RootSystem.IntPtr.Zero)
185
            {
186
                throw new RootSystem.ObjectDisposedException("AudioBeamSubFrame");
187
            }
188
189
            var frameDataSmartGCHandle = new Helper.SmartGCHandle(RootSystem.Runtime.InteropServices.GCHandle.Alloc(frameData, RootSystem.Runtime.InteropServices.GCHandleType.Pinned));
190
            var _frameData = frameDataSmartGCHandle.AddrOfPinnedObject();
191
            Windows_Kinect_AudioBeamSubFrame_CopyFrameDataToArray(_pNative, _frameData, frameData.Length);
192
            Helper.ExceptionHelper.CheckLastError();
193
        }
194
195
        [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
196
        private static extern void Windows_Kinect_AudioBeamSubFrame_Dispose(RootSystem.IntPtr pNative);
197
        public void Dispose()
198
        {
199
            if (_pNative == RootSystem.IntPtr.Zero)
200
            {
201
                return;
202
            }
203
204
            Dispose(true);
205
            RootSystem.GC.SuppressFinalize(this);
206
        }
207
208
        private void __EventCleanup()
209
        {
210
        }
211
    }
212
213
}
214
#endif