diff options
author | Chris Xiong <chirs241097@gmail.com> | 2017-06-16 23:51:26 +0800 |
---|---|---|
committer | Chris Xiong <chirs241097@gmail.com> | 2017-06-16 23:51:26 +0800 |
commit | 64c91c7da66ba71e2bb32077680f234aba4ac65d (patch) | |
tree | dc44e44c4f2b1530952f57538d7164f712b61b02 /include | |
parent | 37ba9dd1ce449bc2c2f422dd04225bc68bd89c59 (diff) | |
download | QMidiPlayer-64c91c7da66ba71e2bb32077680f234aba4ac65d.tar.xz |
Code refactoring and fix to memory leaks.
Diffstat (limited to 'include')
-rw-r--r-- | include/qmpcorepublic.hpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/include/qmpcorepublic.hpp b/include/qmpcorepublic.hpp index 4adb83a..ba38f4e 100644 --- a/include/qmpcorepublic.hpp +++ b/include/qmpcorepublic.hpp @@ -8,7 +8,7 @@ #else #define EXPORTSYM __attribute__ ((visibility ("default"))) #endif -#define QMP_PLUGIN_API_REV "1+indev3" +#define QMP_PLUGIN_API_REV "1+indev4" //MIDI Event structure struct SEvent { @@ -32,13 +32,25 @@ public: 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;} }; +//MIDI Track class +class CMidiTrack{ + public: + std::vector<SEvent> eventList; + void appendEvent(SEvent e){eventList.push_back(e);} + SEvent& operator[](size_t sub){return eventList[sub];} +}; //MIDI File class class CMidiFile{ public: bool valid; char *title,*copyright; - std::vector<SEvent> eventList; + std::vector<CMidiTrack> tracks; uint32_t std,divs; + ~CMidiFile() + { + if(title)delete[] title; + if(copyright)delete[] copyright; + } }; //Generic callback function that can be used for hooking the core. //"userdata" is set when you register the callback function. |