本文整理汇总了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;
}
}
示例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;
}
}
示例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();
}
示例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);
}
示例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;
}
}