Ejemplo n.º 1
0
        public static PlatformData[] GetPlatforms()
        {
            uint platformCount = ApiWrapper.get_num_platforms();

            if (platformCount == 0)
            {
                return(null);
            }

            ApiWrapper.Platform[] data    = new ApiWrapper.Platform[platformCount];
            PlatformData[]        retData = new PlatformData[platformCount];

            unsafe
            {
                fixed(ApiWrapper.Platform *pData = data)
                {
                    ApiWrapper.get_platforms(pData, platformCount);
                }

                for (uint i = 0; i < platformCount; ++i)
                {
                    retData[i].Name       = Marshal.PtrToStringAnsi((IntPtr)data[i].name);
                    retData[i].NumDevices = data[i].num_devices;
                    retData[i].Devices    = new DeviceData[retData[i].NumDevices];
                    retData[i].devices    = new ApiWrapper.Device[retData[i].NumDevices];

                    for (uint j = 0; j < retData[i].NumDevices; ++j)
                    {
                        retData[i].devices[j] = data[i].devices[j];

                        retData[i].Devices[j] = new DeviceData
                        {
                            Id      = data[i].devices[j].id,
                            Name    = Marshal.PtrToStringAnsi((IntPtr)data[i].devices[j].name),
                            Version = data[i].devices[j].version
                        };
                    }
                }
            }
            //TODO add free
            return(retData);
        }
Ejemplo n.º 2
0
        public bool Cooley_Tukey(ApiWrapper.Device device, bool isInverse = false)
        {
            int status;
            var data = new float[_inputData.Length];

            _inputData.CopyTo(data, 0);
            unsafe
            {
                fixed(float *pData = data)
                {
                    status = ApiWrapper.Cooley_Tukey(pData, (uint)data.Length / 2, isInverse ? -1 : 1, device);
                }
            }

            if (status == 0)
            {
                _outputData = data;
            }

            return(status == 0);
        }