本文整理汇总了C#中NAudio.Wave.WaveFileReader.GetChunkData方法的典型用法代码示例。如果您正苦于以下问题:C# WaveFileReader.GetChunkData方法的具体用法?C# WaveFileReader.GetChunkData怎么用?C# WaveFileReader.GetChunkData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NAudio.Wave.WaveFileReader
的用法示例。
在下文中一共展示了WaveFileReader.GetChunkData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Describe
public string Describe(string fileName)
{
StringBuilder stringBuilder = new StringBuilder();
using (WaveFileReader wf = new WaveFileReader(fileName))
{
stringBuilder.AppendFormat("{0} {1}Hz {2} channels {3} bits per sample\r\n",
wf.WaveFormat.Encoding, wf.WaveFormat.SampleRate,
wf.WaveFormat.Channels, wf.WaveFormat.BitsPerSample);
stringBuilder.AppendFormat("Extra Size: {0} Block Align: {1} Average Bytes Per Second: {2}\r\n",
wf.WaveFormat.ExtraSize, wf.WaveFormat.BlockAlign,
wf.WaveFormat.AverageBytesPerSecond);
stringBuilder.AppendFormat("WaveFormat: {0}\r\n",wf.WaveFormat);
stringBuilder.AppendFormat("Length: {0} bytes: {1} \r\n", wf.Length, wf.TotalTime);
foreach (RiffChunk chunk in wf.ExtraChunks)
{
stringBuilder.AppendFormat("Chunk: {0}, length {1}\r\n", chunk.IdentifierAsString, chunk.Length);
byte[] data = wf.GetChunkData(chunk);
DescribeChunk(chunk, stringBuilder, data);
}
}
return stringBuilder.ToString();
}
示例2: FromChunks
/// <summary>
/// Checks if the cue and list chunks exist and if so, creates a cue list
/// </summary>
internal static CueList FromChunks(WaveFileReader reader)
{
CueList cueList = null;
byte[] cueChunkData = null;
byte[] listChunkData = null;
foreach (RiffChunk chunk in reader.ExtraChunks)
{
if (chunk.IdentifierAsString.ToLower() == "cue ")
{
cueChunkData = reader.GetChunkData(chunk);
}
else if (chunk.IdentifierAsString.ToLower() == "list")
{
listChunkData = reader.GetChunkData(chunk);
}
}
if (cueChunkData != null && listChunkData != null)
{
cueList = new CueList(cueChunkData, listChunkData);
}
return cueList;
}