aboutsummaryrefslogtreecommitdiff
path: root/doc/APIdoc.md
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2016-12-27 23:15:15 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2016-12-27 23:15:15 +0800
commitb79c4b7e3cab3711e87ba9e28fa8423a84ea7efa (patch)
treee9a98458ab26d7fb776e39a7d600f2a1b032065e /doc/APIdoc.md
parent717067493346bd51dc6f13a6f1ea307ca35bcc2c (diff)
downloadQMidiPlayer-b79c4b7e3cab3711e87ba9e28fa8423a84ea7efa.tar.xz
First official version with experimental support for the visualization plugin on Windows.0.8.3-2
Fixed several critical bugs causing the plugin to crash QMP.
Diffstat (limited to 'doc/APIdoc.md')
-rw-r--r--doc/APIdoc.md47
1 files changed, 47 insertions, 0 deletions
diff --git a/doc/APIdoc.md b/doc/APIdoc.md
new file mode 100644
index 0000000..043c1c0
--- /dev/null
+++ b/doc/APIdoc.md
@@ -0,0 +1,47 @@
+# The API documentation of QMidiPlayer for plugin developers
+
+*This manual is not yet complete. It's only a working draft for the always-changing plugin system in QMP.*
+*Handle with care.*
+
+# 0. Overview
+
+Plugin for QMidiPlayer is a dynamically-loaded library that exports the symbol "qmpPluginGetInterface".
+Before starting developing your own plugin, make sure to have a look at the sample plugin in the "sample-plugin" folder.
+
+# 1. "QMidiPlayer Plugin SDK"
+
+SDK for developing QMidiPlayer plugins is merely the "qmpcorepublic.hpp" header found in the "include" directory in
+the source tree. It includes classes used by QMidiPlayer's internal plugin infrastructure.
+
+# 2. Basics for a working plugin.
+
+First of all, you should make your library distinct from other libraries that are not QMidiPlayer plugins. You can achive
+it by exporting the symbol "qmpPluginGetInterface". Specifically, what you should do is to add the following snipplet to
+somewhere of your code:
+
+> extern "C"{
+> EXPORTSYM qmpPluginIntf* qmpPluginGetInterface(qmpPluginAPI* api)
+> //semicolon or implementation here.
+> }
+
+The EXPORTSYM macro tells the compiler to export the following symbol. qmpPluginIntf is the abstract class which every
+plugin class should derive from. The parameter api provides access to QMidiPlayer's plugin API, which should be stored
+for future use.
+
+Next you should create your own plugin class which implements the abstract class "qmpPluginIntf".
+
+# 3. A Peek into the class "qmpPluginIntf"
+
+It has 6 public members: one default constructor, one default destructor and four methods:
+
+- void init()
+ Called on start up if the plugin is loaded successfully and enabled.
+- void deinit()
+ Called on shutdown if the plugin is enabled.
+- const char* pluginGetName()
+ This function should return the display name of the plugin.
+- const char* pluginGetVersion()
+ This function should return the version of the plugin, which will be shown in the plugin manager.
+
+Your plugin is expected to register handlers and functionalities when init() is called by the host,
+and do clean-up jobs when deinit() is caled.