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

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

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ⅴ片 | 天天干天天舔天天射 | 日韩中出在线 | 亚洲ol| 午夜视频在线观看www中文 | 啪啪免费网| 亚洲精品在线观看91 | 香蕉久久夜色精品国产小说 | 欧美一级视频精品观看 | 色播五月激情 | 视频在线观看40分钟免费 | 色免费视频 | 一级做a爰性视频 | 在线香蕉 | 中国日韩欧美中文日韩欧美色 | 天堂在线资源网 | 又大又粗又长又硬好爽国产 | 在线亚洲精品中文字幕美乳 | 啪视频免费 | 手机在线看片日韩 | 亚洲日本欧美日韩高观看 | 一区二区三区久久 | 欧美污视频 | 天天久久 | 婷婷爱爱 | 中文字幕人成乱在线视频 | 中文字幕日韩在线一区国内 | 综合久久久久综合体桃花网 | 天天躁夜夜躁狠狠躁躁 | 日本成人小视频 | 天堂a| 天天插天天操天天射 | 最新天堂网 | 午夜影院私人 | 特黄一级视频 | 网络色综合久久 | 亚洲日本欧美日韩高观看 | 手机在线看片国产日韩生活片 | 亚洲第一黄 | 天天爱天天做色综合 | 在线看欧美日韩中文字幕 |