Exemplo n.º 1
0
        /// <summary>
        /// Resizes the signal until its length be a power of 2.
        /// </summary>
        /// <returns></returns>
        public void MakeLengthPowerOfTwo()
        {
            if (LengthIsPowerOf2() || Samples.Length == 0)
            {
                return;
            }
            var length = Samples.Length;

            while (!(WaveMath.IsPowerOf2(length)) && length > 0)
            {
                length--;
            }
            var newArray = MemoryPool.Pool.New <double>(length);

            Array.Copy(Samples, newArray, length);
            Samples = newArray;
        }
Exemplo n.º 2
0
 /// <summary>
 /// Informs that size of signal is a power of 2.
 /// </summary>
 /// <returns></returns>
 public bool LengthIsPowerOf2()
 {
     return(WaveMath.IsPowerOf2(Samples.Length));
 }