Prev Previous Post   Next Post Next
Old 17th December 2013, 04:19   #1
Junior Member
Join Date: Dec 2013
Posts: 2
How to use winamp plugin in java?

I used JNA to map the plugin functions and variables.

This is my plugin class:

public interface dsp_stereo extends Library{
dsp_stereo INSTANCE = (dsp_stereo) Native.loadLibrary("dsp_stereo", dsp_stereo.class);
public winampDSPHeader winampDSPGetHeader2();

This is winampDSPHeader class:

public class winampDSPHeader extends Structure{
public int version;
public String description;
public static interface getModuleFunc extends Callback{
winampDSPModule invoke(int i);
public getModuleFunc getModule;
protected List getFieldOrder() {
return Arrays.asList(new String[] { "version", "description", "getModule"});

This is winampDSPModule class:

public class winampDSPModule extends Structure{
public String description;
public HWND hwndParent;
public HINSTANCE hDllInstance;
public static interface configFunc extends Callback{
void invoke(winampDSPModule this_mod);
public configFunc Config;
public static interface initFunc extends Callback{
int invoke(winampDSPModule this_mod);
public initFunc Init;
public static interface modifySamplesFunc extends Callback{
int invoke(winampDSPModule this_mod, short[] samples, int numsamples, int bps, int nch, int srate);
public modifySamplesFunc ModifySamples;
public static interface quitFunc extends Callback{
void invoke(winampDSPModule this_mod);
public quitFunc Quit;
public Pointer userData;

protected List getFieldOrder() {
return Arrays.asList(new String[] { "description", "hwndParent", "hDllInstance", "Config", "Init", "ModifySamples", "Quit", "userData"});
public winampDSPModule(){


This is my main class:

public class Test{
public static void main(String[] args){
JFrame f = new JFrame();
f.setSize(300, 400);

dsp_stereo lib = dsp_stereo.INSTANCE;
winampDSPHeader header = lib.winampDSPGetHeader2();
winampDSPModule module = header.getModule.invoke(0);
module.hwndParent = null;
module.hDllInstance = Kernel32.INSTANCE.GetModuleHandle("dsp_stereo");

The plugin appeared when i ran the code. But it is not responding when i clicked on it. Do i missed something on my code?
ChenJianFeng is offline   Reply With Quote
Go Back   Winamp & Shoutcast Forums > Developer Center > Winamp Development

java, player, plugin

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump