gpt4 book ai didi

c# - 无法将类型为 'System.Byte[]' 的对象转换为类型 'System.IConvertible'

转载 作者:太空狗 更新时间:2023-10-29 21:18:35 24 4
gpt4 key购买 nike

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

我正在尝试读取一个 wave 文件,然后使用 header 信息重新创建它并保存到文件中。我不知道是什么问题。有人可以帮我解决这个问题吗?

最佳答案

您不能使用 Convert.ToInt32byte[] 转换为 int;你需要use a BitConverter .

关于c# - 无法将类型为 'System.Byte[]' 的对象转换为类型 'System.IConvertible',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11491547/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com