From 60f306607ead64f329a4c1f875af3b7ff5ad1149 Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Sun, 28 Feb 2016 11:09:54 +0800 Subject: Forbidden Magic. --- ChangeLog | 4 ++++ debian/changelog | 6 ++++++ qdialskulpturestyle.cpp | 4 ++++ qmpmainwindow.cpp | 2 ++ qmpmidiplay.cpp | 22 ++++++++++++++++++---- qmpsettingswindow.cpp | 3 ++- 6 files changed, 36 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4fe05a0..117910e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2016-02-28 0.7.0 beta +Significant sleep precision improvments for Windows. +Also save master volume in configuration file. + 2016-01-31 0.7.0 beta Modify default settings in for Win32. Initial MIDI mapper stub. diff --git a/debian/changelog b/debian/changelog index d237db3..5b25b81 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +qmidiplayer (0.7.0-1) UNRELEASED; urgency=low + + * New upstream release. + + -- chrisoft Sun, 28 Feb 2016 11:01:32 +0800 + qmidiplayer (0.7.0-0) UNRELEASED; urgency=low * New upstream release. diff --git a/qdialskulpturestyle.cpp b/qdialskulpturestyle.cpp index e7be93b..7c181a0 100644 --- a/qdialskulpturestyle.cpp +++ b/qdialskulpturestyle.cpp @@ -26,6 +26,10 @@ #include "qdialskulpturestyle.hpp" +#ifndef M_PI +#define M_PI 3.141592653589793f +#endif + static const bool UsePixmapCache = true; static void diff --git a/qmpmainwindow.cpp b/qmpmainwindow.cpp index 1e05c5c..73b9b73 100644 --- a/qmpmainwindow.cpp +++ b/qmpmainwindow.cpp @@ -47,6 +47,7 @@ qmpMainWindow::qmpMainWindow(QWidget *parent) : {ui->pbChannels->setChecked(true);on_pbChannels_clicked();} if(qmpSettingsWindow::getSettingsIntf()->value("DialogStatus/EfxWShown",0).toInt()) {ui->pbEfx->setChecked(true);on_pbEfx_clicked();} + ui->vsMasterVol->setValue(qmpSettingsWindow::getSettingsIntf()->value("Audio/Gain",50).toInt()); connect(fnA1,SIGNAL(triggered()),this,SLOT(onfnA1())); connect(fnA2,SIGNAL(triggered()),this,SLOT(onfnA2())); connect(timer,SIGNAL(timeout()),this,SLOT(updateWidgets())); @@ -318,6 +319,7 @@ void qmpMainWindow::on_hsTimer_sliderReleased() void qmpMainWindow::on_vsMasterVol_valueChanged() { if(!stopped)player->setGain(ui->vsMasterVol->value()/250.); + qmpSettingsWindow::getSettingsIntf()->setValue("Audio/Gain",ui->vsMasterVol->value()); } void qmpMainWindow::on_pbStop_clicked() diff --git a/qmpmidiplay.cpp b/qmpmidiplay.cpp index 8f89e88..b93b0d1 100644 --- a/qmpmidiplay.cpp +++ b/qmpmidiplay.cpp @@ -2,10 +2,10 @@ #include #include #include +#include "qmpmidiplay.hpp" #ifdef _WIN32 -#include +#include #endif -#include "qmpmidiplay.hpp" void CMidiPlayer::fluidPreInitialize() { settings=new_fluid_settings(); @@ -17,7 +17,7 @@ void CMidiPlayer::fluidInitialize() 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); -#ifndef WIN32 +#ifndef _WIN32 if(!singleInstance) { if(midiFile->getStandard()==4) @@ -127,6 +127,20 @@ void CMidiPlayer::processEventStub(const SEvent *e) break; } } +#ifdef _WIN32 +void w32usleep(uint64_t t) +{ + uint64_t st=0,ct=0,f=0; + QueryPerformanceFrequency((LARGE_INTEGER*)&f); + QueryPerformanceCounter((LARGE_INTEGER*)&st); + do{ + if(t>10000+(ct-st)*1000000/f)Sleep((t-(ct-st)*1000000/f)/2000); + else if(t>5000+(ct-st)*1000000/f)Sleep(1); + else std::this_thread::yield(); + QueryPerformanceCounter((LARGE_INTEGER*)&ct); + }while((ct-st)*1000000getEvent(0)->time;tceptrgetEventCount();) @@ -138,7 +152,7 @@ void CMidiPlayer::playEvents() if(resumed)resumed=false; else #ifdef _WIN32 - QThread::usleep((midiFile->getEvent(tceptr)->time-ct)*(dpt/1000)); + w32usleep((midiFile->getEvent(tceptr)->time-ct)*(dpt/1000)); #else std::this_thread::sleep_for(std::chrono::nanoseconds(midiFile->getEvent(tceptr)->time-ct)*dpt); #endif diff --git a/qmpsettingswindow.cpp b/qmpsettingswindow.cpp index 5058496..b1f620c 100644 --- a/qmpsettingswindow.cpp +++ b/qmpsettingswindow.cpp @@ -78,7 +78,7 @@ void qmpSettingsWindow::settingsInit() if(~selected)ui->cbAudioDrv->setCurrentIndex(selected); settings->setValue("Audio/Driver",ui->cbAudioDrv->currentText()); -#ifdef WIN32 +#ifdef _WIN32 #define DefBufSize 8192 #else #define DefBufSize 128 @@ -136,6 +136,7 @@ void qmpSettingsWindow::settingsInit() {selected=i;break;} if(~selected)ui->cbBSMode->setCurrentIndex(selected); settings->setValue("Audio/BankSelect",ui->cbBSMode->currentText()); + settings->setValue("Audio/Gain",settings->value("Audio/Gain",50)); int sfc=settings->value("SoundFonts/SFCount",0).toInt(); ui->lwSoundfont->clear();for(int i=1;i<=sfc;++i) -- cgit v1.2.3