Example #1
0
        public int GetPacketRaw(ref byte[] samples, int channel = 0, int timeout = 1000)
        {
            AARTSAAPI_Packet packet = new AARTSAAPI_Packet();
            DateTime         start  = DateTime.Now;

            while (AARTSAAPI_GetPacket(ref Device, channel, 0, ref packet) == AARTSAAPI_Result.AARTSAAPI_EMPTY || packet.num == 0)
            {
                Thread.Sleep(5);
                if ((DateTime.Now - start).TotalMilliseconds > timeout)
                {
                    return(0);
                }
            }

            if (samples == null || samples.Length < packet.num * 2 * 4)
            {
                samples = new byte[packet.num * 2 * 4];
            }
            Marshal.Copy(packet.fp32, samples, 0, (int)(packet.num * 2 * 4));

            AARTSAAPI_ConsumePackets(ref Device, channel, 1);

            return((int)(packet.num * 2 * 4));
        }
Example #2
0
 public static extern AARTSAAPI_Result AARTSAAPI_SendPacket(ref AARTSAAPI_Device dhandle, int channel, ref AARTSAAPI_Packet packet);
Example #3
0
 public static extern AARTSAAPI_Result AARTSAAPI_GetPacket(ref AARTSAAPI_Device dhandle, int channel, int index, ref AARTSAAPI_Packet packet);