From 003c637ef40e1826b7c829afbfba82ea028e21a5 Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Thu, 24 Jan 2019 23:09:16 +0800 Subject: Migrated to fluidsynth 2.x. Moved to mxe for Windows build. Fixed default value for CC#8. --- ChangeLog | 5 +++++ core/qmpmidioutfluid.cpp | 29 ++++++++++++++--------------- core/qmpmidiplay.cpp | 2 +- qmidiplayer-desktop/qmidiplayer-desktop.pro | 6 +----- qmidiplayer-desktop/qmpefxwindow.cpp | 20 ++++++++++---------- qmidiplayer-desktop/qmpmainwindow.cpp | 6 +++--- qmidiplayer-desktop/qmpsettingswindow.cpp | 4 ++-- visualization/visualization.pro | 23 ++++++++--------------- 8 files changed, 44 insertions(+), 51 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7b5a92f..fc8c4b9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2019-01-24 0.8.6 alpha +Migrated to fluidsynth 2.x. +Moved to mxe for Windows build. +Fixed default value for CC#8. + 2018-10-02 0.8.6 alpha Fixed layout with Qt 5.11. Minor code cleanups in qmpchannelswindow. diff --git a/core/qmpmidioutfluid.cpp b/core/qmpmidioutfluid.cpp index da3282f..8c8cd30 100644 --- a/core/qmpmidioutfluid.cpp +++ b/core/qmpmidioutfluid.cpp @@ -28,9 +28,8 @@ void qmpMidiOutFluid::deviceInit() delete_fluid_synth(synth);synth=NULL; return; } - fluid_synth_set_chorus(synth,FLUID_CHORUS_DEFAULT_N,FLUID_CHORUS_DEFAULT_LEVEL, - FLUID_CHORUS_DEFAULT_SPEED,FLUID_CHORUS_DEFAULT_DEPTH, - FLUID_CHORUS_DEFAULT_TYPE); + fluid_synth_set_chorus(synth,3,2.0,0.3,8.0, + FLUID_CHORUS_MOD_SINE); /*if(midiFile->std==4) fluid_synth_set_channel_type(synth,9,CHANNEL_TYPE_MELODIC); else if(midiFile->std==1) @@ -149,13 +148,13 @@ std::vector,std::string>> qmpMidiOutFluid::listPres for(int i=getSFCount()-1;i>=0;--i) { fluid_sfont_t* psf=fluid_synth_get_sfont(synth,i); - fluid_preset_t preset; - psf->iteration_start(psf); - while(psf->iteration_next(psf,&preset)) + fluid_preset_t* preset; + fluid_sfont_iteration_start(psf); + while(preset=fluid_sfont_iteration_next(psf)) pmap[std::make_pair( - preset.get_banknum(&preset), - preset.get_num(&preset) - )]=preset.get_name(&preset); + fluid_preset_get_banknum(preset), + fluid_preset_get_num(preset) + )]=fluid_preset_get_name(preset); } for(auto i=pmap.begin();i!=pmap.end();++i) ret.push_back(std::make_pair(i->first,i->second)); @@ -176,10 +175,10 @@ void qmpMidiOutFluid::setGain(double gain) void qmpMidiOutFluid::getChannelInfo(int ch,int *b, int *p, char *s) { if(!synth)return; - fluid_synth_channel_info_t chinfo; - fluid_synth_get_channel_info(synth,ch,&chinfo); - *b=chinfo.bank;*p=chinfo.program; - strcpy(s,chinfo.name); + fluid_preset_t* chpreset=fluid_synth_get_channel_preset(synth,ch); + *b=fluid_preset_get_banknum(chpreset); + *p=fluid_preset_get_num(chpreset); + strcpy(s,fluid_preset_get_name(chpreset)); } void qmpMidiOutFluid::getReverbPara(double *r,double *d,double *w,double *l) { @@ -200,8 +199,8 @@ void qmpMidiOutFluid::getChorusPara(int *fb,double *l,double *r,double *d,int *t if(!synth)return; *fb=fluid_synth_get_chorus_nr(synth); *l=fluid_synth_get_chorus_level(synth); - *r=fluid_synth_get_chorus_speed_Hz(synth); - *d=fluid_synth_get_chorus_depth_ms(synth); + *r=fluid_synth_get_chorus_speed(synth); + *d=fluid_synth_get_chorus_depth(synth); *type=fluid_synth_get_chorus_type(synth); } void qmpMidiOutFluid::setChorusPara(int e,int fb,double l,double r,double d,int type) diff --git a/core/qmpmidiplay.cpp b/core/qmpmidiplay.cpp index 6126f26..64b3c72 100644 --- a/core/qmpmidiplay.cpp +++ b/core/qmpmidiplay.cpp @@ -215,7 +215,7 @@ void CMidiPlayer::fileTimer2Pass() memset(ccc,0,sizeof(ccc));memset(rpnid,0xFF,sizeof(rpnid));memset(rpnval,0xFF,sizeof(rpnval)); for(int i=0;i<16;++i) { - ccc[i][7]=100;ccc[i][10]=64;ccc[i][11]=127; + ccc[i][7]=100;ccc[i][8]=64;ccc[i][10]=64;ccc[i][11]=127; ccc[i][11]=127;ccc[i][71]=64;ccc[i][72]=64; ccc[i][73]=64;ccc[i][74]=64;ccc[i][75]=64; ccc[i][76]=64;ccc[i][77]=64;ccc[i][78]=64; diff --git a/qmidiplayer-desktop/qmidiplayer-desktop.pro b/qmidiplayer-desktop/qmidiplayer-desktop.pro index 9b0928c..d942f23 100644 --- a/qmidiplayer-desktop/qmidiplayer-desktop.pro +++ b/qmidiplayer-desktop/qmidiplayer-desktop.pro @@ -112,11 +112,7 @@ unix{ win32{ DEFINES += RT_MIDI_H=\\\"RtMidi.h\\\" #change these before building... - LIBS += e:/libs/fluidsynth/libfluidsynth.dll.a winmm.lib - Release:LIBS += e:/libs/rtmidi/rtmidi.lib - Debug:LIBS += e:/libs/rtmidi/rtmidid.lib - INCLUDEPATH += e:/libs/fluidsynth/include - INCLUDEPATH += e:/libs/rtmidi + LIBS += -lfluidsynth -lwinmm -lRtMidi RC_FILE = qmidiplayer.rc } RESOURCES = resources.qrc diff --git a/qmidiplayer-desktop/qmpefxwindow.cpp b/qmidiplayer-desktop/qmpefxwindow.cpp index 4c7d0c0..5602dd4 100644 --- a/qmidiplayer-desktop/qmpefxwindow.cpp +++ b/qmidiplayer-desktop/qmpefxwindow.cpp @@ -17,16 +17,16 @@ qmpEfxWindow::qmpEfxWindow(QWidget *parent) : QSettings *settings=qmpSettingsWindow::getSettingsIntf(); ui->cbEnabledC->setChecked(settings->value("Effects/ChorusEnabled",1).toInt()); ui->cbEnabledR->setChecked(settings->value("Effects/ReverbEnabled",1).toInt()); - rr=settings->value("Effects/ReverbRoom",FLUID_REVERB_DEFAULT_ROOMSIZE).toDouble(); - rd=settings->value("Effects/ReverbDamp",FLUID_REVERB_DEFAULT_DAMP).toDouble(); - rw=settings->value("Effects/ReverbWidth",FLUID_REVERB_DEFAULT_WIDTH).toDouble(); - rl=settings->value("Effects/ReverbLevel",FLUID_REVERB_DEFAULT_LEVEL).toDouble(); - - cfb=settings->value("Effects/ChorusFeedbk",FLUID_CHORUS_DEFAULT_N).toInt(); - cl=settings->value("Effects/ChorusLevel",FLUID_CHORUS_DEFAULT_LEVEL).toDouble(); - cr=settings->value("Effects/ChorusRate",FLUID_CHORUS_DEFAULT_SPEED).toDouble(); - cd=settings->value("Effects/ChorusDepth",FLUID_CHORUS_DEFAULT_DEPTH).toDouble(); - ct=settings->value("Effects/ChorusType",FLUID_CHORUS_DEFAULT_TYPE).toInt(); + rr=settings->value("Effects/ReverbRoom",0.2).toDouble(); + rd=settings->value("Effects/ReverbDamp",0.0).toDouble(); + rw=settings->value("Effects/ReverbWidth",0.5).toDouble(); + rl=settings->value("Effects/ReverbLevel",0.9).toDouble(); + + cfb=settings->value("Effects/ChorusFeedbk",3).toInt(); + cl=settings->value("Effects/ChorusLevel",2.0).toDouble(); + cr=settings->value("Effects/ChorusRate",0.3).toDouble(); + cd=settings->value("Effects/ChorusDepth",8.0).toDouble(); + ct=settings->value("Effects/ChorusType",FLUID_CHORUS_MOD_SINE).toInt(); qmpMainWindow::getInstance()->registerFunctionality( efxf=new qmpEfxFunc(this), std::string("Effects"), diff --git a/qmidiplayer-desktop/qmpmainwindow.cpp b/qmidiplayer-desktop/qmpmainwindow.cpp index ea1db75..c83152c 100644 --- a/qmidiplayer-desktop/qmpmainwindow.cpp +++ b/qmidiplayer-desktop/qmpmainwindow.cpp @@ -15,7 +15,7 @@ #define setButtonHeight(x,h) {x->setMaximumHeight(h*(logicalDpiY()/96.));x->setMinimumHeight(h*(logicalDpiY()/96.));} #define setButtonWidth(x,h) {x->setMaximumWidth(h*(logicalDpiY()/96.));x->setMinimumWidth(h*(logicalDpiY()/96.));} #ifdef _WIN32 -#include +#include char* wcsto8bit(const wchar_t* s) { int size=WideCharToMultiByte(CP_OEMCP,WC_NO_BEST_FIT_CHARS,s,-1,0,0,0,0); @@ -276,7 +276,7 @@ void qmpMainWindow::switchTrack(QString s) player->setWaitVoice(qmpSettingsWindow::getSettingsIntf()->value("Midi/WaitVoice",1).toInt()); playerTh=new std::thread(&CMidiPlayer::playerThread,player); #ifdef _WIN32 - SetThreadPriority(playerTh->native_handle(),THREAD_PRIORITY_TIME_CRITICAL); + SetThreadPriority((void*)playerTh->native_handle(),THREAD_PRIORITY_TIME_CRITICAL); #endif st=std::chrono::steady_clock::now();offset=0; timer->start(UPDATE_INTERVAL); @@ -391,7 +391,7 @@ void qmpMainWindow::on_pbPlayPause_clicked() player->setWaitVoice(qmpSettingsWindow::getSettingsIntf()->value("Midi/WaitVoice",1).toInt()); playerTh=new std::thread(&CMidiPlayer::playerThread,player); #ifdef _WIN32 - SetThreadPriority(playerTh->native_handle(),THREAD_PRIORITY_TIME_CRITICAL); + SetThreadPriority((void*)playerTh->native_handle(),THREAD_PRIORITY_TIME_CRITICAL); #endif st=std::chrono::steady_clock::now();offset=0; timer->start(UPDATE_INTERVAL); diff --git a/qmidiplayer-desktop/qmpsettingswindow.cpp b/qmidiplayer-desktop/qmpsettingswindow.cpp index 0f5b66a..613a5db 100644 --- a/qmidiplayer-desktop/qmpsettingswindow.cpp +++ b/qmidiplayer-desktop/qmpsettingswindow.cpp @@ -11,7 +11,7 @@ QSettings* qmpSettingsWindow::settings=NULL; QComboBox* qmpSettingsWindow::outwidget=NULL; -void qmpFluidForEachOpt(void* data,char*,char* option) +void qmpFluidForEachOpt(void* data,const char*,const char* option) { QComboBox *pcb=(QComboBox*)data; pcb->addItem(option); @@ -388,7 +388,7 @@ void qmpSettingsWindow::verifySF() if(QMessageBox::question(QDesktopWidget().screen(curMonitor),//this, tr("No soundfont loaded"), tr("Internal fluidsynth was chosen as the default output but it has no soundfont set. " - "Would you like to setup soundfonts now? After that you may have to reload the internal synth."))==QMessageBox::Yes) + "Would you like to setup soundfonts now? You may have to reload the internal synth afterwards."))==QMessageBox::Yes) { show(); ui->tabWidget->setCurrentWidget(ui->tab_3); diff --git a/visualization/visualization.pro b/visualization/visualization.pro index 5bf08ea..646e301 100644 --- a/visualization/visualization.pro +++ b/visualization/visualization.pro @@ -32,30 +32,23 @@ unix { QMAKE_LFLAGS_RELEASE += -O3 res.path = $$DATADIR/qmidiplayer/img res.files += ../img/chequerboard.png ../img/particle.png ../img/kb_128.png - #well... - SMELTDIR = $$(SMELT_DIR) isEmpty(SMELTDIR){ INCLUDEPATH += /home/chrisoft/devel/SMELT/include/ /usr/include/freetype2 LIBS += -L/home/chrisoft/devel/SMELT/smelt/glfw/ LIBS += -L/home/chrisoft/devel/SMELT/extensions/ LIBS += -lstdc++ -lfreetype -lz -lsmeltext -lsmelt-dumb -lCxImage -ljpeg -lpng -lglfw -lGLEW -lGL }else{ - INCLUDEPATH += $$SMELTDIR/include/ /usr/include/freetype2 - LIBS += -L$$SMELTDIR/smelt/glfw/ - LIBS += -L$$SMELTDIR/extensions/ + INCLUDEPATH += $$(SMELT_DIR)/include/ /usr/include/freetype2 + LIBS += -L$$(SMELT_DIR)/smelt/glfw/ + LIBS += -L$$(SMELT_DIR)/extensions/ LIBS += -lstdc++ -lfreetype -lz -lsmeltext -lsmelt-dumb -lCxImage -ljpeg -lpng -lglfw -lGLEW -lGL } } win32 { #Change these before producing your own build! - INCLUDEPATH += "C:\Users\Chris Xiong\Documents\devel\SMELT\include" - INCLUDEPATH += "C:\Users\Chris Xiong\Documents\devel\freetype-2.7\include" - INCLUDEPATH += "C:\Users\Chris Xiong\Documents\devel\zlib-1.2.8" - CONFIG(release, debug|release){ - LIBS += -L"C:\Users\Chris Xiong\Documents\devel\SMELT\msvc\libdeps" - LIBS += -lfreetype27MT -lzlib -lsmeltext -lsmelt -ljpeg-static -llibpng16 -lglfw3 -lglew32s -lopengl32 -luser32 -lgdi32 -lshell32 - }else{ - LIBS += -L"C:\Users\Chris Xiong\Documents\devel\SMELT\msvc\libdepsd" - LIBS += -lfreetype27MTd -lzlib -lsmeltextd -lsmeltd -ljpeg-static -llibpng16 -lglfw3 -lglew32sd -lopengl32 -luser32 -lgdi32 -lshell32 - } + INCLUDEPATH += $$(SMELT_DIR)/include/ + INCLUDEPATH += /home/chrisoft/devel/mingwlibs/mxe/usr/x86_64-w64-mingw32.shared/include/freetype2/ + LIBS += -L$$(SMELT_DIR)/smelt/glfw/ + LIBS += -L$$(SMELT_DIR)/extensions/ + LIBS += -lz -lsmeltext -lfreetype -lsmelt -lCxImage -ljpeg -lpng16 -lglfw3 -lglew32s -lopengl32 -luser32 -lgdi32 -lshell32 } -- cgit v1.2.3