From bd165c0254b9095bb9e5ea54def56b6404033ebe Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Thu, 30 Apr 2020 01:12:38 +0800 Subject: Add visualization renderer. Add API for getting raw pitch bend values. Fix non-compliant RPN handling. The visualization renderer is still at the "proof-of-concept" stage. It's not very usable (yet). --- core/qmpmidiplay.cpp | 7 ++++++- core/qmpmidiplay.hpp | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'core') diff --git a/core/qmpmidiplay.cpp b/core/qmpmidiplay.cpp index 01045c1..a354d6e 100644 --- a/core/qmpmidiplay.cpp +++ b/core/qmpmidiplay.cpp @@ -106,7 +106,7 @@ void CMidiPlayer::processEventStub(const SEvent *e) if(~rpnid[e->type&0x0F]&&~rpnval[e->type&0x0F]) { if(rpnid[e->type&0x0F]==0)ccc[e->type&0x0F][134]=rpnval[e->type&0x0F]; - rpnid[e->type&0x0F]=rpnval[e->type&0x0F]=-1; + rpnval[e->type&0x0F]=-1; } ccc[e->type&0x0F][e->p1]=e->p2; break; @@ -404,6 +404,11 @@ 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];} +double CMidiPlayer::getPitchBendRaw(int ch,uint32_t *pb,uint32_t *pbr) +{ + if(pb)*pb=this->pbv[ch]; + if(pbr)*pbr=this->pbr[ch]; +} uint32_t CMidiPlayer::getTCpaused(){return tcpaused;} void CMidiPlayer::setTCpaused(uint32_t ps){tcpaused=ps;} uint32_t CMidiPlayer::isFinished(){return finished;} diff --git a/core/qmpmidiplay.hpp b/core/qmpmidiplay.hpp index 83a7128..471c1db 100644 --- a/core/qmpmidiplay.hpp +++ b/core/qmpmidiplay.hpp @@ -135,6 +135,7 @@ class CMidiPlayer uint32_t getDivision(); uint32_t getMaxTick(); double getPitchBend(int ch); + double getPitchBendRaw(int ch,uint32_t *pb,uint32_t *pbr); const char* getTitle(); const char* getCopyright(); -- cgit v1.2.3