aboutsummaryrefslogtreecommitdiff
path: root/visualization
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2016-04-24 23:47:04 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2016-04-24 23:47:04 +0800
commit800a0417e9ed175f220c472842a283202c77060b (patch)
tree6609fcccf55d176d8eb61aa69526a19ba1859487 /visualization
parentaa8af83ff8889aa136e9152b2cca9a88d99c5f47 (diff)
downloadQMidiPlayer-800a0417e9ed175f220c472842a283202c77060b.tar.xz
Problematic commit...
Diffstat (limited to 'visualization')
-rw-r--r--visualization/qmpvisualization.cpp45
-rw-r--r--visualization/qmpvisualization.hpp36
-rw-r--r--visualization/visualization.pro23
3 files changed, 104 insertions, 0 deletions
diff --git a/visualization/qmpvisualization.cpp b/visualization/qmpvisualization.cpp
new file mode 100644
index 0000000..e8bb9fb
--- /dev/null
+++ b/visualization/qmpvisualization.cpp
@@ -0,0 +1,45 @@
+#include <cstdio>
+#include "qmpvisualization.hpp"
+
+void CTestCallBack::callBack(void *callerdata,void *)
+{
+ if(par->c<3)
+ {
+ SEventCallBackData* cbd=(SEventCallBackData*)callerdata;
+ printf("type %#x p1 %d p2 %d\n",cbd->type,cbd->p1,cbd->p2);
+ }
+}
+
+qmpVisualization::qmpVisualization(qmpPluginAPI* _api)
+{api=_api;}
+qmpVisualization::~qmpVisualization()
+{api=NULL;}
+void qmpVisualization::init()
+{
+ puts("hello world from test plugin!");
+ puts("I'll try to print the first 3 events from the file!");
+ cb=new CTestCallBack(this);c=0;
+ //!!FIXME: not working properly...
+ api->registerEventReaderIntf(cb,NULL);
+}
+void qmpVisualization::deinit()
+{}
+const char* qmpVisualization::pluginGetName()
+{return "QMidiPlayer Default Visualization Plugin";}
+const char* qmpVisualization::pluginGetVersion()
+{return "0.7.8";}
+
+//dummy implementations of the api...
+uint32_t qmpPluginAPI::getDivision(){return 0;}
+uint32_t qmpPluginAPI::getRawTempo(){return 0;}
+double qmpPluginAPI::getRealTempo(){return 0;}
+uint32_t qmpPluginAPI::getTimeSig(){return 0;}
+int qmpPluginAPI::getKeySig(){return 0;}
+uint32_t qmpPluginAPI::getNoteCount(){return 0;}
+uint32_t qmpPluginAPI::getCurrentPolyphone(){return 0;}
+uint32_t qmpPluginAPI::getMaxPolyphone(){return 0;}
+uint32_t qmpPluginAPI::getCurrentTimeStamp(){return 0;}
+int qmpPluginAPI::registerEventHandlerIntf(IMidiCallBack*,void*){return -1;}
+void qmpPluginAPI::unregisterEventHandlerIntf(int){}
+int qmpPluginAPI::registerEventReaderIntf(IMidiCallBack*,void*){return -1;}
+void qmpPluginAPI::unregisterEventReaderIntf(int){}
diff --git a/visualization/qmpvisualization.hpp b/visualization/qmpvisualization.hpp
new file mode 100644
index 0000000..847f37b
--- /dev/null
+++ b/visualization/qmpvisualization.hpp
@@ -0,0 +1,36 @@
+#ifndef QMPVISUALIZATION_H
+#define QMPVISUALIZATION_H
+
+#include "../include/qmpcorepublic.hpp"
+
+class qmpVisualization;
+class CTestCallBack:public IMidiCallBack
+{
+ private:
+ qmpVisualization *par;
+ public:
+ CTestCallBack(qmpVisualization *_par){par=_par;}
+ void callBack(void *callerdata,void *userdata);
+};
+class qmpVisualization:public qmpPluginIntf
+{
+ friend class CTestCallBack;
+ private:
+ qmpPluginAPI* api;
+ int c;
+ CTestCallBack* cb;
+ public:
+ qmpVisualization(qmpPluginAPI* _api);
+ ~qmpVisualization();
+ void init();
+ void deinit();
+ const char* pluginGetName();
+ const char* pluginGetVersion();
+};
+
+extern "C"{
+ qmpPluginIntf* qmpPluginGetInterface(qmpPluginAPI* api)
+ {return new qmpVisualization(api);}
+}
+
+#endif // QMPVISUALIZATION_H
diff --git a/visualization/visualization.pro b/visualization/visualization.pro
new file mode 100644
index 0000000..8cce718
--- /dev/null
+++ b/visualization/visualization.pro
@@ -0,0 +1,23 @@
+#-------------------------------------------------
+#
+# Project created by QtCreator 2016-04-24T22:04:32
+#
+#-------------------------------------------------
+
+QT -= core gui
+
+CONFIG += c++11
+
+TARGET = visualization
+TEMPLATE = lib
+
+DEFINES += VISUALIZATION_LIBRARY
+
+SOURCES += qmpvisualization.cpp
+
+HEADERS += qmpvisualization.hpp
+
+unix {
+ target.path = /usr/lib/qmidiplayer
+ INSTALLS += target
+}