/// <summary> /// 初始化 /// </summary> /// <param name="deviceId">输出设备ID</param> /// <param name="rate">输出采样率</param> /// <param name="bassInit">初始化模式</param> /// <param name="intPtr">窗体句柄</param> public MusicKernel(int deviceId, int rate, BASSInit bassInit, IntPtr intPtr) { BassNet.Registration("*****@*****.**", "2X34243714232222"); if (!Bass.BASS_Init(deviceId, rate, bassInit, intPtr)) { throw new ApplicationException(" Bass初始化出错! " + Bass.BASS_ErrorGetCode().ToString()); } //初始化DSP DSP.InitDSP(intPtr); PlayEndSync = new SYNCPROC(PlayEnd); StalledSync = new SYNCPROC(Stalled); controlObject.CreateControl(); }
protected virtual void Dispose(bool disposing) { if (disposed) { return; } if (DSPs.Count > 0)//释放所有DSP插件 { for (int i = 0; i < DSPs.Count; i++) { DSPs[i].FreeDSP(); } } if (VSTs.Count > 0)//释放所有VST插件 { for (int i = 0; i < VSTs.Count; i++) { VSTs[i].Dispose(); } } if (BassPlugins.Count > 0) { foreach (BassPlugin item in BassPlugins) { item.Free(); } } DSP.Free(); VST.Free(); Bass.BASS_StreamFree(stream); Bass.BASS_Stop(); //停止 Bass.BASS_Free(); //释放 disposed = true; }