aboutsummaryrefslogtreecommitdiff
path: root/core/qmpmidiplay.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/qmpmidiplay.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/qmpmidiplay.cpp')
-rw-r--r--core/qmpmidiplay.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/core/qmpmidiplay.cpp b/core/qmpmidiplay.cpp
index bb2279d..1d32501 100644
--- a/core/qmpmidiplay.cpp
+++ b/core/qmpmidiplay.cpp
@@ -322,9 +322,11 @@ void CMidiPlayer::playerPanic(bool reset)
}
bool CMidiPlayer::playerLoadFile(const char* fn)
{
- midiFile=new CMidiFile(fn,this->eventReaderCB,this->eventReaderCBuserdata);
+ midiFile=new CMidiFile(fn,this);
if(!midiFile->isValid())return false;
divs=midiFile->getDivision();
+ for(int i=0;i<16;++i)if(fileReadFinishCB[i])
+ fileReadFinishCB[i]->callBack(NULL,fileReadFinishCBuserdata[i]);
fileTimer1Pass();
fileTimer2Pass();
return true;
@@ -411,6 +413,7 @@ double CMidiPlayer::getTempo(){return 60./(ctempo/1e6);}
uint32_t CMidiPlayer::getTick(){return ct;}
uint32_t CMidiPlayer::getRawTempo(){return ctempo;}
uint32_t CMidiPlayer::getDivision(){return divs;}
+uint32_t CMidiPlayer::getMaxTick(){return maxtk;}
double CMidiPlayer::getPitchBend(int ch){return((int)pbv[ch]-8192)/8192.*pbr[ch];}
uint32_t CMidiPlayer::getTCpaused(){return tcpaused;}
void CMidiPlayer::setTCpaused(uint32_t ps){tcpaused=ps;}
@@ -580,5 +583,20 @@ int CMidiPlayer::setEventReaderCB(IMidiCallBack *cb,void *userdata)
}
void CMidiPlayer::unsetEventReaderCB(int id)
{eventReaderCB[id]=NULL;eventReaderCBuserdata[id]=NULL;}
+int CMidiPlayer::setFileReadFinishedCB(IMidiCallBack *cb,void *userdata)
+{
+ for(int i=0;i<16;++i)
+ {
+ if(fileReadFinishCB[i]==cb)return i;
+ if(fileReadFinishCB[i]==NULL)
+ {
+ fileReadFinishCB[i]=cb;fileReadFinishCBuserdata[i]=userdata;
+ return i;
+ }
+ }
+ return -1;
+}
+void CMidiPlayer::unsetFileReadFinishedCB(int id)
+{fileReadFinishCB[id]=NULL;fileReadFinishCBuserdata[id]=NULL;}
void CMidiPlayer::discardLastEvent(){midiFile?midiFile->discardLastEvent():(void)0;}
void CMidiPlayer::commitEventChange(SEventCallBackData d){midiFile?midiFile->commitEventChange(d):(void)0;}