Announcement

Collapse
No announcement yet.

How to use winamp plugin in java?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to use winamp plugin in java?

    I used JNA to map the plugin functions and variables.

    This is my plugin class:

    code:
    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:

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

    This is winampDSPModule class:

    code:
    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;

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

    }
    }

    This is my main class:

    code:
    public class Test{
    public static void main(String[] args){
    JFrame f = new JFrame();
    f.setTitle("asd");
    f.setVisible(true);
    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");
    module.Init.invoke(module);
    }
    }

    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?

  • #2
    code:
    module.hwndParent = null;
    Originally Posted by ChenJianFeng View Post
    ... But it is not responding when i clicked on it. ...
    By the way you described your results and the fact you assigned NULL to the hwndParent member it appears that the Java environment you are trying to load the plugin inside of doesn't supply the Windows API and/or Winamp API emulation the DSP requires to operate properly. What are you trying to accomplish?
    | Opus Audio Codec plugins 2.0 | Embedded Album Art | DiskWrite |
    | Save your playlist first! | Live voice-over | X-Fade 2.5 |
    | AterKast (Source DSP) | More of my stuff... |

    Comment


    • #3
      What should i have it assigned to?

      Comment


      • #4
        Originally Posted by ChenJianFeng View Post
        What should i have it assigned to?
        Something probably not available in the Java environment, an actual window handle generated by the Windows Operating System that supplies/implements the Winamp main window API and all other associated Winamp API's that the DSP plugin could possibly use.

        And since the DSP plugin is making a window, that means that the Java environment needs to supply a window message pump and associated Windows API for the handling of that Window, which is also probably not available from the Java environment. All of which probably WAY well beyond the scope of these forums.
        | Opus Audio Codec plugins 2.0 | Embedded Album Art | DiskWrite |
        | Save your playlist first! | Live voice-over | X-Fade 2.5 |
        | AterKast (Source DSP) | More of my stuff... |

        Comment

        Working...
        X
        😀
        🥰
        🤢
        😎
        😡
        👍
        👎