[英]How to assign or pass byte array to MWArray?
我正在嘗試將byts的MWArray傳遞給函數。 字節數組從mp3文件獲取數據。
現在,我想將字節數組分配給MWArray。
我的代碼是這樣的
string lSongFilePath = ConfigurationManager.AppSettings["SongFilePath"].ToString();
lSongFilePath += "\\" + "Grand Piano - Fazioli - major A.wav";
FileStream fs = File.OpenRead(lSongFilePath);
try
{
byte[] bytes = new byte[fs.Length];
var read = (fs.Read(bytes, 0, Convert.ToInt32(fs.Length)));
MWArray[] in_Arr = new MWArray[(int)read];
MWArray[] out_Arr = null;// = new MWArray[15];
ChordRecognizer hj = new ChordRecognizer();
hj.estimateTuning(4,ref out_Arr, in_Arr);
fs.Close();
}
catch(Exception ex)
{
string s = ex.Message;
}
這行僅提及數組的大小,而我也想將數據分配給數組。 請幫忙
MWArray[] in_Arr = new MWArray[(int)read];
不需要,但FWIW,當組合目錄路徑和文件名以獲取完整文件路徑時,應使用Path.Combine
由於要將整個文件讀入字節數組,因此可以使用File.ReadAllBytes
我在查找一個可以記錄MWArray在C#代碼中的外觀的位置時遇到了麻煩-特別是從字節數組創建它。 如果您有一個指向如何為單個字節值構造它的指針,我們可以從那里弄清楚。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.