以MELP为例子讲解C语言生成dll的方法.doc

  1. 1、本文档共25页,可阅读全部内容。
  2. 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
以MELP为例子讲解C语言生成dll的方法

1、有哪些信誉好的足球投注网站下载解压缩melp的C语言源程序 http://health.tau.ac.il/Communication%20Disorders/noam/speech/melp/Download/Download.htm 2、打开Visual Studio 2010,新建一个工程 接下来弹出如下界面,点击OK 选择Next 选择Application type DLL,最后点击Finish 3、建立MELP工程,首先删除不需要的MELP.cpp文件,也可以不删除的。 打开该工程所在的文件夹 弹出如下界面 复制第一步下载解压缩的MELP的源代码到本工程的目录。如下图。 4、添加上一步的文件到工程 弹出如下界面,全选所有的文件,然后放弃图中标示的那三项,点击Add 添加完毕后就会如下图所示了,然后双击打开melp.h文件,和melp.c文件,这是我们需要更改的两个程序,其他都不需要改变的。 5、对melp.h文件的添加,打开melp.h,把如下程序写入到原始文件的最下面 #ifndef LIB_H #define LIB_H extern _declspec(dllexport) void cmd_melp(int argc, char **argv); extern _declspec(dllexport) void melp_encoder_ini(); extern _declspec(dllexport) void melp_encoder( short speechIn720[], char result27[]); extern _declspec(dllexport) void melp_encoder720s( short speechIn720s[], int times, char result27s[]); extern _declspec(dllexport) void melp_decoder_ini(); extern _declspec(dllexport) void melp_decoder( char inChar27[], short *speechOut720); extern _declspec(dllexport) void melp_decoder27s( char inChar27s[], int times, short *speechOut720s); #endif 添加完毕后,如下图所示 关于上述文件添加的原因,可以参见如下的博客/bubifengyun/blog/96252 6、对melp.c文件的修改和添加 先修改melp.h的位置 添加melp.h文件中声明函数的函数体。全部代码如下 void cmd_melp(int argc, char **argv) { main(argc,argv); } void byte36Tobyte27(char* in36,char*out27) { /* because 6 bits of a byte was used, so we can delete such bits. do as follow: the first 3*9 bytes was the original bytes. the last 1*9 bytes,was adding to the head*/ char*in=in36; char inTem; char*out=out27; /* copy the 3*9 bytes */ int n=27; while(n--) { *out++=*in++; } /* return the output*/ out=out27; n=9; while(n--) { inTem=*in++; *out=(*out)|((inTem0x30)2); out++; *out=(*out)|((inTem0x0C)4); out++; *out=(*out)|((inTem0x03)6); out++; } } void byte27Tobyte36(char* in27,char*out36) { /* because 6 bits of a byte was used, so we can delete such bits. do as follow: the first 3*9 bytes was the original bytes. the last 1*9 bytes,was adding to the head*/ char*in=in27; char inTem; char*out=out36;

您可能关注的文档

文档评论(0)

yaobanwd + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档