aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2016-04-30 23:37:21 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2016-04-30 23:37:21 +0800
commit90f018721ae7ee6ac154d757516378b9c45ec1bf (patch)
treebbcd62282f1ef667030833d3abb0ef383d7823b6
parent50374f6942b96d0f15843ea63bc27eccc8f4d77c (diff)
downloadQMidiPlayer-90f018721ae7ee6ac154d757516378b9c45ec1bf.tar.xz
Fixed a bug in RPN handling.
-rw-r--r--ChangeLog3
-rw-r--r--core/qmpmidiplay.cpp29
-rw-r--r--core/qmpmidiplay.hpp2
-rw-r--r--qmidiplayer-desktop/qmpplugin.cpp1
4 files changed, 20 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog
index f4fe229..2d27893 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2016-04-30 0.7.8 beta
+Fixed a bug in RPN handling.
+
2016-04-29 0.7.8 beta
Update documentation.
Added two missing option proxy function...
diff --git a/core/qmpmidiplay.cpp b/core/qmpmidiplay.cpp
index bb09e4a..cf34a18 100644
--- a/core/qmpmidiplay.cpp
+++ b/core/qmpmidiplay.cpp
@@ -70,13 +70,13 @@ void CMidiPlayer::processEvent(const SEvent *e)
chstate[e->type&0x0F]=1;
break;
case 0xB0://CC
- if(e->p1==100)rpnid=e->p2;
- if(e->p1==6)rpnval=e->p2;
- if(~rpnid&&~rpnval)
+ if(e->p1==100)rpnid[e->type&0x0F]=e->p2;
+ if(e->p1==6)rpnval[e->type&0x0F]=e->p2;
+ if(~rpnid[e->type&0x0F]&&~rpnval[e->type&0x0F])
{
- if(rpnid==0)fluid_synth_pitch_wheel_sens(synth,e->type&0x0F,rpnval);
- pbr[e->type&0x0F]=rpnval;
- rpnid=rpnval=-1;
+ if(rpnid[e->type&0x0F]==0)fluid_synth_pitch_wheel_sens(synth,e->type&0x0F,rpnval[e->type&0x0F]);
+ pbr[e->type&0x0F]=rpnval[e->type&0x0F];
+ rpnid[e->type&0x0F]=rpnval[e->type&0x0F]=-1;
}
chstatus[e->type&0x0F][e->p1]=e->p2;
if(mappedoutput[e->type&0x0F])
@@ -137,12 +137,12 @@ void CMidiPlayer::processEventStub(const SEvent *e)
switch(e->type&0xF0)
{
case 0xB0://CC
- if(e->p1==100)rpnid=e->p2;
- if(e->p1==6)rpnval=e->p2;
- if(~rpnid&&~rpnval)
+ if(e->p1==100)rpnid[e->type&0x0F]=e->p2;
+ if(e->p1==6)rpnval[e->type&0x0F]=e->p2;
+ if(~rpnid[e->type&0x0F]&&~rpnval[e->type&0x0F])
{
- if(rpnid==0)ccc[e->type&0x0F][134]=rpnval;
- rpnid=rpnval=-1;
+ if(rpnid[e->type&0x0F]==0)ccc[e->type&0x0F][134]=rpnval[e->type&0x0F];
+ rpnid[e->type&0x0F]=rpnval[e->type&0x0F]=-1;
}
ccc[e->type&0x0F][e->p1]=e->p2;
break;
@@ -238,7 +238,8 @@ void CMidiPlayer::fileTimer2Pass()
{
double ctime=.0;uint32_t c=1;ctempo=0x7A120;dpt=ctempo*1000/divs;
memset(stamps,0,sizeof(stamps));memset(ccstamps,0,sizeof(ccstamps));
- memset(ccc,0,sizeof(ccc));rpnid=rpnval=-1;for(int i=0;i<16;++i)
+ memset(ccc,0,sizeof(ccc));memset(rpnid,0xFF,sizeof(rpnid));memset(rpnval,0xFF,sizeof(rpnval));
+ for(int i=0;i<16;++i)
{
ccc[i][7]=100;ccc[i][10]=64;ccc[i][11]=127;
ccc[i][11]=127;ccc[i][71]=64;ccc[i][72]=64;
@@ -331,8 +332,8 @@ void CMidiPlayer::playerInit()
ctempo=0x7A120;ctsn=4;ctsd=4;cks=0;dpt=ctempo*1000/divs;
tceptr=0;tcstop=0;tcpaused=0;finished=0;mute=solo=0;
for(int i=0;i<16;++i)pbr[i]=2,pbv[i]=8192;
- sendSysEx=true;rpnid=rpnval=-1;memset(chstatus,0,sizeof(chstatus));
- for(int i=0;i<16;++i)
+ sendSysEx=true;memset(rpnid,0xFF,sizeof(rpnid));memset(rpnval,0xFF,sizeof(rpnval));
+ memset(chstatus,0,sizeof(chstatus));for(int i=0;i<16;++i)
chstatus[i][7]=100,chstatus[i][11]=127,
chstatus[i][10]=chstatus[i][71]=chstatus[i][72]=
chstatus[i][73]=chstatus[i][74]=chstatus[i][75]=
diff --git a/core/qmpmidiplay.hpp b/core/qmpmidiplay.hpp
index 0587cf2..f922940 100644
--- a/core/qmpmidiplay.hpp
+++ b/core/qmpmidiplay.hpp
@@ -62,7 +62,7 @@ class CMidiPlayer
uint32_t stamps[101];
uint32_t ccstamps[101][16][135],ccc[16][135];
//0..127:cc 128:pc 129:cp 130:pb 131:tempo 132:ts 133:ks 134:pbr
- int32_t rpnid,rpnval;
+ int32_t rpnid[16],rpnval[16];
uint16_t mute,solo;
double ftime;
bool sendSysEx,singleInstance,waitvoice;
diff --git a/qmidiplayer-desktop/qmpplugin.cpp b/qmidiplayer-desktop/qmpplugin.cpp
index 546122b..7a250ff 100644
--- a/qmidiplayer-desktop/qmpplugin.cpp
+++ b/qmidiplayer-desktop/qmpplugin.cpp
@@ -117,6 +117,7 @@ int qmpPluginAPI::registerVisualizationIntf(qmpVisualizationIntf* intf)
{return qmw->registerVisualizationIntf(intf);}
void qmpPluginAPI::unregisterVisualizationIntf(int intfhandle)
{qmw->unregisterVisualizationIntf(intfhandle);}
+
void qmpPluginAPI::registerOptionInt(std::string,std::string,int,int,int){}
int qmpPluginAPI::getOptionInt(std::string){return 0;}
void qmpPluginAPI::registerOptionUint(std::string,std::string,unsigned,unsigned,unsigned){}