c#语音通讯(局域网)

.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);
            }
        }

 

 

推荐一个七夕福利——女朋友3D魔方相册

https://www.cnblogs.com/wl192/p/11511200.html

posted @ 2019-12-13 12:06  漫漫步子  阅读(1747)  评论(9编辑  收藏  举报