# Developing PM123 Plug-ins

PM123 supports four kinds of plug-ins: visual, decoder, output and filter. Visual plug-ins are used to peek at the data currently being heard (or not) by the user through the output plug-in and visually produce data from it back to the user. Decoder plug-ins are used to decode different types of files, tracks or streams the user can play. Output plug-ins is the final destination of the decoded data. It can be rerouted to a sound card, to the hard disk or anywhere else appropriate. The data is in standard PCM format. Filter plug-ins are chained between the decoder and the output plug-in to modify the PCM data before getting to the output plug-in.

Visual plug-in interface has not been changed since version 1.0, eventhough they could be ameliorated in the future. Currently, Visual plug-ins allow the creation of internal or external windows and they can tap into PM123 in several ways: they can retrieve currently playing samples, control PM123 and so on. Plug-ins are Dynamic Linked Libraries, DLLs, which PM123 loads on use. Note that visual plug-ins cannot be loaded via PM123's Properties dialog because they are skin specific. They can of course be loaded when loading a new skin.

plugin.h contains the necessary structures for all pm123 plug-ins. A plug-in must have a function that identifies it as a plug-in:

         void DLLENTRY plugin_query( PPLUGIN_QUERYPARAM param );

The plug-in will then have to fill the variables in the param structure, for example:

         param->type         = PLUGIN_VISUAL;
         /* Identify the plug-in as visual plug-in. Types can be ORred to
            include multiple plug-in types in the same DLL. */

         param->author       = "Matti Meikäläinen";
          /* Author of the plug-in */

         param->desc         = "Example plug-in";
          /* A short description of the plug-in */

         param->configurable = TRUE;
          /* Toggles plug-in configurability via PM123 Properties dialog */

If you set param->configurable = TRUE, configuration dialog should appear when PM123 calls

         void DLLENTRY plugin_configure( HWND hwnd, HMODULE module );

where hwnd is the notebook or player window so that you can "lock" your window on it if you want and where module can be used to load a resource from your DLL

Now, which type of plug-in to you want to program?

- Visual Plug-ins
- Decoder Plug-ins
- Output Plug-ins
- Filter Plug-ins

## PM123 Coding Convention

To make it easier for us to read each other's code, here are a few guidelines to follow when writing C/C++ code.

- Programming Style Guidelines