aboutsummaryrefslogtreecommitdiff
path: root/midifmt-plugin/midifmtplugin.hpp
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2017-02-09 16:04:43 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2017-02-09 16:04:43 +0800
commit620aad63042e0f397ea6691fe92ac40fcc6b6fed (patch)
treeb36a0f0c00ffba03bfed9513a360b7ecf442e720 /midifmt-plugin/midifmtplugin.hpp
parent1976c49f835267d33ef88bd3fc20d18363e12c0b (diff)
downloadQMidiPlayer-620aad63042e0f397ea6691fe92ac40fcc6b6fed.tar.xz
Add extra midi formats support via the file reader API.
Fix note counting.
Diffstat (limited to 'midifmt-plugin/midifmtplugin.hpp')
-rw-r--r--midifmt-plugin/midifmtplugin.hpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/midifmt-plugin/midifmtplugin.hpp b/midifmt-plugin/midifmtplugin.hpp
new file mode 100644
index 0000000..f6284dd
--- /dev/null
+++ b/midifmt-plugin/midifmtplugin.hpp
@@ -0,0 +1,45 @@
+#ifndef MIDIFMTPLUGIN_HPP
+#define MIDIFMTPLUGIN_HPP
+
+#include <cstdio>
+#include "../include/qmpcorepublic.hpp"
+
+class CMidiStreamReader:public IMidiFileReader
+{
+ private:
+ CMidiFile* ret;
+ FILE* f;
+ int eventdiscarded,fmt;
+ uint32_t readDWLE();
+ bool RIFFHeaderReader();
+ bool midsBodyReader();
+ public:
+ CMidiStreamReader();
+ ~CMidiStreamReader();
+ CMidiFile* readFile(const char *fn);
+ void discardCurrentEvent();
+ void commitEventChange(SEventCallBackData d);
+};
+
+class qmpMidiFmtPlugin:public qmpPluginIntf
+{
+ private:
+ CMidiStreamReader* mdsreader;
+ public:
+ static qmpPluginAPI* api;
+ qmpMidiFmtPlugin(qmpPluginAPI* _api);
+ ~qmpMidiFmtPlugin();
+ void init();
+ void deinit();
+ const char* pluginGetName();
+ const char* pluginGetVersion();
+};
+
+extern "C"{
+ EXPORTSYM qmpPluginIntf* qmpPluginGetInterface(qmpPluginAPI* api)
+ {return new qmpMidiFmtPlugin(api);}
+ EXPORTSYM const char* qmpPluginGetAPIRev()
+ {return QMP_PLUGIN_API_REV;}
+}
+
+#endif // MIDIFMTPLUGIN_HPP