4

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

如果我能找到这些,我认为最简单:

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

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

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

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

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

4

2 回答 2

4

我最终只使用了一些功能,但如果有人不想做这项工作,这是我写的:

    [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,或者大多数开源项目似乎使用的其他编译器(我都不熟悉)。再次,幸运的是,它没有!

于 2012-06-07T22:36:28.243 回答
1

Speex 是用 C 语言编写的,并且具有导出功能。我只是自己下载了源代码并查看了。在此处下载源代码,然后从那里访问 http://www.speex.org/downloads/。它看起来相当广泛,......快乐的编码。

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

http://nspeex.codeplex.com/

于 2012-05-31T03:23:17.913 回答