本人应朋友之需要,动手写了一个基于winamp2的音效插件:消歌声处理. 相关的开发文档均来自于winamp的官方网站,如果你对些感兴趣,可访:http://www.winamp.com/来了解关于插件开发的详细资料, 下面我简单地介绍一下dsp(音效)插件的编写.并给出部分源代码,完整的代码请从这里下载:().
#ifndef _winamp_dsp_h_ 【程序编程相关:追根究底,MFC六大关键技术剖析(第三部】
winamp2的插件是一个win32的动态链接库,它位于winamp的安装目录下的plugins目录里,每个插件都符合一定的命名规则,并有一个指定的导出函数.winamp主程序枚举该目录下的这些dll,来确定你安装了哪些插件.winamp的插件有许多种.你打开winamp的插件配置就看到了.音效插件是其中的一种.在winamp中简称为dsp.该类插件winamp规定其命名方式为dsp_*.dll,其中的“*”为你自已定义的一个任意名字.每个dsp插件都导出一个名为“winampdspgetheader2”的函数.它返回一个模块头信息结构的地址.winamp网站给开发者们提供了一个dsp模块的头文件.对该结构及函数作了定义,该头文件名为"dsp.h",内容如下: 【推荐阅读:网络socket学习笔记(1) 】
#if _msc_ver > 1000#pragma once#endif // _msc_ver > 1000 【扩展信息:基于MFC对话框的OpenGL类 】
#define _winamp_dsp_h_
// dsp plugin interface
// notes:// any window that remains in foreground should optimally pass unused// keystrokes to the parent (winamps) window, so that the user// can still control it. as for storing configuration,// configuration data should be stored in <dll directory>\plugin.ini// (look at the vis plugin for configuration code)
typedef struct winampdspmodule { char *description; // description hwnd hwndparent; // parent window (filled in by calling app) hinstance hdllinstance; // instance handle to this dll (filled in by calling app)
void (*config)(struct winampdspmodule *this_mod); // configuration dialog (if needed) int (*init)(struct winampdspmodule *this_mod); // 0 on success, creates window, etc (if needed)
// modify waveform samples: returns number of samples to actually write // (typically numsamples, but no more than twice numsamples, and no less than half numsamples) // numsamples should always be at least 128. should, but im not sure int (*modifysamples)(struct winampdspmodule *this_mod, short int *samples, int numsamples, int bps, int nch, int srate); void (*quit)(struct winampdspmodule *this_mod); // called when unloading
void *userdata; // user data, optional} winampdspmodule;
typedef struct { int version; // dsp_hdrver char *description; // description of library winampdspmodule* (*getmodule)(int); // module retrieval function} winampdspheader;
// exported symbolstypedef winampdspheader* (*winampdspgetheadertype)();
// header version: 0x20 == 0.20 == winamp 2.0#define dsp_hdrver 0x20
#endif /* _winamp_dsp_h_ */
... 下一页