public ulong Play(byte[] buffer) { IntPtr bufferPtr = Marshal.AllocHGlobal(Marshal.SizeOf <byte>() * buffer.Length); Marshal.Copy(buffer, 0, bufferPtr, buffer.Length); UIntPtr size = Out123NativeMethods.Play(handle, bufferPtr, new UIntPtr((ulong)buffer.Length)); Marshal.FreeHGlobal(bufferPtr); return(size.ToUInt64()); }