diff options
author | Chris Xiong <chirs241097@gmail.com> | 2016-04-25 23:46:17 +0800 |
---|---|---|
committer | Chris Xiong <chirs241097@gmail.com> | 2016-04-25 23:46:17 +0800 |
commit | 4ffde0ad55d041229793ca4457123bcbcbf8e0c0 (patch) | |
tree | 9457cee58f3a1f35ebe63de79c6811b1c16e36dc /core/qmpmidiread.cpp | |
parent | 800a0417e9ed175f220c472842a283202c77060b (diff) | |
download | QMidiPlayer-4ffde0ad55d041229793ca4457123bcbcbf8e0c0.tar.xz |
Plugin API now works correctly. Port old visualization code.
Diffstat (limited to 'core/qmpmidiread.cpp')
-rw-r--r-- | core/qmpmidiread.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/core/qmpmidiread.cpp b/core/qmpmidiread.cpp index 762ce5d..380b603 100644 --- a/core/qmpmidiread.cpp +++ b/core/qmpmidiread.cpp @@ -172,6 +172,10 @@ int CMidiFile::eventReader()//returns 0 if End of Track encountered error(0,"W: Unknown event type %#x",type); } lasttype=type;++curid; + SEvent* le=eventList[eventList.size()-1]; + SEventCallBackData cbd(le->type,le->p1,le->p2,le->time); + for(int i=0;i<16;++i)if(eventReaderCB[i]) + eventReaderCB[i]->callBack(&cbd,eventReaderCBuserdata[i]); return 1; } void CMidiFile::trackChunkReader() @@ -222,9 +226,11 @@ void CMidiFile::dumpEvents() printf("type %x #%d @%d p1 %d p2 %d\n",eventList[i]->type, eventList[i]->iid,eventList[i]->time,eventList[i]->p1,eventList[i]->p2); } -CMidiFile::CMidiFile(const char* fn) +CMidiFile::CMidiFile(const char* fn,IMidiCallBack **ercb,void **ercbdata) { title=copyright=NULL;notes=0;std=0;valid=1; + memcpy(eventReaderCB,ercb,sizeof(eventReaderCB)); + memcpy(eventReaderCBuserdata,ercbdata,sizeof(eventReaderCBuserdata)); try { if(!(f=fopen(fn,"rb")))throw (fprintf(stderr,"E: file %s doesn't exist!\n",fn),2); |