【发布时间】:2017-06-20 00:43:47
【问题描述】:
我正在尝试将字节数组转换为这样的短裤数组:
Public Sub mixFinal()
Dim patch1Buffer(patch1.Length - 44) As Byte
System.Array.Copy(patch1, 44, patch1Buffer, 0, patch1.Length - 44)
Dim patch1ShortBuffer(patch1Buffer.Length) As Short
For x = 0 To patch1Buffer.Length - 1 Step 1
patch1ShortBuffer(x) = System.BitConverter.ToInt16(patch1Buffer, x)
Next
End Sub
'patch1' 是一个字节数组,它是通过使用 IO.File.ReadAllBytes 方法读取 .wav 文件而创建的。
编译程序时Visual Studio给我这个错误:
Destination array is not long enough to copy all the items in the collection. Check array index and length.
我尝试将 'patch1Buffer' 和 'patch1ShortBuffer' 的大小更改为更高的值,但仍然给出错误...代码有什么问题?
【问题讨论】:
标签: arrays vb.net byte type-conversion