public DDHash(byte[] data) { // SHA-512_128 byte[] hash = SCommon.GetSHA512(data); this.Hi = ((ulong)hash[0] << 56) | ((ulong)hash[1] << 48) | ((ulong)hash[2] << 40) | ((ulong)hash[3] << 32) | ((ulong)hash[4] << 24) | ((ulong)hash[5] << 16) | ((ulong)hash[6] << 8) | ((ulong)hash[7] << 0); this.Lw = ((ulong)hash[8] << 56) | ((ulong)hash[9] << 48) | ((ulong)hash[10] << 40) | ((ulong)hash[11] << 32) | ((ulong)hash[12] << 24) | ((ulong)hash[13] << 16) | ((ulong)hash[14] << 8) | ((ulong)hash[15] << 0); }
public int GetHandle(int handleIndex) { if (this.Handles == null) { this.Handles = new int[this.HandleCount]; { byte[] fileData = this.Func_GetFileData(); int handle = -1; #if false // SetLoop*SamplePosSoundMem が正常に動作しない。@ 2021.4.30 using (WorkingDir wd = new WorkingDir()) { string file = wd.MakePath(); File.WriteAllBytes(file, fileData); handle = DX.LoadSoundMem(file); } #else DDSystem.PinOn(fileData, p => handle = DX.LoadSoundMemByMemImage(p, fileData.Length)); // DxLibDotNet3_22c で正常に動作しない。@ 2021.4.18 #endif if (handle == -1) // ? 失敗 { throw new DDError("Sound File SHA-512: " + SCommon.Hex.ToString(SCommon.GetSHA512(fileData))); } this.Handles[0] = handle; } for (int index = 1; index < this.HandleCount; index++) { int handle = DX.DuplicateSoundMem(this.Handles[0]); if (handle == -1) // ? 失敗 { throw new DDError(); } this.Handles[index] = handle; } this.PostLoaded(); foreach (Action routine in this.PostLoaded2) { routine(); } } return(this.Handles[handleIndex]); }