예제 #1
0
        private static void TestInteropNative()
        {
            var native = new NativeInterop(@"assets\dsp_demo_sample.wav");

            native.Read(out IntPtr data, out int length);
            var wavheader1 = Marshal.PtrToStructure <WavHeader>(data);

            unsafe
            {
                var ptr = native.ReadUnsafe();

                var spanByte = new Span <byte>(ptr, sizeof(WavHeader));

                var     spanWavHeader    = new Span <WavHeader>(ptr, 1);
                ref var refSpanWavHeader = ref MemoryMarshal.GetReference <WavHeader>(spanWavHeader);

                var wavheaderx1 = MemoryMarshal.Cast <byte, WavHeader>(spanByte);

                var wavheader2 = MemoryMarshal.Read <WavHeader>(spanByte);
            }
예제 #2
0
 public TestNative()
 {
     _native = new NativeInterop(@"assets\dsp_demo_sample.wav");
 }