Plugin development tutorial
From LMMS Wiki
So, you finally decided to contribute a plugin to LMMS! That's cool! First of all, you should read the sourcecode of one of the provided plugins. Preferably the one that resembles your planned plugin at most. Nevertheless, you will find information on the plugin structure here.
Contents |
Required skills
- C++/C
- some experiences with Trolltech's Qt
- basic DSP knowledge
Methods
...
Plugin meta data
Your plugin has to define a plugin meta data structure in the following style:
extern "C"
{
plugin::descriptor YourPluginNameHere_plugin_descriptor =
{
STRINGIFY_PLUGIN_NAME( PLUGIN_NAME ),
"YourPluginNameHere",
QT_TRANSLATE_NOOP( "pluginBrowser",
"YourPluginDescriptionHere" ),
"YourNameHere <YourEmailAdressHere>",
0x0100,
plugin::INSTRUMENT,
PLUGIN_NAME::findEmbeddedData( "logo.png" )
} ;
}
Note: This should be in the source (.cpp) file of your plugin.
plugin callback
LMMS can find your plugin only if you have the following C-style code in your class file. This code is called by LMMS everytime a new instance of the plugin is created.
extern "C"
{
// neccessary for getting instance out of shared lib
plugin * lmms_plugin_main( void * _data )
{
return( new yourInstrumentClassNameHere( static_cast<channelTrack *>( _data ) ) )
}
}
Note: This is in the source (.cpp) file for your plugin
Makefiles
- copy Makefile.am from another plugin to in your plugin-directory and edit it to fit your needs
- Edit the Makefile.am in the plugin-base-directory. Add your plugin-directory to the statement "SUBDIRS = "
- Edit configure.in in lmms-base-directory and add your Makefile to the AC_CONFIG_FILES-list
- Run aclocal, autoconf and automake in the lmms-base-directory
- Run configure, make and make install
Artwork
Create two PNG files. One called "logo.png" which will be displayed as plugin logo in the plugin browser. The other is "artwork.png" which will be the background/wallpaper for your plugin.
Hints
- do NOT give the plugin and the class the same name as this causes conflicts of your classname and your plugin namespace - of course you can use compiler's case-sensitivity, e.g. PLUGIN_NAME in Makefile.am is "myplugin" and your class is called "myPlugin"