diff options
author | Chris Xiong <chirs241097@gmail.com> | 2019-01-25 22:44:17 +0800 |
---|---|---|
committer | Chris Xiong <chirs241097@gmail.com> | 2019-01-25 22:44:17 +0800 |
commit | 4d9b1e98f4f3cd7387491ba1cc883230302a9022 (patch) | |
tree | 7147e208bdab4356e317cb46ea4958de23f6800f /core/qmpmidioutfluid.cpp | |
parent | 003c637ef40e1826b7c829afbfba82ea028e21a5 (diff) | |
download | QMidiPlayer-4d9b1e98f4f3cd7387491ba1cc883230302a9022.tar.xz |
Fixed a crash caused by improper preset probing.
Further ensure CC#8 is initialized correctly.
Minor string table update.
Diffstat (limited to 'core/qmpmidioutfluid.cpp')
-rw-r--r-- | core/qmpmidioutfluid.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/core/qmpmidioutfluid.cpp b/core/qmpmidioutfluid.cpp index 8c8cd30..8055421 100644 --- a/core/qmpmidioutfluid.cpp +++ b/core/qmpmidioutfluid.cpp @@ -110,6 +110,7 @@ void qmpMidiOutFluid::reset(uint8_t ch) this->panic(ch); fluid_synth_cc(synth,ch,0,0); fluid_synth_cc(synth,ch,7,100); + fluid_synth_cc(synth,ch,8,64); fluid_synth_cc(synth,ch,10,64); fluid_synth_cc(synth,ch,11,127); fluid_synth_cc(synth,ch,32,0); @@ -172,13 +173,19 @@ void qmpMidiOutFluid::setGain(double gain) { if(settings)fluid_settings_setnum(settings,"synth.gain",gain); } -void qmpMidiOutFluid::getChannelInfo(int ch,int *b, int *p, char *s) +void qmpMidiOutFluid::getChannelInfo(int ch,int *b,int *p,char *s) { if(!synth)return; fluid_preset_t* chpreset=fluid_synth_get_channel_preset(synth,ch); + if(!chpreset) + { + *b=*p=-1; + strcpy(s,"---"); + return; + } *b=fluid_preset_get_banknum(chpreset); *p=fluid_preset_get_num(chpreset); - strcpy(s,fluid_preset_get_name(chpreset)); + strncpy(s,fluid_preset_get_name(chpreset),256); } void qmpMidiOutFluid::getReverbPara(double *r,double *d,double *w,double *l) { |