/**
         * Generates new window vector for a given type and size.
         *
         * Rectangular window is handled separately because it does not need
         * any additional computation.
         *
         * @param windowKey a cache key
         */
        private static void CreateWindow(KeyValuePair <WindowType, int> windowKey)
        {
            WindowType type = windowKey.Key;
            int        N    = windowKey.Value;

            if (type != WindowType.WIN_RECT)
            {
                WinGenerator  generator = new WinGenerator(type, N);
                List <double> window    = new List <double>();
                for (int i = 0; i < N; i++)
                {
                    double val = generator.windowMethod.Invoke(i, N);
                    window.Add(val);
                }
                windowsCache.Add(windowKey, window);
            }
            else
            {
                List <double> window = new List <double>();
                for (int i = 0; i < N; i++)
                {
                    window.Add(1.0);
                }
                windowsCache.Add(windowKey, window);
            }
        }
示例#2
0
		/**
		 * Generates new window vector for a given type and size.
		 *
		 * Rectangular window is handled separately because it does not need
		 * any additional computation.
		 *
		 * @param windowKey a cache key
		 */
		private static void CreateWindow(KeyValuePair<WindowType, int> windowKey)
		{
			WindowType type = windowKey.Key;
			int N = windowKey.Value;
			
			if (type != WindowType.WIN_RECT)
			{
				WinGenerator generator = new WinGenerator(type, N);
				List<double> window = new List<double>();
				for (int i = 0; i < N; i++) {
					double val = generator.windowMethod.Invoke(i, N);
					window.Add(val);
				}
				windowsCache.Add(windowKey, window);
			}
			else
			{
				List<double> window = new List<double>();
				for (int i = 0; i < N; i++) {
					window.Add(1.0);
				}
				windowsCache.Add(windowKey, window);
			}
		}