t1 / TFDContents / Assets / Standard Assets / Windows / Kinect / AudioBeamFrameReference.cs @ 11
이력 | 보기 | 이력해설 | 다운로드 (4.49 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.AudioBeamFrameReference |
||
| 9 | // |
||
| 10 | public sealed partial class AudioBeamFrameReference : 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 AudioBeamFrameReference(RootSystem.IntPtr pNative) |
||
| 18 | {
|
||
| 19 | _pNative = pNative; |
||
| 20 | Windows_Kinect_AudioBeamFrameReference_AddRefObject(ref _pNative); |
||
| 21 | } |
||
| 22 | |||
| 23 | ~AudioBeamFrameReference() |
||
| 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_AudioBeamFrameReference_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_AudioBeamFrameReference_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<AudioBeamFrameReference>(_pNative); |
||
| 42 | Windows_Kinect_AudioBeamFrameReference_ReleaseObject(ref _pNative); |
||
| 43 | |||
| 44 | _pNative = RootSystem.IntPtr.Zero; |
||
| 45 | } |
||
| 46 | |||
| 47 | |||
| 48 | // Public Properties |
||
| 49 | [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
|
||
| 50 | private static extern long Windows_Kinect_AudioBeamFrameReference_get_RelativeTime(RootSystem.IntPtr pNative); |
||
| 51 | public RootSystem.TimeSpan RelativeTime |
||
| 52 | {
|
||
| 53 | get |
||
| 54 | {
|
||
| 55 | if (_pNative == RootSystem.IntPtr.Zero) |
||
| 56 | {
|
||
| 57 | throw new RootSystem.ObjectDisposedException("AudioBeamFrameReference");
|
||
| 58 | } |
||
| 59 | |||
| 60 | return RootSystem.TimeSpan.FromMilliseconds(Windows_Kinect_AudioBeamFrameReference_get_RelativeTime(_pNative)); |
||
| 61 | } |
||
| 62 | } |
||
| 63 | |||
| 64 | |||
| 65 | // Public Methods |
||
| 66 | [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
|
||
| 67 | private static extern int Windows_Kinect_AudioBeamFrameReference_AcquireBeamFrames_Length(RootSystem.IntPtr pNative); |
||
| 68 | [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
|
||
| 69 | private static extern int Windows_Kinect_AudioBeamFrameReference_AcquireBeamFrames(RootSystem.IntPtr pNative, [RootSystem.Runtime.InteropServices.Out] RootSystem.IntPtr[] outCollection, int outCollectionSize); |
||
| 70 | public RootSystem.Collections.Generic.IList<Windows.Kinect.AudioBeamFrame> AcquireBeamFrames() |
||
| 71 | {
|
||
| 72 | if (_pNative == RootSystem.IntPtr.Zero) |
||
| 73 | {
|
||
| 74 | throw new RootSystem.ObjectDisposedException("AudioBeamFrameReference");
|
||
| 75 | } |
||
| 76 | |||
| 77 | int outCollectionSize = Windows_Kinect_AudioBeamFrameReference_AcquireBeamFrames_Length(_pNative); |
||
| 78 | var outCollection = new RootSystem.IntPtr[outCollectionSize]; |
||
| 79 | var managedCollection = new Windows.Kinect.AudioBeamFrame[outCollectionSize]; |
||
| 80 | |||
| 81 | outCollectionSize = Windows_Kinect_AudioBeamFrameReference_AcquireBeamFrames(_pNative, outCollection, outCollectionSize); |
||
| 82 | Helper.ExceptionHelper.CheckLastError(); |
||
| 83 | for(int i=0;i<outCollectionSize;i++) |
||
| 84 | {
|
||
| 85 | if(outCollection[i] == RootSystem.IntPtr.Zero) |
||
| 86 | {
|
||
| 87 | continue; |
||
| 88 | } |
||
| 89 | |||
| 90 | var obj = Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.AudioBeamFrame>(outCollection[i], n => new Windows.Kinect.AudioBeamFrame(n)); |
||
| 91 | |||
| 92 | managedCollection[i] = obj; |
||
| 93 | } |
||
| 94 | return managedCollection; |
||
| 95 | } |
||
| 96 | |||
| 97 | private void __EventCleanup() |
||
| 98 | {
|
||
| 99 | } |
||
| 100 | } |
||
| 101 | |||
| 102 | } |
||
| 103 | #endif |