aboutsummaryrefslogtreecommitdiff
path: root/core/qmpmidiread.cpp
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2017-01-02 22:09:28 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2017-01-02 22:09:28 +0800
commitb7842ae90b28618affdad6977c9c814aa573a3fe (patch)
treed43616b5b01a7c0b20044ff4564251043f313e9e /core/qmpmidiread.cpp
parentb79c4b7e3cab3711e87ba9e28fa8423a84ea7efa (diff)
downloadQMidiPlayer-b7842ae90b28618affdad6977c9c814aa573a3fe.tar.xz
Can show measure indicators now.
Added new options to specify custom fonts. Added a new handler API. Minor rework on handler calling.
Diffstat (limited to 'core/qmpmidiread.cpp')
-rw-r--r--core/qmpmidiread.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/core/qmpmidiread.cpp b/core/qmpmidiread.cpp
index 33a1bd4..58a9786 100644
--- a/core/qmpmidiread.cpp
+++ b/core/qmpmidiread.cpp
@@ -229,11 +229,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,IMidiCallBack **ercb,void **ercbdata)
+CMidiFile::CMidiFile(const char* fn,CMidiPlayer* par)
{
title=copyright=NULL;notes=0;std=0;valid=1;
- memcpy(eventReaderCB,ercb,sizeof(eventReaderCB));
- memcpy(eventReaderCBuserdata,ercbdata,sizeof(eventReaderCBuserdata));
+ memcpy(eventReaderCB,par->eventReaderCB,sizeof(eventReaderCB));
+ memcpy(eventReaderCBuserdata,par->eventReaderCBuserdata,sizeof(eventReaderCBuserdata));
try
{
if(!(f=fopen(fn,"rb")))throw (fprintf(stderr,"E: file %s doesn't exist!\n",fn),2);
@@ -241,6 +241,7 @@ CMidiFile::CMidiFile(const char* fn,IMidiCallBack **ercb,void **ercbdata)
for(uint32_t i=0;i<trk;i+=chunkReader(0));
fclose(f);
std::sort(eventList.begin(),eventList.end(),cmp);
+ par->maxtk=eventList[eventList.size()-1]->time;
}
catch(int){fprintf(stderr,"E: %s is not a supported file.\n",fn);valid=0;}
}