aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2019-11-26 15:47:38 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2019-11-26 15:47:38 +0800
commit62393aa7b9069274459d00024fc2b238b0044eb6 (patch)
tree00ed1ee70e3103e6fcb3375734bc93097691d54d /core
parent9c2eb04f6baadf33f60bf4af35caec77aebf48ff (diff)
downloadQMidiPlayer-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')
-rw-r--r--core/qmpmidioutfluid.cpp2
-rw-r--r--core/qmpmidioutfluid.hpp2
-rw-r--r--core/qmpmidioutrtmidi.cpp20
-rw-r--r--core/qmpmidioutrtmidi.hpp3
-rw-r--r--core/qmpmidiplay.cpp2
5 files changed, 23 insertions, 6 deletions
diff --git a/core/qmpmidioutfluid.cpp b/core/qmpmidioutfluid.cpp
index 4fcdd21..87c1207 100644
--- a/core/qmpmidioutfluid.cpp
+++ b/core/qmpmidioutfluid.cpp
@@ -156,7 +156,7 @@ bool qmpMidiOutFluid::getChannelPreset(int ch,uint16_t *bank,uint8_t *preset,std
presetname=fluid_preset_get_name(chpreset);
return true;
}
-uint8_t qmpMidiOutFluid::getInitialCCValue(uint8_t cc)
+uint8_t qmpMidiOutFluid::getInitialCCValue(uint8_t cc,uint8_t)
{
switch(cc)
{
diff --git a/core/qmpmidioutfluid.hpp b/core/qmpmidioutfluid.hpp
index 6cd2058..9c84264 100644
--- a/core/qmpmidioutfluid.hpp
+++ b/core/qmpmidioutfluid.hpp
@@ -44,7 +44,7 @@ class qmpMidiOutFluid:public qmpMidiOutDevice,public IFluidSettings
std::vector<std::pair<uint8_t,std::string>> getPresets(uint16_t bank);
std::string getPresetName(uint16_t bank,uint8_t preset);
bool getChannelPreset(int ch,uint16_t *bank,uint8_t *preset,std::string &presetname);
- uint8_t getInitialCCValue(uint8_t cc);
+ uint8_t getInitialCCValue(uint8_t cc,uint8_t ch);
//FluidSynth specific stuff
void setOptStr(const char* opt,const char* val);
void setOptInt(const char* opt,int val);
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)
diff --git a/core/qmpmidioutrtmidi.hpp b/core/qmpmidioutrtmidi.hpp
index 2c9195c..45662ba 100644
--- a/core/qmpmidioutrtmidi.hpp
+++ b/core/qmpmidioutrtmidi.hpp
@@ -14,6 +14,7 @@ struct qmpDeviceInitializer
};
std::unordered_map<uint16_t,BankStore> banks;
uint8_t initv[130];
+ uint8_t sinitv[16][130];
static qmpDeviceInitializer* parse(const char* path);
};
@@ -42,7 +43,7 @@ public:
std::vector<std::pair<uint8_t,std::string>> getPresets(uint16_t bank);
std::string getPresetName(uint16_t bank,uint8_t preset);
bool getChannelPreset(int ch,uint16_t *bank,uint8_t *preset,std::string &presetname);
- uint8_t getInitialCCValue(uint8_t cc);
+ uint8_t getInitialCCValue(uint8_t cc,uint8_t ch);
void setInitializerFile(const char* path);
};
diff --git a/core/qmpmidiplay.cpp b/core/qmpmidiplay.cpp
index 89fdf84..c24b0c9 100644
--- a/core/qmpmidiplay.cpp
+++ b/core/qmpmidiplay.cpp
@@ -453,7 +453,7 @@ bool CMidiPlayer::getChannelMask(int ch)
int CMidiPlayer::getCC(int ch,int id)
{
if(chstatus[ch][id]==0xff)
- return getChannelOutputDevice(ch)->getInitialCCValue(id);
+ return getChannelOutputDevice(ch)->getInitialCCValue(uint8_t(id),uint8_t(ch));
return chstatus[ch][id];
}
void CMidiPlayer::setCC(int ch,int id,int val)