Пример #1
0
        /// <summary>
        ///   Combines a set of windows into one full signal.
        /// </summary>
        public static ComplexSignal Combine(params ComplexSignal[] signals)
        {
            // Compute common data
            int length     = 0;
            int nchannels  = signals[0].Channels;
            int sampleRate = signals[0].SampleRate;

            // Compute final length
            for (int i = 0; i < signals.Length; i++)
            {
                length += signals[i].Length;
            }

            // create channels
            ComplexSignal result = new ComplexSignal(nchannels, length, sampleRate);

            int pos = 0;

            foreach (ComplexSignal signal in signals)
            {
                Buffer.BlockCopy(signal.RawData, 0, result.RawData, pos, result.RawData.Length);
                pos += signal.RawData.Length;
            }

            return(result);
        }
Пример #2
0
 /// <summary>
 ///   Converts this signal to a ComplexSignal object.
 /// </summary>
 ///
 public ComplexSignal ToComplex()
 {
     if (format == SampleFormat.Format128BitComplex)
     {
         return(new ComplexSignal(rawData, channels, length, sampleRate));
     }
     else
     {
         return(ComplexSignal.FromSignal(this));
     }
 }
Пример #3
0
 /// <summary>
 ///   Create complex signal from complex array.
 /// </summary>
 ///
 /// <param name="signal">Source complex array.</param>
 /// <param name="sampleRate">Sample rate of the signal.</param>
 ///
 /// <returns>Returns an instance of complex signal.</returns>
 ///
 public static ComplexSignal FromArray(System.Numerics.Complex[,] signal, int sampleRate)
 {
     return(ComplexSignal.FromArray(signal, sampleRate, ComplexSignalStatus.Normal));
 }