Beispiel #1
0
    /// <summary>
    /// Writes an array of doubles to the MelShare
    /// </summary>
    public void WriteData(double[] data)
    {
        uint size = (uint)(data.Length * sizeof(double));

        if ((size + sizeof(uint)) <= shm_.MaxSize)
        {
            mutex_.WaitOne();
            byte[] sizeBytes = BitConverter.GetBytes(size);
            Marshal.Copy(sizeBytes, 0, shm_.Address, 1);
            Marshal.Copy(data, 0, shm_.Offset(sizeof(uint)), data.Length);
            mutex_.ReleaseMutex();
        }
        else
        {
            Debug.Log("MelShare " + shm_.Name + " failed to write data. Data is larger than max size of " + shm_.MaxSize + " bytes");
        }
    }