diff options
author | Chris Xiong <chirs241097@gmail.com> | 2019-11-26 15:47:38 +0800 |
---|---|---|
committer | Chris Xiong <chirs241097@gmail.com> | 2019-11-26 15:47:38 +0800 |
commit | 62393aa7b9069274459d00024fc2b238b0044eb6 (patch) | |
tree | 00ed1ee70e3103e6fcb3375734bc93097691d54d /core/qmpmidioutrtmidi.cpp | |
parent | 9c2eb04f6baadf33f60bf4af35caec77aebf48ff (diff) | |
download | QMidiPlayer-62393aa7b9069274459d00024fc2b238b0044eb6.tar.xz |
We're now in bug squashing mode!
You can now specify control initial values for each individual channels.
Added build instructions for the folks out there rocking a more superior
operating system.
Diffstat (limited to 'core/qmpmidioutrtmidi.cpp')
-rw-r--r-- | core/qmpmidioutrtmidi.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/core/qmpmidioutrtmidi.cpp b/core/qmpmidioutrtmidi.cpp index eeda04b..76b12e6 100644 --- a/core/qmpmidioutrtmidi.cpp +++ b/core/qmpmidioutrtmidi.cpp @@ -26,6 +26,7 @@ qmpDeviceInitializer* qmpDeviceInitializer::parse(const char* path) { qmpDeviceInitializer *ret=new qmpDeviceInitializer(); ret->initseq.eventList.clear(); + memset(ret->sinitv,0xFF,sizeof(ret->sinitv)); bool st_inmapping=false; char buf[1024]; @@ -90,6 +91,8 @@ qmpDeviceInitializer* qmpDeviceInitializer::parse(const char* path) } else if(tok.front()=="C") { + if(st_inmapping) + err("invalid command") if(tok.size()!=4)err("invalid control") int ch=hh2d(tok[1].c_str()); int cc=hh2d(tok[2].c_str()); @@ -118,6 +121,8 @@ qmpDeviceInitializer* qmpDeviceInitializer::parse(const char* path) } else if(tok.front()=="IV") { + if(st_inmapping) + err("invalid command") int ci=0; tok.pop_front(); for(auto&tk:tok) @@ -134,6 +139,15 @@ qmpDeviceInitializer* qmpDeviceInitializer::parse(const char* path) } } } + else if(tok.front()=="SIV") + { + if(st_inmapping) + err("invalid command") + int ch=hh2d(tok[1].c_str()); + int cc=hh2d(tok[2].c_str()); + int cv=hh2d(tok[3].c_str()); + ret->sinitv[ch][cc]=uint8_t(cv); + } else if(st_inmapping) { if(b.front()=='['&&b.back()==']') @@ -298,9 +312,11 @@ bool qmpMidiOutRtMidi::getChannelPreset(int ch,uint16_t *bank,uint8_t *preset,st //This ain't a state-tracking device return false; } -uint8_t qmpMidiOutRtMidi::getInitialCCValue(uint8_t cc) +uint8_t qmpMidiOutRtMidi::getInitialCCValue(uint8_t cc,uint8_t ch) { - if(!devinit)return 0;//Nope! + if(!devinit||cc>=130)return 0;//Nope! + if(ch<16&&devinit->sinitv[ch][cc]!=0xFF) + return devinit->sinitv[ch][cc]; return devinit->initv[cc]; } void qmpMidiOutRtMidi::setInitializerFile(const char* path) |