diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | core/qmpmidiplay.cpp | 13 | ||||
-rw-r--r-- | core/qmpmidiplay.hpp | 12 | ||||
-rw-r--r-- | debian/changelog | 13 | ||||
-rw-r--r-- | debian/control | 8 | ||||
-rw-r--r-- | img/ledoff.png | bin | 0 -> 385 bytes | |||
-rw-r--r-- | img/ledoff.svg | 64 | ||||
-rw-r--r-- | img/ledon.png | bin | 0 -> 558 bytes | |||
-rw-r--r-- | img/ledon.svg | 64 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmidiplayer-desktop.pro | 12 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmpchannelswindow.cpp | 58 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmpchannelswindow.hpp | 13 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmpchannelswindow.ui | 9 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmphelpwindow.hpp | 2 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmpmainwindow.cpp | 22 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmpsettingswindow.cpp | 16 | ||||
-rw-r--r-- | qmidiplayer-desktop/resources.qrc | 2 | ||||
-rw-r--r-- | qmidiplayer-lite/qmidiplayer-lite.pro | 11 |
18 files changed, 285 insertions, 41 deletions
@@ -1,3 +1,10 @@ +2016-04-08 0.7.1 beta +Add MIDI activity indicator. +Substract time taken by sending midi data from sleep time. +Fix no soundfont loaded after rendering a file. +Modify default settings for Windows, solving the timing +problem for me. + 2016-04-07 0.7.1 beta MIDI mapper: first steps. diff --git a/core/qmpmidiplay.cpp b/core/qmpmidiplay.cpp index e65a2a1..4ee812f 100644 --- a/core/qmpmidiplay.cpp +++ b/core/qmpmidiplay.cpp @@ -55,10 +55,12 @@ void CMidiPlayer::processEvent(const SEvent *e) case 0x90://Note on if((mute>>(e->type&0x0F))&1)break;//muted if(solo&&!((solo>>(e->type&0x0F))&1))break; + if(noteOnCB)noteOnCB->callBack(noteOnCBUserData); if(mappedoutput[e->type&0x0F]) mapper->noteOn(mappedoutput[e->type&0x0F]-1,e->type*0x0F,e->p1,e->p2); else fluid_synth_noteon(synth,e->type&0x0F,e->p1,e->p2); + chstate[e->type&0x0F]=1; break; case 0xB0://CC if(e->p1==100)rpnid=e->p2; @@ -182,15 +184,20 @@ void CMidiPlayer::playEvents() for(uint32_t ct=midiFile->getEvent(0)->time;tceptr<midiFile->getEventCount();) { while(tcpaused)std::this_thread::sleep_for(std::chrono::milliseconds(100)); + using namespace std::chrono; + high_resolution_clock::time_point b=high_resolution_clock::now(); while(!tcstop&&midiFile&&tceptr<midiFile->getEventCount()&&ct==midiFile->getEvent(tceptr)->time) processEvent(midiFile->getEvent(tceptr++)); if(tcstop||!midiFile||tceptr>=midiFile->getEventCount())break; + high_resolution_clock::time_point a=high_resolution_clock::now(); + auto sendtime=a-b; if(resumed)resumed=false; else + if(sendtime.count()<(midiFile->getEvent(tceptr)->time-ct)*dpt) #if 0 w32usleep((midiFile->getEvent(tceptr)->time-ct)*(dpt/1000)); #else - std::this_thread::sleep_for(std::chrono::nanoseconds(midiFile->getEvent(tceptr)->time-ct)*dpt); + std::this_thread::sleep_for(std::chrono::nanoseconds((midiFile->getEvent(tceptr)->time-ct)*dpt-sendtime.count())); #endif if(tcstop||!midiFile)break; ct=midiFile->getEvent(tceptr)->time; @@ -251,6 +258,7 @@ CMidiPlayer::CMidiPlayer(bool singleInst) { midiFile=NULL;resumed=false;singleInstance=singleInst; settings=NULL;synth=NULL;adriver=NULL;waitvoice=true; + noteOnCB=NULL;noteOnCBUserData=NULL; memset(mappedoutput,0,sizeof(mappedoutput)); memset(deviceusage,0,sizeof(deviceusage)); mapper=new qmpMidiMapperRtMidi(); @@ -444,3 +452,6 @@ void CMidiPlayer::setChannelOutput(int ch,int devid) if(!deviceusage[origoutput-1])mapper->deviceDeinit(origoutput-1); } } +uint8_t* CMidiPlayer::getChstates(){return chstate;} +void CMidiPlayer::setNoteOnCallBack(CMidiCallBack *cb,void *userdata) +{noteOnCB=cb;noteOnCBUserData=userdata;} diff --git a/core/qmpmidiplay.hpp b/core/qmpmidiplay.hpp index a7e7f88..4592ea0 100644 --- a/core/qmpmidiplay.hpp +++ b/core/qmpmidiplay.hpp @@ -19,6 +19,13 @@ struct SEvent if(s){str=new char[strlen(s)+2];strcpy(str,s);}else str=NULL; } }; +class CMidiCallBack +{ + public: + CMidiCallBack(){} + virtual void callBack(void* data)=0; + virtual ~CMidiCallBack(){} +}; class CMidiFile { private: @@ -72,6 +79,9 @@ class CMidiPlayer uint32_t finished,resumed; qmpMidiMapperRtMidi *mapper; int mappedoutput[16],deviceusage[16],deviceiid[128]; + uint8_t chstate[16]; + CMidiCallBack *noteOnCB; + void* noteOnCBUserData; void setBit(uint16_t &n,uint16_t bn,uint16_t b); void processEvent(const SEvent *e); @@ -139,5 +149,7 @@ class CMidiPlayer qmpMidiMapperRtMidi* getMidiMapper(); void setChannelOutput(int ch,int devid); + uint8_t* getChstates(); + void setNoteOnCallBack(CMidiCallBack *cb,void *userdata); }; #endif diff --git a/debian/changelog b/debian/changelog index a57c578..b19c3e4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,16 @@ +qmidiplayer (0.7.1-1) UNRELEASED; urgency=low + + * New upstream release. + + -- chrisoft <chirs241097@gmail.com> Wed, 08 Apr 2016 23:48:08 +0800 + + +qmidiplayer (0.7.1-0) UNRELEASED; urgency=low + + * New upstream release. + + -- chrisoft <chirs241097@gmail.com> Wed, 07 Apr 2016 23:40:14 +0800 + qmidiplayer (0.7.0-6) UNRELEASED; urgency=low * Package qmidiplayer-lite. diff --git a/debian/control b/debian/control index 44eeaae..d79bb76 100644 --- a/debian/control +++ b/debian/control @@ -3,11 +3,15 @@ Maintainer: Chris Xiong <chirs241097@gmail.com> Section: sound Priority: optional Standards-Version: 3.9.2 -Build-Depends: debhelper (>= 9), qtbase5-dev, qt5-qmake, libfluidsynth-dev, +Build-Depends: debhelper (>= 9), + qtbase5-dev, + qt5-qmake, + libfluidsynth-dev, qml-module-qtquick-controls, qml-module-qtquick-window2, qml-module-qtquick2, - libqt5qml5 + libqt5qml5, + librtmidi-dev Package: qmidiplayer Architecture: any diff --git a/img/ledoff.png b/img/ledoff.png Binary files differnew file mode 100644 index 0000000..4c86677 --- /dev/null +++ b/img/ledoff.png diff --git a/img/ledoff.svg b/img/ledoff.svg new file mode 100644 index 0000000..e159382 --- /dev/null +++ b/img/ledoff.svg @@ -0,0 +1,64 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="22" + height="22" + viewBox="0 0 22 22" + id="svg2" + version="1.1" + inkscape:version="0.91 r13725" + sodipodi:docname="ledoff.svg"> + <defs + id="defs4" /> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="5.6" + inkscape:cx="-26.077981" + inkscape:cy="15.741909" + inkscape:document-units="px" + inkscape:current-layer="layer1" + showgrid="false" + units="px" + inkscape:window-width="1366" + inkscape:window-height="699" + inkscape:window-x="0" + inkscape:window-y="0" + inkscape:window-maximized="1" /> + <metadata + id="metadata7"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1" + transform="translate(0,-1030.3622)"> + <circle + style="opacity:1;fill:#e6e6e6;fill-opacity:0;stroke:#000000;stroke-width:1.50043499;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + id="path4800" + cx="11" + cy="1041.3622" + r="7.2497826" /> + </g> +</svg> diff --git a/img/ledon.png b/img/ledon.png Binary files differnew file mode 100644 index 0000000..b06f015 --- /dev/null +++ b/img/ledon.png diff --git a/img/ledon.svg b/img/ledon.svg new file mode 100644 index 0000000..c09e9cb --- /dev/null +++ b/img/ledon.svg @@ -0,0 +1,64 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="22" + height="22" + viewBox="0 0 22 22" + id="svg2" + version="1.1" + inkscape:version="0.91 r13725" + sodipodi:docname="ledon.svg"> + <defs + id="defs4" /> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="5.6" + inkscape:cx="-26.077981" + inkscape:cy="15.741909" + inkscape:document-units="px" + inkscape:current-layer="layer1" + showgrid="false" + units="px" + inkscape:window-width="1366" + inkscape:window-height="699" + inkscape:window-x="0" + inkscape:window-y="0" + inkscape:window-maximized="1" /> + <metadata + id="metadata7"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1" + transform="translate(0,-1030.3622)"> + <circle + style="opacity:1;fill:#00e04a;fill-opacity:1;stroke:#000000;stroke-width:1.50043499;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + id="path4800" + cx="11" + cy="1041.3622" + r="7.2497826" /> + </g> +</svg> diff --git a/qmidiplayer-desktop/qmidiplayer-desktop.pro b/qmidiplayer-desktop/qmidiplayer-desktop.pro index 0ac1b97..6ac0670 100644 --- a/qmidiplayer-desktop/qmidiplayer-desktop.pro +++ b/qmidiplayer-desktop/qmidiplayer-desktop.pro @@ -11,6 +11,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TARGET = qmidiplayer TEMPLATE = app +CONFIG += c++11 SOURCES += main.cpp\ qmpmainwindow.cpp \ @@ -57,9 +58,14 @@ unix{ BINDIR = $$PREFIX/bin target.path = $$BINDIR INSTALLS += target - QMAKE_CXXFLAGS += -std=c++11 -Wall + QMAKE_CXXFLAGS += -Wall LIBS += -lfluidsynth -lrtmidi } -win32:LIBS += e:/libs/fluidsynth/fluidsynth.lib winmm.lib #You have to change these -win32:INCLUDEPATH += e:/libs/fluidsynth/include #before building... +win32{ + #change these before building... + LIBS += e:/libs/fluidsynth/fluidsynth.lib winmm.lib + LIBS += e:/libs/rtmidi/rtmidi.lib + INCLUDEPATH += e:/libs/fluidsynth/include + INCLUDEPATH += e:/libs/rtmidi +} RESOURCES = resources.qrc diff --git a/qmidiplayer-desktop/qmpchannelswindow.cpp b/qmidiplayer-desktop/qmpchannelswindow.cpp index 4d5f6ab..3e43c3d 100644 --- a/qmidiplayer-desktop/qmpchannelswindow.cpp +++ b/qmidiplayer-desktop/qmpchannelswindow.cpp @@ -14,30 +14,38 @@ qmpChannelsWindow::qmpChannelsWindow(QWidget *parent) : ceditw=new qmpChannelEditor(this); connect(this,SIGNAL(dialogClosing()),parent,SLOT(dialogClosed())); mapper=qmpMainWindow::getInstance()->getPlayer()->getMidiMapper(); + cha=new QPixmap(":/img/ledon.png");chi=new QPixmap(":/img/ledoff.png"); + cb=new qmpCWNoteOnCB(); + qmpMainWindow::getInstance()->getPlayer()->setNoteOnCallBack(cb,NULL); + connect(cb,SIGNAL(onNoteOn()),this,SLOT(updateChannelActivity())); int devc=mapper->enumDevices(); for(int i=0;i<16;++i) { - ui->twChannels->setCellWidget(i,0,new QCheckBox("")); - connect(ui->twChannels->cellWidget(i,0),SIGNAL(stateChanged(int)),this,SLOT(channelMSChanged())); + ui->twChannels->setItem(i,0,new QTableWidgetItem()); + ui->twChannels->item(i,0)->setIcon(*chi); + ui->twChannels->item(i,0)->setFlags(ui->twChannels->item(i,0)->flags()^Qt::ItemIsEditable); ui->twChannels->setCellWidget(i,1,new QCheckBox("")); connect(ui->twChannels->cellWidget(i,1),SIGNAL(stateChanged(int)),this,SLOT(channelMSChanged())); - ui->twChannels->setCellWidget(i,2,new QDCComboBox()); - QDCComboBox *cb=(QDCComboBox*)ui->twChannels->cellWidget(i,2); + ui->twChannels->setCellWidget(i,2,new QCheckBox("")); + connect(ui->twChannels->cellWidget(i,2),SIGNAL(stateChanged(int)),this,SLOT(channelMSChanged())); + ui->twChannels->setCellWidget(i,3,new QDCComboBox()); + QDCComboBox *cb=(QDCComboBox*)ui->twChannels->cellWidget(i,3); cb->addItem("Internal FluidSynth");cb->setID(i); for(int j=0;j<devc;++j)cb->addItem(mapper->deviceName(j).c_str()); connect(cb,SIGNAL(onChange(int,int)),this,SLOT(changeMidiMapping(int,int))); - ui->twChannels->setCellWidget(i,3,new QDCLabel("")); - ((QDCLabel*)ui->twChannels->cellWidget(i,3))->setID(i); - connect(ui->twChannels->cellWidget(i,3),SIGNAL(onDoubleClick(int)),this,SLOT(showPresetWindow(int))); - ui->twChannels->setCellWidget(i,4,new QDCPushButton("...")); + ui->twChannels->setCellWidget(i,4,new QDCLabel("")); ((QDCLabel*)ui->twChannels->cellWidget(i,4))->setID(i); - connect(ui->twChannels->cellWidget(i,4),SIGNAL(onClick(int)),this,SLOT(showChannelEditorWindow(int))); + connect(ui->twChannels->cellWidget(i,4),SIGNAL(onDoubleClick(int)),this,SLOT(showPresetWindow(int))); + ui->twChannels->setCellWidget(i,5,new QDCPushButton("...")); + ((QDCLabel*)ui->twChannels->cellWidget(i,5))->setID(i); + connect(ui->twChannels->cellWidget(i,5),SIGNAL(onClick(int)),this,SLOT(showChannelEditorWindow(int))); } - ui->twChannels->setColumnWidth(0,32); + ui->twChannels->setColumnWidth(0,24); ui->twChannels->setColumnWidth(1,32); - ui->twChannels->setColumnWidth(2,192); + ui->twChannels->setColumnWidth(2,32); ui->twChannels->setColumnWidth(3,192); - ui->twChannels->setColumnWidth(4,32); + ui->twChannels->setColumnWidth(4,192); + ui->twChannels->setColumnWidth(5,32); } void qmpChannelsWindow::showEvent(QShowEvent *event) @@ -68,12 +76,19 @@ void qmpChannelsWindow::moveEvent(QMoveEvent *event) } } +void qmpChannelsWindow::updateChannelActivity() +{ + for(int i=0;i<16;++i) + ui->twChannels->item(i,0)->setIcon( + qmpMainWindow::getInstance()->getPlayer()->getChstates()[i]?*cha:*chi); +} + void qmpChannelsWindow::channelWindowsUpdate() { if(qmpMainWindow::getInstance()->getPlayer()->isFinished()) { for(int i=0;i<16;++i) - ((QLabel*)ui->twChannels->cellWidget(i,3))->setText(""); + ((QLabel*)ui->twChannels->cellWidget(i,4))->setText(""); return; } for(int i=0;i<16;++i) @@ -82,7 +97,11 @@ void qmpChannelsWindow::channelWindowsUpdate() int b,p; qmpMainWindow::getInstance()->getPlayer()->getChannelPreset(i,&b,&p,nm); sprintf(data,"%d:%d %s",b,p,nm); - ((QLabel*)ui->twChannels->cellWidget(i,3))->setText(data); + ((QLabel*)ui->twChannels->cellWidget(i,4))->setText(data); + ui->twChannels->item(i,0)->setIcon( + qmpMainWindow::getInstance()->getPlayer()->getChstates()[i]?*cha:*chi); + if(qmpMainWindow::getInstance()->getPlayer()->getChstates()[i]) + qmpMainWindow::getInstance()->getPlayer()->getChstates()[i]=0; } } @@ -91,8 +110,8 @@ void qmpChannelsWindow::channelMSChanged() for(int i=0;i<16;++i) { QCheckBox *m,*s; - m=(QCheckBox*)ui->twChannels->cellWidget(i,0); - s=(QCheckBox*)ui->twChannels->cellWidget(i,1); + m=(QCheckBox*)ui->twChannels->cellWidget(i,1); + s=(QCheckBox*)ui->twChannels->cellWidget(i,2); if(m->isChecked()&&s->isChecked())s->setChecked(false); qmpMainWindow::getInstance()->getPlayer()->setMute(i,m->isChecked()); qmpMainWindow::getInstance()->getPlayer()->setSolo(i,s->isChecked()); @@ -101,14 +120,15 @@ void qmpChannelsWindow::channelMSChanged() qmpChannelsWindow::~qmpChannelsWindow() { - delete ui; + delete chi;delete cha; + delete cb;delete ui; } void qmpChannelsWindow::on_pbUnmute_clicked() { for(int i=0;i<16;++i) { - ((QCheckBox*)ui->twChannels->cellWidget(i,0))->setChecked(false); + ((QCheckBox*)ui->twChannels->cellWidget(i,1))->setChecked(false); qmpMainWindow::getInstance()->getPlayer()->setMute(i,false); } } @@ -117,7 +137,7 @@ void qmpChannelsWindow::on_pbUnsolo_clicked() { for(int i=0;i<16;++i) { - ((QCheckBox*)ui->twChannels->cellWidget(i,1))->setChecked(false); + ((QCheckBox*)ui->twChannels->cellWidget(i,2))->setChecked(false); qmpMainWindow::getInstance()->getPlayer()->setSolo(i,false); } } diff --git a/qmidiplayer-desktop/qmpchannelswindow.hpp b/qmidiplayer-desktop/qmpchannelswindow.hpp index 57f293e..80f427a 100644 --- a/qmidiplayer-desktop/qmpchannelswindow.hpp +++ b/qmidiplayer-desktop/qmpchannelswindow.hpp @@ -10,6 +10,7 @@ #include <QMoveEvent> #include "qmppresetselect.hpp" #include "qmpchanneleditor.hpp" +#include "../core/qmpmidiplay.hpp" #include "../core/qmpmidimappers.hpp" namespace Ui { @@ -58,6 +59,15 @@ class QDCComboBox:public QComboBox void indexChangedSlot(int idx){emit(onChange(id,idx));} }; +class qmpCWNoteOnCB:public QObject,public CMidiCallBack +{ + Q_OBJECT + public: + void callBack(void *data){if(data)data=NULL;emit(onNoteOn());} + signals: + void onNoteOn(); +}; + class qmpChannelsWindow:public QDialog { Q_OBJECT @@ -72,6 +82,7 @@ class qmpChannelsWindow:public QDialog void dialogClosing(); public slots: void channelWindowsUpdate(); + void updateChannelActivity(); void channelMSChanged(); void showPresetWindow(int chid); void showChannelEditorWindow(int chid); @@ -84,6 +95,8 @@ class qmpChannelsWindow:public QDialog qmpPresetSelector *pselectw; qmpChannelEditor *ceditw; qmpMidiMapperRtMidi *mapper; + QPixmap *cha,*chi; + qmpCWNoteOnCB *cb; }; #endif // QMPCHANNELSWINDOW_H diff --git a/qmidiplayer-desktop/qmpchannelswindow.ui b/qmidiplayer-desktop/qmpchannelswindow.ui index a8b43cb..2d85ab0 100644 --- a/qmidiplayer-desktop/qmpchannelswindow.ui +++ b/qmidiplayer-desktop/qmpchannelswindow.ui @@ -49,7 +49,7 @@ <number>16</number> </property> <property name="columnCount"> - <number>5</number> + <number>6</number> </property> <row/> <row/> @@ -69,6 +69,11 @@ <row/> <column> <property name="text"> + <string>A</string> + </property> + </column> + <column> + <property name="text"> <string>M</string> </property> </column> @@ -92,7 +97,7 @@ <string>...</string> </property> </column> - <item row="0" column="0"> + <item row="0" column="1"> <property name="text"> <string/> </property> diff --git a/qmidiplayer-desktop/qmphelpwindow.hpp b/qmidiplayer-desktop/qmphelpwindow.hpp index c2052b2..af1b746 100644 --- a/qmidiplayer-desktop/qmphelpwindow.hpp +++ b/qmidiplayer-desktop/qmphelpwindow.hpp @@ -2,7 +2,7 @@ #define QMPHELPWINDOW_H #include <QDialog> -#define APP_VERSION "0.7.0" +#define APP_VERSION "0.7.1" namespace Ui { class qmpHelpWindow; diff --git a/qmidiplayer-desktop/qmpmainwindow.cpp b/qmidiplayer-desktop/qmpmainwindow.cpp index 32d28f2..37ca9f4 100644 --- a/qmidiplayer-desktop/qmpmainwindow.cpp +++ b/qmidiplayer-desktop/qmpmainwindow.cpp @@ -9,6 +9,7 @@ #ifdef _WIN32 #include <Windows.h> #endif +#define UPDATE_INTERVAL 66 qmpMainWindow* qmpMainWindow::ref=NULL; @@ -188,7 +189,7 @@ void qmpMainWindow::updateWidgets() SetThreadPriority(playerTh->native_handle(),THREAD_PRIORITY_TIME_CRITICAL); #endif st=std::chrono::steady_clock::now();offset=0; - timer->start(100); + timer->start(UPDATE_INTERVAL); } } if(renderTh) @@ -199,7 +200,14 @@ void qmpMainWindow::updateWidgets() ui->centralWidget->setEnabled(true); delete renderTh;renderTh=NULL; player->rendererDeinit(); - if(singleFS){player->fluidPreInitialize();playerSetup();player->fluidInitialize();} + if(singleFS) + { + player->fluidPreInitialize(); + playerSetup(); + player->fluidInitialize(); + for(int i=settingsw->getSFWidget()->count()-1;i>=0;--i) + player->pushSoundFont(settingsw->getSFWidget()->item(i)->text().toStdString().c_str()); + } } } while(!player->isFinished()&&player->getTCeptr()>player->getStamp(ui->hsTimer->value()) @@ -281,7 +289,7 @@ void qmpMainWindow::on_pbPlayPause_clicked() SetThreadPriority(playerTh->native_handle(),THREAD_PRIORITY_TIME_CRITICAL); #endif st=std::chrono::steady_clock::now();offset=0; - timer->start(100); + timer->start(UPDATE_INTERVAL); stopped=false; } else @@ -405,7 +413,7 @@ void qmpMainWindow::on_pbPrev_clicked() SetThreadPriority(playerTh->native_handle(),THREAD_PRIORITY_TIME_CRITICAL); #endif st=std::chrono::steady_clock::now();offset=0; - timer->start(100); + timer->start(UPDATE_INTERVAL); } void qmpMainWindow::on_pbNext_clicked() @@ -430,7 +438,7 @@ void qmpMainWindow::on_pbNext_clicked() SetThreadPriority(playerTh->native_handle(),THREAD_PRIORITY_TIME_CRITICAL); #endif st=std::chrono::steady_clock::now();offset=0; - timer->start(100); + timer->start(UPDATE_INTERVAL); } void qmpMainWindow::selectionChanged() @@ -458,7 +466,7 @@ void qmpMainWindow::selectionChanged() SetThreadPriority(playerTh->native_handle(),THREAD_PRIORITY_TIME_CRITICAL); #endif st=std::chrono::steady_clock::now();offset=0; - timer->start(100); + timer->start(UPDATE_INTERVAL); } void qmpMainWindow::on_pbEfx_clicked() @@ -495,7 +503,7 @@ void qmpMainWindow::onfnA2() ui->centralWidget->setEnabled(false); for(int i=settingsw->getSFWidget()->count()-1;i>=0;--i) player->pushSoundFont(settingsw->getSFWidget()->item(i)->text().toStdString().c_str()); - player->setGain(ui->vsMasterVol->value()/250.);efxw->sendEfxChange();timer->start(100); + player->setGain(ui->vsMasterVol->value()/250.);efxw->sendEfxChange();timer->start(UPDATE_INTERVAL); renderTh=new std::thread(&CMidiPlayer::rendererThread,player); } diff --git a/qmidiplayer-desktop/qmpsettingswindow.cpp b/qmidiplayer-desktop/qmpsettingswindow.cpp index c2e31a2..2074972 100644 --- a/qmidiplayer-desktop/qmpsettingswindow.cpp +++ b/qmidiplayer-desktop/qmpsettingswindow.cpp @@ -82,7 +82,7 @@ void qmpSettingsWindow::settingsInit() settings->setValue("Audio/Driver",ui->cbAudioDrv->currentText()); #ifdef _WIN32 -#define DefBufSize 8192 +#define DefBufSize 256 #else #define DefBufSize 128 #endif @@ -97,15 +97,21 @@ void qmpSettingsWindow::settingsInit() settings->setValue("Audio/BufSize",ui->cbBufSize->currentText().toInt()); #undef DefBufSize +#ifdef _WIN32 +#define DefBufCnt 8 +#else +#define DefBufCnt 2 +#endif selected=-1; for(int i=0;i<ui->cbBufCnt->count();++i) - if(ui->cbBufCnt->itemText(i).toInt()==settings->value("Audio/BufCnt",2).toInt()) + if(ui->cbBufCnt->itemText(i).toInt()==settings->value("Audio/BufCnt",DefBufCnt).toInt()) {selected=i;break;} if(~selected)ui->cbBufCnt->setCurrentIndex(selected); - else if(settings->value("Audio/BufCnt",2).toInt()>=2&&settings->value("Audio/BufCnt",2).toInt()<=64) - ui->cbBufCnt->setCurrentText(settings->value("Audio/BufCnt",2).toString()); - else ui->cbBufCnt->setCurrentText("2"); + else if(settings->value("Audio/BufCnt",DefBufCnt).toInt()>=2&&settings->value("Audio/BufCnt",DefBufCnt).toInt()<=64) + ui->cbBufCnt->setCurrentText(settings->value("Audio/BufCnt",DefBufCnt).toString()); + else ui->cbBufCnt->setCurrentText(QString::number(DefBufCnt)); settings->setValue("Audio/BufCnt",ui->cbBufCnt->currentText().toInt()); +#undef DefBufCnt selected=-1; for(int i=0;i<ui->cbFormat->count();++i) diff --git a/qmidiplayer-desktop/resources.qrc b/qmidiplayer-desktop/resources.qrc index 351d2fa..d34966d 100644 --- a/qmidiplayer-desktop/resources.qrc +++ b/qmidiplayer-desktop/resources.qrc @@ -25,6 +25,8 @@ <file>../img/stop.png</file> <file>../img/up.png</file> <file>../img/visualization.png</file> + <file>../img/ledon.png</file> + <file>../img/ledoff.png</file> <file>../img/mainw.png</file> <file>../img/chanw.png</file> <file>../doc/index.html</file> diff --git a/qmidiplayer-lite/qmidiplayer-lite.pro b/qmidiplayer-lite/qmidiplayer-lite.pro index 4307068..7d901f6 100644 --- a/qmidiplayer-lite/qmidiplayer-lite.pro +++ b/qmidiplayer-lite/qmidiplayer-lite.pro @@ -22,5 +22,14 @@ HEADERS += \ ../core/qmpmidiplay.hpp \ qmpcorewrapper.hpp \ ../core/qmpmidimappers.hpp - +unix{ LIBS += -lfluidsynth -lrtmidi +} + +win32{ + #change these before building... + LIBS += e:/libs/fluidsynth/fluidsynth.lib winmm.lib + LIBS += e:/libs/rtmidi/rtmidi.lib + INCLUDEPATH += e:/libs/fluidsynth/include + INCLUDEPATH += e:/libs/rtmidi +} |