.NET的音頻處理類庫 NAudio
是一款開源的用於.NET平台下的音頻處理類庫,提供了很多方法來操控音頻數據。
NAudio類庫可在在VS2015版本上NuGet包下載並引用到項目中。
可參照語音錄制,地址https://www.cnblogs.com/wl192/p/11231008.html
NAudio文檔及源碼:https://github.com/naudio/NAudio

通過輸入IP,建立鏈接,已編譯成插件,前端可調用

每次接通都會自動錄音,放入目錄文件夾

聲音效果還不錯,音量調大后會有些許雜音,但不影響通話交流。。
——————---------
通過反射加載插件
/// <summary>
/// 加載所有插件
/// </summary>
private void LoadPlugins()
{
try
{
//獲取Plugins目錄文件
string[] PluginFiles = System.IO.Directory.GetFiles(Application.StartupPath + @"\Plugins");
foreach (string PluginFile in PluginFiles)
{
//dll文件才是有效的插件程序集
if (PluginFile.ToUpper().EndsWith(".DLL"))
{
//通過反射加載dll程序集
System.Reflection.Assembly Ab = System.Reflection.Assembly.LoadFrom(PluginFile);
//獲取加載的dll程序集里面的類名稱
Type[] Types = Ab.GetTypes();
foreach (Type T in Types)
{
if (T.FullName == "Communications.Plugins.FormAnswer")
{
PluginAnswer = Ab.CreateInstance("Communications.Plugins.FormAnswer");
PluginMethodAnswerShow = T.GetMethod("AnswerShow");
PluginMethodAnswerCallback = T.GetMethod("Callback");
}
if (T.FullName == "Communications.Plugins.FormCall")
{
PluginCall = Ab.CreateInstance("Communications.Plugins.FormCall");
PluginMethodCall = T.GetMethod("Call");
PluginMethodCallCallback = T.GetMethod("Callback");
}
}
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
