From 0c3fe540e925829022d9d8aa567c2dc2bd3d33d5 Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Wed, 21 Jun 2017 13:03:30 +0800 Subject: Complete rewrite of the MIDI mapper. Enforces single fluidsynth instance. Documentation update. Minor changes to make lite version work. --- core/qmpmidioutfluid.hpp | 80 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 core/qmpmidioutfluid.hpp (limited to 'core/qmpmidioutfluid.hpp') diff --git a/core/qmpmidioutfluid.hpp b/core/qmpmidioutfluid.hpp new file mode 100644 index 0000000..963f9df --- /dev/null +++ b/core/qmpmidioutfluid.hpp @@ -0,0 +1,80 @@ +#ifndef QMPMIDIOUTFLUID_H +#define QMPMIDIOUTFLUID_H +#include +#include +#include +#include "../include/qmpcorepublic.hpp" +#include +class IFluidSettings +{ + public: + virtual void setOptStr(const char* opt,const char* val)=0; + virtual void setOptInt(const char* opt,int val)=0; + virtual void setOptNum(const char* opt,double val)=0; + virtual void loadSFont(const char* path)=0; + virtual void setGain(double gain)=0; + virtual void setReverbPara(int e,double r,double d,double w,double l)=0; + virtual void setChorusPara(int e,int fb,double l,double r,double d,int type)=0; +}; +class qmpMidiOutFluid:public qmpMidiOutDevice,public IFluidSettings +{ + private: + fluid_settings_t* settings; + fluid_synth_t* synth; + fluid_audio_driver_t* adriver; + public: + qmpMidiOutFluid(); + ~qmpMidiOutFluid(); + void deviceInit(); + void deviceDeinit(); + void deviceDeinit(bool freshsettings); + void basicMessage(uint8_t type,uint8_t p1,uint8_t p2); + void extendedMessage(uint8_t length,const char *data); + void rpnMessage(uint8_t ch,uint16_t type,uint16_t val); + void nrpnMessage(uint8_t ch,uint16_t type,uint16_t val); + void panic(uint8_t ch); + void reset(uint8_t ch); + void onMapped(uint8_t ch,int refcnt); + void onUnmapped(uint8_t ch,int refcnt); + //FluidSynth specific stuff + void setOptStr(const char* opt,const char* val); + void setOptInt(const char* opt,int val); + void setOptNum(const char* opt,double val); + void loadSFont(const char* path); + int getSFCount(); + std::vector,std::string>> listPresets(); + + int getPolyphone(); + int getMaxPolyphone(); + void setGain(double gain); + void getChannelInfo(int ch,int *b,int *p,char *s); + void getReverbPara(double *r,double *d,double *w,double *l); + void setReverbPara(int e,double r,double d,double w,double l); + void getChorusPara(int *fb,double *l,double *r,double *d,int *type); + void setChorusPara(int e,int fb,double l,double r,double d,int type); +}; +class qmpFileRendererFluid:public IFluidSettings +{ + private: + fluid_settings_t* settings; + fluid_synth_t* synth; + fluid_player_t* player; + bool finished; + std::string fn; + public: + qmpFileRendererFluid(const char* _fn,const char* _ofn); + ~qmpFileRendererFluid(); + void renderInit(); + void renderDeinit(); + void renderWorker(); + void setOptStr(const char* opt,const char* val); + void setOptInt(const char* opt,int val); + void setOptNum(const char* opt,double val); + void loadSFont(const char *path); + bool isFinished(); + void setGain(double gain); + void setReverbPara(int e,double r,double d,double w,double l); + void setChorusPara(int e,int fb,double l,double r,double d,int type); + +}; +#endif // QMPMIDIOUTFLUID_H -- cgit v1.2.3