From 64c91c7da66ba71e2bb32077680f234aba4ac65d Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Fri, 16 Jun 2017 23:51:26 +0800 Subject: Code refactoring and fix to memory leaks. --- include/qmpcorepublic.hpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'include') 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 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 eventList; + std::vector 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. -- cgit v1.2.3