标签:
1 private void showWAVForm(string filepath) 2 { 3 FileStream fs = new FileStream(filepath,FileMode.Open); 4 fs.Read(new byte[42],0,42); 5 byte[] datasize = new byte[4]; 6 fs.Read(datasize,0,4); 7 int dtsize = hex2Int(datasize); //数据块部分数据的字节数 8 for (int i = 0; i < dtsize/2; i++) 9 { 10 byte[] byt = new byte[2]; 11 fs.Read(byt, 0, 2); 12 int dt = (byt[0] & 255) | (((int)byt[1]) << 8); 13 Console.WriteLine(dt); 14 } 15 fs.Close(); 16 } 17 18 private int hex2Int(byte[] hex) 19 { 20 return hex[0] | (hex[1] << 8) | (hex[2] << 16) | (hex[3] << 24);//十六进制转为十进制 21 }
标签:
原文地址:http://www.cnblogs.com/144823836yj/p/5961967.html