当前位置: 首页>>代码示例>>C#>>正文


C# Frame.GetLength方法代码示例

本文整理汇总了C#中Frame.GetLength方法的典型用法代码示例。如果您正苦于以下问题:C# Frame.GetLength方法的具体用法?C# Frame.GetLength怎么用?C# Frame.GetLength使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Frame的用法示例。


在下文中一共展示了Frame.GetLength方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddFrames

        public void AddFrames(Frame[] frames)
        {
            lv.Items.Clear();
            if (frames.GetLength(0) > 0)
            {
                foreach (Frame item in frames)
                {
					String title = item.CallSignature;
					if (item.Location.File != null) title += " at " + item.Location.File + ":" + item.Location.Line;
                    lv.Items.Add(new ListViewItem(new string[] {"", title}, -1));
                }
				lv.Items[0].ImageIndex = currentImageIndex;
            }
        }
开发者ID:heon21st,项目名称:flashdevelop,代码行数:14,代码来源:StackframeUI.cs

示例2: AddFrames

 public void AddFrames(Frame[] frames)
 {
     wholeFrameStack.Clear();
     if (frames.GetLength(0) > 0)
     {
         Project project = PluginBase.CurrentProject as Project;
         int i = 0;
         foreach (Frame item in frames)
         {
             String title = item.getCallSignature();
             bool ownFile = false;
             SourceFile sourceFile = item.getLocation().getFile();
             if (sourceFile != null)
             {
                 title += " at " + sourceFile + ":" + item.getLocation().getLine();
                 if (project != null)
                 {
                     foreach (string cp in project.AbsoluteClasspaths)
                     {
                         string pathBackSlash = cp.TrimEnd(new[] { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar });
                         pathBackSlash = pathBackSlash.IndexOfOrdinal(Path.AltDirectorySeparatorChar.ToString()) > -1 ? pathBackSlash + Path.AltDirectorySeparatorChar : pathBackSlash + Path.DirectorySeparatorChar;
                         if (sourceFile.getFullPath().ToString().StartsWithOrdinal(pathBackSlash))
                         {
                             ownFile = true;
                             break;
                         }
                     }
                 }
             }
             var listItem = new ListViewItem(new[] { string.Empty, title }, -1)
             {
                 Tag = new ListItemData { Frame = item, Index = i++ }
             };
             listItem.UseItemStyleForSubItems = false;
             // Apply proper theming colour
             if (!ownFile)
             {
                 Color color = PluginBase.MainForm.GetThemeColor("ListView.ForeColor");
                 if (color == Color.Empty) color = System.Drawing.SystemColors.GrayText;
                 listItem.SubItems[1].ForeColor = color;
             }
             wholeFrameStack.Add(listItem);
         }
         FilterResults();
         toolStripTextBoxFilter.Enabled = true;
     }
     else
     {
         lv.Items.Clear();
         toolStripTextBoxFilter.Enabled = false;
     }
 }
开发者ID:xeronith,项目名称:flashdevelop,代码行数:52,代码来源:StackframeUI.cs

示例3: FramePower

		/**
		 * Calculates frame power.
		 *
		 * Frame power is the energy normalized by frame length.
		 *
		 * @param frame pointer to Frame object
		 * @return frame power
		 */
		public double FramePower(Frame frame)
		{
			//double energy = std.accumulate(frame.begin(), frame.end(), 0.0, new SquareAndSum());
			double energy = 0;
			foreach(int i in frame) {
				energy += AddSquare(0.0, i);
			}
			
			return energy / frame.GetLength();
		}
开发者ID:khairy-mohamed,项目名称:FindSimilar,代码行数:18,代码来源:Transform.cs

示例4: Fft

		/**
		 * Calculates FFT of a signal frame using radix-2 algorithm.
		 *
		 * Input data is given as a pointer to Frame object.
		 * Output spectrum is written to the spectrum vector, which must be
		 * initialized prior to the call to fft(). The spectrum is
		 * normalized by N/2, wher N is input frame length (zero-padded).
		 * The method  returns maximum magnitude of the calculated spectrum,
		 * which can be used for example to scale a frequency plot.
		 *
		 * @param frame pointer to Frame object
		 * @param spectrum initialized complex vector of the same length as data
		 * @return maximum magnitude of the spectrum
		 * @since 2.0.1
		 */
		public double Fft(Frame frame, ref Complex[] spectrum)
		{
			// the vector is initialized to zero padded length,
			// what means that it contains default values of contained type
			// (0.0 in case of double); that allows us to loop
			// only to frame length without padding and
			// automatically have zeros at the end of data
			double[] data = new double[zeroPaddedLength];
			int length = frame.GetLength();
			
			short[] frameArray = frame.ToArray();
			
			// first sample does not need preemphasis
			data[0] = frameArray[0];

			double current = 0.0;
			double previous = data[0];
			
			// iterate over all samples of the frame
			// filter the data through preemphasis
			// and apply a chosen window function
			// The goal of pre-emphasis is to compensate the high-frequency part
			// that was suppressed during the sound production mechanism of humans.
			// Moreover, it can also amplify the importance of high-frequency formants.
			// It's not neccesary for only music, but important for speech
			// (Set to 0 if no pre-emphasis should be performed)
			for (int n = 1; n < length; n++)
			{
				current = frameArray[n];
				data[n] = (current - preemphasisFactor * previous) * Window.Apply(winType, n, length);
				previous = current;
			}
			
			return Fft(data, ref spectrum);
		}
开发者ID:khairy-mohamed,项目名称:FindSimilar,代码行数:50,代码来源:Transform.cs

示例5: AddFrames

        public void AddFrames(Frame[] frames)
        {
            lv.Items.Clear();

            if (frames.GetLength(0) > 0)
            {
                foreach (Frame item in frames)
                {
                    lv.Items.Add(new ListViewItem(new string[] {"", item.CallSignature}, -1));
                }

				lv.Items[0].ImageIndex = currentImageIndex;
            }
        }
开发者ID:heon21st,项目名称:flashdevelop,代码行数:14,代码来源:StackframeUI.cs


注:本文中的Frame.GetLength方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。