在C#中使用speex预处理器的最简单方法是什么?

时间:2012-05-31 02:58:14

标签: c# speex

我需要使用speex预处理器,并且只使用我的VOIP应用程序中的预处理器(不需要使用编解码器)。我的应用程序是用C#编写的。我想我知道最简单的步骤,但不知道在哪里可以找到这些物品。

在我看来最容易,如果我能找到这些:

  1. 仅包含预处理器功能的Windows DLL,或者如果尺寸足够小,我猜整个speex库都可以。到目前为止,我只发现了EXE格式的二进制文件,所以如果我找不到二进制文件,我必须安装它们用于构建源代码的编译器,可能还有其他几个库(这是我对大多数开源构建的体验) )。

  2. 头文件的C#版本,用于调整DLL函数。

  3. 所以我的问题是,有谁知道我在哪里可以找到这些?我相信人们之前已经创建了这些,基于大量的speex用户,只是无法找到任何在线。

    希望人们不要以为我很懒,我只是讨厌做这种“忙碌的工作”,如果我知道很多其他人可能已经完成了同样的事情:)

    更新:我确实发现http://www.rarewares.org/files/others/libspeex-dll-1.2rc1.zip包含libspeex.dll,但DLL没有导出,所以不确定他们希望如何工作。他们拥有的其他二进制文件也只是EXE。

2 个答案:

答案 0 :(得分:2)

我最后只使用了一些功能,但是任何人都不想做这项工作,这就是我写的:

    [DllImportAttribute("libspeexdsp.dll")]
    public static extern IntPtr speex_echo_state_init(int frameSize,int filterLength);

    [DllImportAttribute("libspeexdsp.dll")]
    public static extern void speex_echo_state_destroy(IntPtr st);

    [DllImportAttribute("libspeexdsp.dll")]
    public static extern void speex_echo_cancellation(IntPtr st, IntPtr recorded, IntPtr played, IntPtr echoRemoved);

    [DllImportAttribute("libspeexdsp.dll")]
    public static extern void speex_echo_playback(IntPtr st, IntPtr played);

    [DllImportAttribute("libspeexdsp.dll")]
    public static extern void speex_echo_capture(IntPtr st, IntPtr recorded, IntPtr echoRemoved);

    [DllImportAttribute("libspeexdsp.dll")]
    public unsafe static extern int speex_echo_ctl(IntPtr st, int id, ref IntPtr val);

    [DllImportAttribute("libspeexdsp.dll")]
    public static extern IntPtr speex_preprocess_state_init(int frameSize, int sampleRate);

    [DllImportAttribute("libspeexdsp.dll")]
    public static extern int speex_preprocess_ctl(IntPtr st, int id, IntPtr val);

    [DllImportAttribute("libspeexdsp.dll")]
    public static extern int speex_preprocess_run(IntPtr st, IntPtr recorded);

    [DllImportAttribute("libspeexdsp.dll")]
    public static extern void speex_preprocess_state_destroy(IntPtr st);

我想我很幸运,因为delcare没有很多结构,大多数都是IntPtr或int,所以很容易。

就找到二进制文件而言,我没有在任何地方找到它们进行预编译,但是源代码确实包含了VS解决方案文件,这些文件仅使用了几个小的更改进行编译,因此我想这部分对于使用C#的人来说非常容易,因为他们无论如何都会使用VS.出于某种原因,我认为它需要一些其他编译器,如GCC,或大多数开源项目似乎使用的其他编译器(我都不熟悉)。幸运的是,它没有!

答案 1 :(得分:1)

Speex写的是C,它有出口。我刚刚自己下载了源代码并查看了。在这里下载源代码,然后从http://www.speex.org/downloads/开始。它看起来相当广泛,...编码愉快。

当然,有这个,但它仍处于测试阶段:

http://nspeex.codeplex.com/

相关问题