From 5b5eba7e68e7de8d442824d2f5076ec7d623e2b8 Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Tue, 22 Aug 2017 11:35:33 +0800 Subject: Windows type of functionality windows is now Qt::Dialog. Initialization fluidsynth asynchronously. Minor documentation update. --- ChangeLog | 5 ++ doc/optionsdialog.html | 2 + doc/troubleshooting.html | 29 +++++++---- qmidiplayer-desktop/qmpchannelswindow.cpp | 2 +- qmidiplayer-desktop/qmpefxwindow.cpp | 2 +- qmidiplayer-desktop/qmpmainwindow.cpp | 84 ++++++++++++++++++------------- qmidiplayer-desktop/qmpmainwindow.hpp | 4 +- qmidiplayer-desktop/qmpplistwindow.cpp | 2 +- qmidiplayer-desktop/qmpsettingswindow.cpp | 2 +- 9 files changed, 84 insertions(+), 48 deletions(-) diff --git a/ChangeLog b/ChangeLog index b40455b..55d3b5e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2017-08-22 0.8.6 indev +Windows type of functionality windows is now Qt::Dialog. +Initialization fluidsynth asynchronously. +Minor documentation update. + 2017-08-10 0.8.6 indev Windows of several main functionalities are no longer QDialogs. Fixed unexpected behavior. diff --git a/doc/optionsdialog.html b/doc/optionsdialog.html index d90cf45..8bbf79b 100644 --- a/doc/optionsdialog.html +++ b/doc/optionsdialog.html @@ -71,6 +71,8 @@
  • Save dialog status*: Save dialog positions and restore on start up.
  • Save parameters in effects window
  • Persistent fluidsynth instance: Deprecated. Removing before 0.9.
  • +
  • Show label beside icon in toolbar buttons: If disabled, the toolbar buttons will be + icon only.
  • Icon Theme: Leave it unchanged unless you can't see the icons on those buttons.
  • Customize toolbar: customize the functionalities shown in the main window.
  • Customize actions: customize the functionalities shown in the file action menu.
  • diff --git a/doc/troubleshooting.html b/doc/troubleshooting.html index b6b5a8d..184f702 100644 --- a/doc/troubleshooting.html +++ b/doc/troubleshooting.html @@ -26,11 +26,13 @@ If troubleshooting cannot solve your problem, please don't hesitate to report an issue.

    1. I can't hear anything!

    - 1) Check current audio driver in the option dialog. Do not use an audio driver - that is not installed on your system.
    - 2) If no soundfont is loaded, the synthesizer won't make any sound...
    - 3) Check audio buffer settings in the synth section.
    - 4) Check if your midi file is valid. +

      +
    1. Check current audio driver in the option dialog. Do not use an audio driver + that is not installed on your system.
    2. +
    3. If no soundfont is loaded, the internal synthesizer won't make any sound...
    4. +
    5. Check audio driver/buffer settings in the synth section.
    6. +
    7. Check if your midi file is valid/having correct bank selecting method/having zero volume.
    8. +

    2. The playback is intermittent.

    @@ -60,11 +62,20 @@ Bank selecting to external devices is sent in raw format. The midi file may be incompatible with your device.

    -

    9. 3D visualization is upsidedown/rotated/black.

    +

    9. 3D visualization is upsidedown/rotated/black/blinking.

    - For those who see a rotated display, try setting Visualization-Video/Multisampling - to 1 or above. If that doesn't solve your problem or you see nothing at - all, please send me more details about your problem. + For those who see a rotated and blinking display, try setting + Visualization-Video/Multisampling to 1 or above. If that doesn't + solve your problem or you see nothing at all, please send me more + details about your problem (graphics card, drivers etc.). +

    +

    + Devices/drivers reported to have this issue: +

    diff --git a/qmidiplayer-desktop/qmpchannelswindow.cpp b/qmidiplayer-desktop/qmpchannelswindow.cpp index 925d632..77560dc 100644 --- a/qmidiplayer-desktop/qmpchannelswindow.cpp +++ b/qmidiplayer-desktop/qmpchannelswindow.cpp @@ -7,7 +7,7 @@ #include "qmpmainwindow.hpp" qmpChannelsWindow::qmpChannelsWindow(QWidget *parent) : - QWidget(parent,Qt::Window), + QWidget(parent,Qt::Dialog), ui(new Ui::qmpChannelsWindow) { ui->setupUi(this); diff --git a/qmidiplayer-desktop/qmpefxwindow.cpp b/qmidiplayer-desktop/qmpefxwindow.cpp index 5bbf0e4..4c7d0c0 100644 --- a/qmidiplayer-desktop/qmpefxwindow.cpp +++ b/qmidiplayer-desktop/qmpefxwindow.cpp @@ -4,7 +4,7 @@ #include "qmpmainwindow.hpp" qmpEfxWindow::qmpEfxWindow(QWidget *parent) : - QWidget(parent,Qt::Window), + QWidget(parent,Qt::Dialog), ui(new Ui::qmpEfxWindow) { ui->setupUi(this);initialized=false; diff --git a/qmidiplayer-desktop/qmpmainwindow.cpp b/qmidiplayer-desktop/qmpmainwindow.cpp index e5ad102..b6e1267 100644 --- a/qmidiplayer-desktop/qmpmainwindow.cpp +++ b/qmidiplayer-desktop/qmpmainwindow.cpp @@ -11,7 +11,6 @@ #include #include "qmpmainwindow.hpp" #include "ui_qmpmainwindow.h" -#include "../core/qmpmidiplay.hpp" #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 @@ -23,12 +22,6 @@ char* wcsto8bit(const wchar_t* s) WideCharToMultiByte(CP_OEMCP,WC_NO_BEST_FIT_CHARS,s,-1,c,size,0,0); return c; } -#define LOAD_SOUNDFONT(a) \ - {\ - char* c=wcsto8bit(settingsw->getSFWidget()->item(i,1)->text().toStdWString().c_str());\ - a->loadSFont(c);\ - free(c);\ - } #define LOAD_FILE \ {\ for(auto i=mfunc.begin();i!=mfunc.end();++i)if(i->second.isVisualization())((qmpVisualizationIntf*)(i->second.i()))->reset();\ @@ -37,8 +30,6 @@ char* wcsto8bit(const wchar_t* s) free(c);\ } #else -#define LOAD_SOUNDFONT(a) \ - a->loadSFont(settingsw->getSFWidget()->item(i,1)->text().toStdString().c_str()) #define LOAD_FILE \ {\ for(auto i=mfunc.begin();i!=mfunc.end();++i)if(i->second.isVisualization())((qmpVisualizationIntf*)(i->second.i()))->reset();\ @@ -60,12 +51,9 @@ qmpMainWindow::qmpMainWindow(QWidget *parent) : setMaximumWidth(w);setMaximumHeight(h);setMinimumWidth(w);setMinimumHeight(h); setButtonHeight(ui->pbNext,36);setButtonHeight(ui->pbPlayPause,36);setButtonHeight(ui->pbAdd,36); setButtonHeight(ui->pbPrev,36);setButtonHeight(ui->pbSettings,36);setButtonHeight(ui->pbStop,36); - //setButtonHeight(ui->pbChannels,36);setButtonHeight(ui->pbPList,36); - //setButtonHeight(ui->pbEfx,36);setButtonHeight(ui->pbVisualization,36); playing=false;stopped=true;dragging=false;fin=false; settingsw=new qmpSettingsWindow(this);pmgr=new qmpPluginManager(); plistw=new qmpPlistWindow(this);player=NULL;timer=NULL;fluidrenderer=NULL; - singleFS=qmpSettingsWindow::getSettingsIntf()->value("Behavior/SingleInstance",0).toInt(); } qmpMainWindow::~qmpMainWindow() @@ -96,11 +84,29 @@ qmpMainWindow::~qmpMainWindow() void qmpMainWindow::init() { - player=new CMidiPlayer(); - rtmididev=new qmpRtMidiManager(); - rtmididev->createDevices(); - std::vector> rtdev=rtmididev->getDevices(); - for(auto &i:rtdev)player->registerMidiOutDevice(i.first,i.second); + if(qmpSettingsWindow::getSettingsIntf()->value("Behavior/DialogStatus",0).toInt()) + { + QRect g=qmpSettingsWindow::getSettingsIntf()->value("DialogStatus/MainW",QRect(-999,-999,999,999)).toRect(); + if(g!=QRect(-999,-999,999,999))setGeometry(g); + }show(); + + ui->centralWidget->setEnabled(false); + std::future f=std::async(std::launch::async, + [this] + { + player=new CMidiPlayer(); + rtmididev=new qmpRtMidiManager(); + rtmididev->createDevices(); + std::vector> rtdev=rtmididev->getDevices(); + for(auto &i:rtdev)player->registerMidiOutDevice(i.first,i.second); + reloadsynf=new qmpReloadSynthFunc(this); + playerSetup(player->fluid());player->fluid()->deviceInit(); + loadSoundFont(player->fluid()); + } + ); + while(f.wait_for(std::chrono::milliseconds(100))==std::future_status::timeout); + ui->centralWidget->setEnabled(true); + chnlw=new qmpChannelsWindow(this); efxw=new qmpEfxWindow(this); infow=new qmpInfoWindow(this); @@ -108,20 +114,10 @@ void qmpMainWindow::init() timer=new QTimer(this); renderf=new qmpRenderFunc(this); panicf=new qmpPanicFunc(this); - reloadsynf=new qmpReloadSynthFunc(this); registerFunctionality(renderf,"Render",tr("Render to wave").toStdString(),getThemedIconc(":/img/render.svg"),0,false); registerFunctionality(panicf,"Panic",tr("Panic").toStdString(),getThemedIconc(":/img/panic.svg"),0,false); registerFunctionality(reloadsynf,"ReloadSynth",tr("Restart fluidsynth").toStdString(),getThemedIconc(":/img/repeat-base.svg"),0,false); pmgr->scanPlugins();settingsw->updatePluginList(pmgr);pmgr->initPlugins(); - playerSetup(player->fluid());player->fluid()->deviceInit(); - for(int i=settingsw->getSFWidget()->rowCount()-1;i>=0;--i){if(!((QCheckBox*)settingsw->getSFWidget()->cellWidget(i,0))->isChecked())continue; - LOAD_SOUNDFONT(player->fluid()); - } - if(qmpSettingsWindow::getSettingsIntf()->value("Behavior/DialogStatus",0).toInt()) - { - QRect g=qmpSettingsWindow::getSettingsIntf()->value("DialogStatus/MainW",QRect(-999,-999,999,999)).toRect(); - if(g!=QRect(-999,-999,999,999))setGeometry(g); - }show(); ui->vsMasterVol->setValue(qmpSettingsWindow::getSettingsIntf()->value("Audio/Gain",50).toInt()); connect(timer,SIGNAL(timeout()),this,SLOT(updateWidgets())); connect(timer,SIGNAL(timeout()),chnlw,SLOT(channelWindowsUpdate())); @@ -369,6 +365,20 @@ void qmpMainWindow::playerSetup(IFluidSettings* fs) fs->setOptStr("synth.midi-bank-select",bsmode); player->sendSysX(settings->value("Midi/SendSysEx",1).toInt()); } +void qmpMainWindow::loadSoundFont(IFluidSettings *fs) +{ + for(int i=settingsw->getSFWidget()->rowCount()-1;i>=0;--i) + { + if(!((QCheckBox*)settingsw->getSFWidget()->cellWidget(i,0))->isChecked())continue; +#ifdef _WIN32 + char* c=wcsto8bit(settingsw->getSFWidget()->item(i,1)->text().toStdWString().c_str()); + fs->loadSFont(c); + free(c); +#else + fs->loadSFont(settingsw->getSFWidget()->item(i,1)->text().toStdString().c_str()); +#endif + } +} void qmpMainWindow::on_pbPlayPause_clicked() { @@ -589,10 +599,8 @@ void qmpMainWindow::startRender() playerSetup(fluidrenderer); fluidrenderer->renderInit(); #endif + loadSoundFont(fluidrenderer); ui->centralWidget->setEnabled(false); - for(int i=settingsw->getSFWidget()->rowCount()-1;i>=0;--i){if(!((QCheckBox*)settingsw->getSFWidget()->cellWidget(i,0))->isChecked())continue; - LOAD_SOUNDFONT(fluidrenderer); - } fluidrenderer->setGain(ui->vsMasterVol->value()/250.); efxw->sendEfxChange(fluidrenderer);timer->start(UPDATE_INTERVAL); renderTh=new std::thread(&qmpFileRendererFluid::renderWorker,fluidrenderer); @@ -600,10 +608,18 @@ void qmpMainWindow::startRender() void qmpMainWindow::reloadSynth() { - player->fluid()->deviceDeinit(true);playerSetup(player->fluid());player->fluid()->deviceInit(); - for(int i=settingsw->getSFWidget()->rowCount()-1;i>=0;--i){if(!((QCheckBox*)settingsw->getSFWidget()->cellWidget(i,0))->isChecked())continue; - LOAD_SOUNDFONT(player->fluid()); - } + ui->centralWidget->setEnabled(false); + std::future f=std::async(std::launch::async, + [this] + { + player->fluid()->deviceDeinit(true); + playerSetup(player->fluid()); + player->fluid()->deviceInit(); + loadSoundFont(player->fluid()); + } + ); + while(f.wait_for(std::chrono::milliseconds(100))==std::future_status::timeout); + ui->centralWidget->setEnabled(true); } std::vector& qmpMainWindow::getWidgets(int w) diff --git a/qmidiplayer-desktop/qmpmainwindow.hpp b/qmidiplayer-desktop/qmpmainwindow.hpp index fd1a5eb..c713ca3 100644 --- a/qmidiplayer-desktop/qmpmainwindow.hpp +++ b/qmidiplayer-desktop/qmpmainwindow.hpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include "../core/qmpmidiplay.hpp" #include "qmpplugin.hpp" @@ -174,7 +175,7 @@ class qmpMainWindow:public QMainWindow private: Ui::qmpMainWindow *ui; QTimer *timer; - bool playing,stopped,dragging,fin,singleFS,havemidi; + bool playing,stopped,dragging,fin,havemidi; std::thread *playerTh=NULL; std::thread *renderTh=NULL; std::chrono::steady_clock::time_point st; @@ -197,6 +198,7 @@ class qmpMainWindow:public QMainWindow void onfnChanged(); void playerSetup(IFluidSettings *fs); + void loadSoundFont(IFluidSettings *fs); private: static qmpMainWindow* ref; diff --git a/qmidiplayer-desktop/qmpplistwindow.cpp b/qmidiplayer-desktop/qmpplistwindow.cpp index 70b2e75..c455232 100644 --- a/qmidiplayer-desktop/qmpplistwindow.cpp +++ b/qmidiplayer-desktop/qmpplistwindow.cpp @@ -12,7 +12,7 @@ #define setButtonHeight(x,h) {x->setMaximumHeight(h*(logicalDpiY()/96.));x->setMinimumHeight(h*(logicalDpiY()/96.));} qmpPlistWindow::qmpPlistWindow(QWidget *parent) : - QWidget(parent,Qt::Window), + QWidget(parent,Qt::Dialog), ui(new Ui::qmpPlistWindow) { ui->setupUi(this); diff --git a/qmidiplayer-desktop/qmpsettingswindow.cpp b/qmidiplayer-desktop/qmpsettingswindow.cpp index d40b789..985dd67 100644 --- a/qmidiplayer-desktop/qmpsettingswindow.cpp +++ b/qmidiplayer-desktop/qmpsettingswindow.cpp @@ -385,7 +385,7 @@ void qmpSettingsWindow::verifySF() if(QMessageBox::question(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?"))==QMessageBox::Yes) + "Would you like to setup soundfonts now? After that you may have to reload the internal synth."))==QMessageBox::Yes) { show(); ui->tabWidget->setCurrentWidget(ui->tab_3); -- cgit v1.2.3