aboutsummaryrefslogtreecommitdiff
path: root/include/qmpcorepublic.hpp
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2016-04-27 23:45:24 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2016-04-27 23:45:24 +0800
commit8eac5088101595422753030b1b259411d63f83a8 (patch)
tree43c4c3e9b92657bbf6c7c55cf75d297ec85a5b7f /include/qmpcorepublic.hpp
parentdfcc193d4070c99bf217ac74a492160968dba766 (diff)
downloadQMidiPlayer-8eac5088101595422753030b1b259411d63f83a8.tar.xz
Handle pitch bend in visualization.
Handle mute and solo in the default visualization. Show file name in window title. A little plugin sdk documentaion... Remove stupid things.
Diffstat (limited to 'include/qmpcorepublic.hpp')
-rw-r--r--include/qmpcorepublic.hpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/include/qmpcorepublic.hpp b/include/qmpcorepublic.hpp
index 8c67562..a8e3fa8 100644
--- a/include/qmpcorepublic.hpp
+++ b/include/qmpcorepublic.hpp
@@ -2,11 +2,15 @@
#define QMPCOREPUBLIC_H
#include <cstdint>
#include <string>
+//This struct is used by event reader callbacks and event handler callbacks
+//as caller data struct
struct SEventCallBackData
{
uint32_t time,type,p1,p2;
SEventCallBackData(uint32_t _t,uint32_t _p1,uint32_t _p2,uint32_t _tm){type=_t;p1=_p1;p2=_p2;time=_tm;}
};
+//Generic callback function that can be used for hooking the core.
+//"userdata" is set when you register the callback function.
class IMidiCallBack
{
public:
@@ -14,6 +18,7 @@ class IMidiCallBack
virtual void callBack(void* callerdata,void* userdata)=0;
virtual ~IMidiCallBack(){}
};
+//Main plugin interface.
class qmpPluginIntf
{
public:
@@ -24,6 +29,8 @@ class qmpPluginIntf
virtual const char* pluginGetName(){return "";}
virtual const char* pluginGetVersion(){return "";}
};
+//Visualization plugin interface. If your plugin implements a visualization,
+//you should implement this interface.
class qmpVisualizationIntf
{
public:
@@ -36,7 +43,11 @@ class qmpVisualizationIntf
virtual void reset()=0;
virtual ~qmpVisualizationIntf(){}
};
+#ifdef QMP_MAIN
extern "C"{
+#endif
+//The API class provided by the core. Plugins use this class to interact with
+//the core.
class qmpPluginAPI
{
public:
@@ -49,6 +60,9 @@ class qmpPluginAPI
virtual uint32_t getCurrentPolyphone();
virtual uint32_t getMaxPolyphone();
virtual uint32_t getCurrentTimeStamp();
+ virtual double getPitchBend(int ch);
+ virtual bool getChannelMask(int ch);
+ virtual std::string getTitle();
virtual int registerVisualizationIntf(qmpVisualizationIntf* intf);
virtual void unregisterVisualizationIntf(int intfhandle);
virtual int registerEventReaderIntf(IMidiCallBack* cb,void* userdata);
@@ -62,6 +76,13 @@ class qmpPluginAPI
virtual void registerOptionString(std::string desc,std::string key,std::string defaultval);
virtual std::string getOptionString(std::string key);
};
+#ifdef QMP_MAIN
}
+#endif
+//The entry type for the plugin. Your plugin should implement
+//qmpPluginIntf* qmpPluginGetInterface(qmpPluginAPI* api)
+//as its entry point. A pointer to the core API is also passed to the plugin
+//through the parameter. This function should return a pointer to a class
+//that implementes the plugin interface (qmpPluginIntf).
typedef qmpPluginIntf*(*qmpPluginEntry)(qmpPluginAPI*);
#endif // QMPCOREPUBLIC_H