FMT fmt=new FMT(); public void ReadFmtHeader() { fmt.s_Sub_Chunk_ID_1 = reader.ReadBytes(4); fmt.ui_Sub_Chunk_Size_ID_1 = reader.ReadBytes(4); fmt.us_Audio_Format = reader.ReadBytes(2); fmt.us_Num_Channels = reader.ReadBytes(2); fmt.ui_Sample_Rate = reader.ReadBytes(4); fmt.ui_Byte_Rate = reader.ReadBytes(4); fmt.us_Block_Align = reader.ReadBytes(2); fmt.us_Bits_Per_Sample = reader.ReadBytes(2); if (Convert.ToInt32(fmt.ui_Sub_Chunk_Size_ID_1) == 18)// Exception thrown on this line { // Read any extra values int fmtExtraSize = reader.ReadInt16(); reader.ReadBytes(fmtExtraSize); } }
解决方法
你不能使用Convert.ToInt32将byte []转换为int;你需要
use a
BitConverter
.
原文地址:https://www.jb51.cc/csharp/92001.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。