怎么在WAVE里面加入单片机头文件

怎么在WAVE里面加入单片机头文件,第1张

解决方法有两个:

1,你直接把头文件加到WAVE的安装文件夹里的include里面

2,你也可以将需要用到的头文件放到你的工程里面,然后将那个#include<c8051f040.h>改为#include"c8051f040.h",讲<>改为"",则编译的时候会默认为这个头文件是你自己建立的,它会自动在你的工程文件夹里面寻找。

using Systemusing System IOusing System Textnamespace WAV{/// <summary>/// Summary description for Wav /// </summary>public class Wav{public Wav(){   //// TODO: Add constructor logic here//}[STAThread]static void Main(string[] args){//// TODO: Add code to start application here//string strpath=@ C:\Documents and Settings\Administrator\桌面\trojan\怀念战友 wav //=@ F:\Music if(args Length>){ strpath=args[ ] Trim()}if(File Exists(strpath)){   GetWavInfo(strpath)Console WriteLine( GetWavInfo Successfully! )//Console WriteLine( )}else{   Console Write( Please Enter the write filepath!\n )Console Write( 用法: WAV [Full Path Of Your WAV filepath] )}}public struct WavInfo{  public string groupidpublic string rifftypepublic long filesizepublic string chunkidpublic long chunksizepublic short wformattag//记录著此声音的格式代号 例如WAVE_FORMAT_PCM WAVE_F RAM_ADPCM等等 public ushort wchannels//记录声音的频道数 public ulong  dwsamplespersec//记录每秒取样数 public ulong  dwavgbytespersec//记录每秒的数据量 public ushort wblockalign//记录区块的对齐单位 public ushort wbitspersample//记录每个取样所需的位元数 public string datachunkidpublic long datasize}public static void GetWavInfo(string strpath){WavInfo wavInfo = new WavInfo()FileInfo fi = new FileInfo(strpath)System IO FileStream fs=fi OpenRead()if(fs Length>= ){byte[] bInfo=new byte[ ]fs Read(bInfo )System Text Encoding Default GetString(bInfo )if(System Text Encoding Default GetString(bInfo )== RIFF &&System Text Encoding Default GetString(bInfo )== WAVE &&System Text Encoding Default GetString(bInfo )== fmt ){wavInfo groupid = System Text Encoding Default GetString(bInfo )System BitConverter ToInt (bInfo )wavInfo filesize = System BitConverter ToInt (bInfo )//wavInfo filesize = Convert ToInt (System Text Encoding Default GetString(bInfo ))wavInfo rifftype = System Text Encoding Default GetString(bInfo )wavInfo chunkid = System Text Encoding Default GetString(bInfo )wavInfo chunksize = System BitConverter ToInt (bInfo )wavInfo wformattag = System BitConverter ToInt (bInfo )wavInfo wchannels = System BitConverter ToUInt (bInfo )wavInfo dwsamplespersec = System BitConverter ToUInt (bInfo )wavInfo dwavgbytespersec = System BitConverter ToUInt (bInfo )wavInfo wblockalign = System BitConverter ToUInt (bInfo )wavInfo wbitspersample = System BitConverter ToUInt (bInfo )wavInfo datachunkid = System Text Encoding Default GetString(bInfo )wavInfo datasize = System BitConverter ToInt (bInfo )System Console WriteLine( groupid: +wavInfo groupid)System Console WriteLine( filesize: +wavInfo filesize)System Console WriteLine( rifftype: +wavInfo rifftype)System Console WriteLine( chunkid: +wavInfo chunkid)System Console WriteLine( chunksize: +wavInfo chunksize)System Console WriteLine( wformattag: +wavInfo wformattag)System Console WriteLine( wchannels: +wavInfo wchannels)System Console WriteLine( dwsamplespersec: +wavInfo dwsamplespersec)System Console WriteLine( dwavgbytespersec: +wavInfo dwavgbytespersec)System Console WriteLine( wblockalign: +wavInfo wblockalign)System Console WriteLine( wbitspersample: +wavInfo wbitspersample)System Console WriteLine( datachunkid: +wavInfo datachunkid)System Console WriteLine( datasize: +wavInfo datasize)}}}}} lishixinzhi/Article/program/net/201311/11870


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/tougao/11783499.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-18
下一篇 2023-05-18

发表评论

登录后才能评论

评论列表(0条)

保存