六月婷婷综合激情-六月婷婷综合-六月婷婷在线观看-六月婷婷在线-亚洲黄色在线网站-亚洲黄色在线观看网站

明輝手游網中心:是一個免費提供流行視頻軟件教程、在線學習分享的學習平臺!

C#取得WAVE文件文件頭信息

[摘要]using System;using System.IO;using System.Text; namespace WAV /// <summary> /// Summary description for Wav. /// </summary> p...
using System;

using System.IO;

using System.Text;



namespace 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>0)

            {

                strpath=args[0].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 groupid;

            public string rifftype;

            public long filesize;

            public string chunkid;

            public long chunksize;



            public short wformattag; //記錄著此聲音的格式代號,例如WAVE_FORMAT_PCM,WAVE_F0RAM_ADPCM等等。

            public ushort wchannels; //記錄聲音的頻道數。

            public ulong  dwsamplespersec;//記錄每秒取樣數。

            public ulong  dwavgbytespersec;//記錄每秒的數據量。

            public ushort wblockalign;//記錄區塊的對齊單位。

            public ushort wbitspersample;//記錄每個取樣所需的位元數。



            public string datachunkid;

            public 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>=44)

            {

                byte[] bInfo=new byte[44];

                fs.Read(bInfo,0,44);

                

                System.Text.Encoding.Default.GetString(bInfo,0,4);

                if(System.Text.Encoding.Default.GetString(bInfo,0,4)=="RIFF"&&System.Text.Encoding.Default.GetString(bInfo,8,4)=="WAVE"&&System.Text.Encoding.Default.GetString(bInfo,12,4)=="fmt ")

                {

                    wavInfo.groupid = System.Text.Encoding.Default.GetString(bInfo,0,4);

                    System.BitConverter.ToInt32(bInfo,4);

                    wavInfo.filesize = System.BitConverter.ToInt32(bInfo,4);

                        

                    //wavInfo.filesize = Convert.ToInt64(System.Text.Encoding.Default.GetString(bInfo,4,4));

                    wavInfo.rifftype = System.Text.Encoding.Default.GetString(bInfo,8,4);

                    wavInfo.chunkid = System.Text.Encoding.Default.GetString(bInfo,12,4);

                    wavInfo.chunksize = System.BitConverter.ToInt32(bInfo,16);

                    wavInfo.wformattag = System.BitConverter.ToInt16(bInfo,20);

                    wavInfo.wchannels = System.BitConverter.ToUInt16(bInfo,22);

                    wavInfo.dwsamplespersec = System.BitConverter.ToUInt32(bInfo,24);

                    wavInfo.dwavgbytespersec = System.BitConverter.ToUInt32(bInfo,28);

                    wavInfo.wblockalign = System.BitConverter.ToUInt16(bInfo,32);

                    wavInfo.wbitspersample = System.BitConverter.ToUInt16(bInfo,34);

                    wavInfo.datachunkid = System.Text.Encoding.Default.GetString(bInfo,36,4);

                    wavInfo.datasize = System.BitConverter.ToInt32(bInfo,40);



                    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);



                }

            }

        }

    }

}


主站蜘蛛池模板: 日本高清在线观看视频你懂的 | 欧美午夜视频一区二区 | 日本国产免费一区不卡在线 | 亚洲成a人| 日韩欧美亚洲一区 | 图片区偷拍区小说区 | 欧美在线视频不卡 | 亚洲成在人线中文字幕 | 青青青手机在线视频 | 亚洲处破女网站 | 日本最新免费二区 | 天天操天天干天天透 | 色播放 | 又粗又硬又爽的三级视频 | 日韩免费福利视频 | 青青青久久久 | 午夜视频福利在线 | 中文字幕精品波多野结衣 | 亚洲国产高清在线精品一区 | 一区精品麻豆入口 | 日韩三级欧美 | 午夜网站在线观看免费网址免费 | 亚洲第五页 | 中文字幕日韩在线观看 | 天堂网在线网站成人午夜网站 | 亚洲福利视频网 | 亚洲91在线 | 性久久久久久久 | 无需付费免费mv网站 | 天天怕夜夜怕狠狠怕 | 一区二区三区国产美女在线播放 | 四虎成人免费网址在线 | 日本精品a在线观看 | 性欧美xxx极品另类 性欧美xxxx性 | 中文字幕激情视频 | 欧美综合亚洲图片综合区 | 四虎2020| 四虎永久在线观看免费网站网址 | 欧美亚洲图区 | 人人色在线视频播放 | 亚洲综合亚洲综合网成人 |