Ejemplo n.º 1
0
        public EegIndexValues[] ReadData(int offset, int length)
        {
            var bufferPtr = Marshal.AllocHGlobal(length * Marshal.SizeOf <EegIndexValues>());

            try
            {
                SdkError.ThrowIfError(EegIndexChannel_read_data(ChannelPtr, (IntPtr)offset, (IntPtr)length, bufferPtr, (IntPtr)length, out var dataRead));
                return(_arrayMarshaler.MarshalArray(bufferPtr, dataRead));
            }
            finally
            {
                Marshal.FreeHGlobal(bufferPtr);
            }
        }
Ejemplo n.º 2
0
        public ArtifactZone[] ReadData(int offset, int length)
        {
            var bufferPtr = Marshal.AllocHGlobal(length * Marshal.SizeOf <ArtifactZone>());

            try
            {
                SdkError.ThrowIfError(EegArtifactChannel_read_data(ChannelPtr, (IntPtr)offset, (IntPtr)length, bufferPtr));
                return(_arrayMarshaler.MarshalArray(bufferPtr, (IntPtr)length));
            }
            finally
            {
                Marshal.FreeHGlobal(bufferPtr);
            }
        }
Ejemplo n.º 3
0
        internal T[] ReadChannelData(IntPtr channelPtr, int offset, int length)
        {
            var bufferSize = length * Marshal.SizeOf <T>();
            var bufferPtr  = Marshal.AllocHGlobal(bufferSize);

            try
            {
                SdkError.ThrowIfError(_readerFunc(channelPtr, (IntPtr)offset, (IntPtr)length, bufferPtr, (IntPtr)bufferSize, out var dataRead));
                return(_arrayMarshaler.MarshalArray(bufferPtr, dataRead));
            }
            finally
            {
                Marshal.FreeHGlobal(bufferPtr);
            }
        }