diff options
author | Chris Xiong <chirs241097@gmail.com> | 2020-04-19 23:36:48 +0800 |
---|---|---|
committer | Chris Xiong <chirs241097@gmail.com> | 2020-04-19 23:36:48 +0800 |
commit | 6d568d07b31ba2ae39703cfd272d3003ea542018 (patch) | |
tree | 58dca1ac27ffe9dd6bb045c5a71d04644b7a2e07 /core/qmpmidioutfluid.cpp | |
parent | c7bf3e37e6eaed6895c797f72ef116b42c6f8a44 (diff) | |
download | QMidiPlayer-6d568d07b31ba2ae39703cfd272d3003ea542018.tar.xz |
Legacy code massacre!
Complete reconstruction of the settings infrastructure.
All options are now registered using a revamped option API.
Legacy configuration files are no longer compatible. Please make a
backup.
Diffstat (limited to 'core/qmpmidioutfluid.cpp')
-rw-r--r-- | core/qmpmidioutfluid.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/core/qmpmidioutfluid.cpp b/core/qmpmidioutfluid.cpp index 87c1207..649cb1c 100644 --- a/core/qmpmidioutfluid.cpp +++ b/core/qmpmidioutfluid.cpp @@ -12,6 +12,45 @@ qmpMidiOutFluid::~qmpMidiOutFluid() delete_fluid_settings(settings); settings=nullptr; } + +void qmpMidiOutFluid::registerOptions(qmpPluginAPI *coreapi) +{ + default_driver=-1; + fluid_settings_t *fsettings=new_fluid_settings(); + auto insert_driver=[](void* d,const char*,const char* driver)->void{ + qmpMidiOutFluid *me=static_cast<qmpMidiOutFluid*>(d); + me->drivers.push_back(std::string(driver)); +#ifdef WIN32 + if(std::string(driver)=="waveout") +#else + if(std::string(driver)=="pulseaudio") + me->default_driver=static_cast<int>(me->drivers.size()-1); +#endif + }; + fluid_settings_foreach_option(fsettings,"audio.driver",this,insert_driver); + delete_fluid_settings(fsettings); + coreapi->registerOptionEnumInt("Audio","Audio Driver","FluidSynth/AudioDriver",drivers,default_driver); + coreapi->registerOptionInt("Audio","Audio Buffer Size","FluidSynth/BufSize",64,8192, +#ifdef WIN32 + 512 +#else + 64 +#endif + ); + coreapi->registerOptionInt("Audio","Audio Buffer Count","FluidSynth/BufCnt",2,64, +#ifdef WIN32 + 8 +#else + 16 +#endif + ); + coreapi->registerOptionEnumInt("Audio","Sample Format","FluidSynth/SampleFormat",{"16bits","float"},0); + coreapi->registerOptionInt("Audio","Sample Rate","FluidSynth/SampleRate",8000,96000,48000); + coreapi->registerOptionInt("Audio","Max Polyphony","FluidSynth/Polyphony",1,65535,256); + coreapi->registerOptionInt("Audio","CPU Cores","FluidSynth/Threads",1,256,1); + coreapi->registerOptionBool("Audio","Auto Bank Select Mode","FluidSynth/AutoBS",true); + coreapi->registerOptionEnumInt("Audio","Bank Select Mode","FluidSynth/BankSelect",{"GM","GS","XG","MMA"},1); +} void qmpMidiOutFluid::deviceInit() { synth=new_fluid_synth(settings); |