public static ComplexSignal FromArray(Complex[,] array, int sampleRate, ComplexSignalStatus status)
{
int samples = array.GetLength(0);
int channels = array.GetLength(1);
// check signal size
if (!Accord.Math.Tools.IsPowerOf2(samples))
{
throw new InvalidSignalPropertiesException("Signals length should be a power of 2.");
}
byte[] buffer = new byte[array.Length * Marshal.SizeOf(typeof(Complex))];
GCHandle handle = GCHandle.Alloc(array, GCHandleType.Pinned);
Marshal.Copy(handle.AddrOfPinnedObject(), buffer, 0, buffer.Length);
handle.Free();
return new ComplexSignal(buffer, channels, samples, sampleRate, status);
}