diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/qmpmidiplay.cpp | 6 | ||||
-rw-r--r-- | core/qmpmidiplay.hpp | 5 |
2 files changed, 7 insertions, 4 deletions
diff --git a/core/qmpmidiplay.cpp b/core/qmpmidiplay.cpp index 6ff465f..46a2dae 100644 --- a/core/qmpmidiplay.cpp +++ b/core/qmpmidiplay.cpp @@ -22,6 +22,8 @@ bool CMidiPlayer::processEvent(const SEvent *e) for(auto i=event_handlers.begin();i!=event_handlers.end();++i) i->second.first((void*)e,i->second.second); uint8_t ch=e->type&0x0F; + if((e->type&0xF0)<0xF0) + levtt[ch]=std::chrono::system_clock::now(); switch(e->type&0xF0) { case 0x80://Note off @@ -29,7 +31,6 @@ bool CMidiPlayer::processEvent(const SEvent *e) case 0x90://Note on if((mute>>ch)&1&&e->p2)return false;//muted if(solo&&!((solo>>ch)&1)&&e->p2)return false;//excluded by solo flags - if(e->p2)chstate[ch]=1; return true; case 0xB0://CC if(e->p1==100)rpnid[ch]=e->p2; @@ -505,7 +506,8 @@ void CMidiPlayer::setChannelOutput(int ch,int outid) dold.dev->onUnmapped(ch,--dold.refcnt); } } -uint8_t* CMidiPlayer::getChstates(){return chstate;} +const std::chrono::system_clock::time_point* CMidiPlayer::getLastEventTS() +{return levtt;} int CMidiPlayer::setEventHandlerCB(ICallBack *cb,void *userdata) { for(int i=0;i<16;++i) diff --git a/core/qmpmidiplay.hpp b/core/qmpmidiplay.hpp index da9e9ef..4d950fa 100644 --- a/core/qmpmidiplay.hpp +++ b/core/qmpmidiplay.hpp @@ -64,7 +64,7 @@ class CMidiPlayer uint16_t mute,solo; double ftime; bool sendSysEx,waitvoice; - uint8_t chstate[16],chstatus[16][130];//0..127: cc 128: pc + uint8_t chstatus[16][130];//0..127: cc 128: pc qmpMidiOutFluid* internalFluid; uint32_t ctempo,ctsn,ctsd,divs,cks; double dpt;//time per tick @@ -76,6 +76,7 @@ class CMidiPlayer //playback correction uint32_t ttick; std::chrono::high_resolution_clock::time_point ttime; + std::chrono::system_clock::time_point levtt[16]; struct SMidiDev { std::string name; @@ -155,7 +156,7 @@ class CMidiPlayer int getChannelOutput(int ch); qmpMidiOutDevice* getChannelOutputDevice(int ch); void setChannelOutput(int ch,int outid); - uint8_t* getChstates(); + const std::chrono::system_clock::time_point* getLastEventTS(); int setEventHandlerCB(ICallBack *cb,void *userdata); void unsetEventHandlerCB(int id); int setEventReaderCB(ICallBack *cb,void *userdata); |