From d418712c981d9854fa6429d65773368ca63b8dac Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Fri, 1 Jan 2016 23:54:06 +0800 Subject: Strawberry Crisis. (WTF) --- ChangeLog | 4 + README.md | 2 +- qmidiplayer.pro | 15 +- qmpchanneleditor.cpp | 208 ++++++------ qmpchanneleditor.hpp | 43 +-- qmpchannelswindow.hpp | 2 - qmpefxwindow.ui | 868 +++++++++++++++++++++++++------------------------- qmpinfowindow.cpp | 4 + qmpinfowindow.ui | 15 +- qmpmainwindow.cpp | 22 +- qmpmainwindow.hpp | 6 +- qmpmainwindow.ui | 6 + qmpmidiplay.cpp | 4 +- qmpmidiplay.hpp | 4 +- qmpmidiread.cpp | 17 +- qmpsettingswindow.cpp | 33 ++ qmpsettingswindow.hpp | 31 ++ qmpsettingswindow.ui | 538 +++++++++++++++++++++++++++++++ 18 files changed, 1217 insertions(+), 605 deletions(-) create mode 100644 qmpsettingswindow.cpp create mode 100644 qmpsettingswindow.hpp create mode 100644 qmpsettingswindow.ui diff --git a/ChangeLog b/ChangeLog index 7a4f458..a2c0e22 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2016-01-01 0.5.0 +Bug fixes. Minor code refactoring. +Initial stubs for the settings window. + 2015-12-31 0.5.0 Implemented effect parameter editor and file information window. Bump version. diff --git a/README.md b/README.md index 31e0275..3c86da4 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Currently it's still very incomplete and not suitable for everyday use. Planned features: * Channel mute/solo * Editing channel parameters on-the-fly -* Playlists (partially implemented) +* Playlists * Editing synthesizer effects * Visualization (not implemented) * Rendering midi to wave file (not implemented) diff --git a/qmidiplayer.pro b/qmidiplayer.pro index 5f505dc..6c2e710 100644 --- a/qmidiplayer.pro +++ b/qmidiplayer.pro @@ -17,28 +17,31 @@ SOURCES += main.cpp\ qmpmidiplay.cpp \ qmpmidiread.cpp \ qmpplistwindow.cpp \ - qmpChannelsWindow.cpp \ + qmpchannelswindow.cpp \ qmppresetselect.cpp \ qmpchanneleditor.cpp \ qmpefxwindow.cpp \ - qmpinfowindow.cpp + qmpinfowindow.cpp \ + qmpsettingswindow.cpp HEADERS += qmpmainwindow.hpp \ qmpmidiplay.hpp \ qmpplistwindow.hpp \ - qmpChannelsWindow.hpp \ + qmpchannelswindow.hpp \ qmppresetselect.hpp \ qmpchanneleditor.hpp \ qmpefxwindow.hpp \ - qmpinfowindow.hpp + qmpinfowindow.hpp \ + qmpsettingswindow.hpp FORMS += qmpmainwindow.ui \ qmpplistwindow.ui \ - qmpChannelsWindow.ui \ + qmpchannelswindow.ui \ qmppresetselect.ui \ qmpchanneleditor.ui \ qmpefxwindow.ui \ - qmpinfowindow.ui + qmpinfowindow.ui \ + qmpsettingswindow.ui QMAKE_CXXFLAGS += -std=c++11 -Wall LIBS += -lfluidsynth diff --git a/qmpchanneleditor.cpp b/qmpchanneleditor.cpp index 09308da..95dedcc 100644 --- a/qmpchanneleditor.cpp +++ b/qmpchanneleditor.cpp @@ -69,132 +69,120 @@ void qmpChannelEditor::sendCC() void qmpChannelEditor::showEvent(QShowEvent *e) { - e->accept(); + knobpressed=0; + setupWindow(); + connectSlots(); connect(qmpMainWindow::getInstance()->getTimer(),SIGNAL(timeout()),this,SLOT(setupWindow())); + e->accept(); } void qmpChannelEditor::closeEvent(QCloseEvent *e) { - e->accept(); + disconnectSlots(); disconnect(qmpMainWindow::getInstance()->getTimer(),SIGNAL(timeout()),this,SLOT(setupWindow())); + e->accept(); } void qmpChannelEditor::on_pbChLeft_clicked() { + disconnectSlots(); if(ch>0)--ch;else ch=15;setupWindow(); + connectSlots(); } void qmpChannelEditor::on_pbChRight_clicked() { + disconnectSlots(); if(ch<15)++ch;else ch=0;setupWindow(); + connectSlots(); } -#define dc disconnect(qmpMainWindow::getInstance()->getTimer(),SIGNAL(timeout()),this,SLOT(setupWindow())) -#define rc connect(qmpMainWindow::getInstance()->getTimer(),SIGNAL(timeout()),this,SLOT(setupWindow()));sendCC() - -void qmpChannelEditor::on_dCut_sliderPressed() -{dc;} - -void qmpChannelEditor::on_dReso_sliderPressed() -{dc;} - -void qmpChannelEditor::on_dReverb_sliderPressed() -{dc;} - -void qmpChannelEditor::on_dChorus_sliderPressed() -{dc;} - -void qmpChannelEditor::on_dVol_sliderPressed() -{dc;} - -void qmpChannelEditor::on_dPan_sliderPressed() -{dc;} - -void qmpChannelEditor::on_dAttack_sliderPressed() -{dc;} - -void qmpChannelEditor::on_dDecay_sliderPressed() -{dc;} - -void qmpChannelEditor::on_dRelease_sliderPressed() -{dc;} - -void qmpChannelEditor::on_dRate_sliderPressed() -{dc;} - -void qmpChannelEditor::on_dDepth_sliderPressed() -{dc;} - -void qmpChannelEditor::on_dDelay_sliderPressed() -{dc;} - -void qmpChannelEditor::on_dAttack_sliderReleased() -{rc;} - -void qmpChannelEditor::on_dDecay_sliderReleased() -{rc;} - -void qmpChannelEditor::on_dRelease_sliderReleased() -{rc;} - -void qmpChannelEditor::on_dRate_sliderReleased() -{rc;} - -void qmpChannelEditor::on_dDepth_sliderReleased() -{rc;} +void qmpChannelEditor::commonPressed() +{disconnect(qmpMainWindow::getInstance()->getTimer(),SIGNAL(timeout()),this,SLOT(setupWindow()));knobpressed=1;} +void qmpChannelEditor::commonReleased() +{connect(qmpMainWindow::getInstance()->getTimer(),SIGNAL(timeout()),this,SLOT(setupWindow()));sendCC();knobpressed=0;} +void qmpChannelEditor::commonChanged() +{if(knobpressed){sendCC();setupWindow();}} -void qmpChannelEditor::on_dDelay_sliderReleased() -{rc;} - -void qmpChannelEditor::on_dCut_sliderReleased() -{rc;} - -void qmpChannelEditor::on_dReso_sliderReleased() -{rc;} - -void qmpChannelEditor::on_dReverb_sliderReleased() -{rc;} - -void qmpChannelEditor::on_dChorus_sliderReleased() -{rc;} - -void qmpChannelEditor::on_dVol_sliderReleased() -{rc;} - -void qmpChannelEditor::on_dPan_sliderReleased() -{rc;} - -void qmpChannelEditor::on_dCut_valueChanged() -{rc;} - -void qmpChannelEditor::on_dReso_valueChanged() -{rc;} - -void qmpChannelEditor::on_dReverb_valueChanged() -{rc;} - -void qmpChannelEditor::on_dChorus_valueChanged() -{rc;} - -void qmpChannelEditor::on_dVol_valueChanged() -{rc;} - -void qmpChannelEditor::on_dPan_valueChanged() -{rc;} - -void qmpChannelEditor::on_dAttack_valueChanged() -{rc;} - -void qmpChannelEditor::on_dDecay_valueChanged() -{rc;} - -void qmpChannelEditor::on_dRelease_valueChanged() -{rc;} - -void qmpChannelEditor::on_dRate_valueChanged() -{rc;} - -void qmpChannelEditor::on_dDepth_valueChanged() -{rc;} +void qmpChannelEditor::connectSlots() +{ + connect(ui->dCut,SIGNAL(sliderPressed()),this,SLOT(commonPressed())); + connect(ui->dReso,SIGNAL(sliderPressed()),this,SLOT(commonPressed())); + connect(ui->dReverb,SIGNAL(sliderPressed()),this,SLOT(commonPressed())); + connect(ui->dChorus,SIGNAL(sliderPressed()),this,SLOT(commonPressed())); + connect(ui->dVol,SIGNAL(sliderPressed()),this,SLOT(commonPressed())); + connect(ui->dPan,SIGNAL(sliderPressed()),this,SLOT(commonPressed())); + connect(ui->dAttack,SIGNAL(sliderPressed()),this,SLOT(commonPressed())); + connect(ui->dDecay,SIGNAL(sliderPressed()),this,SLOT(commonPressed())); + connect(ui->dRelease,SIGNAL(sliderPressed()),this,SLOT(commonPressed())); + connect(ui->dRate,SIGNAL(sliderPressed()),this,SLOT(commonPressed())); + connect(ui->dDepth,SIGNAL(sliderPressed()),this,SLOT(commonPressed())); + connect(ui->dDelay,SIGNAL(sliderPressed()),this,SLOT(commonPressed())); + + connect(ui->dCut,SIGNAL(sliderReleased()),this,SLOT(commonReleased())); + connect(ui->dReso,SIGNAL(sliderReleased()),this,SLOT(commonReleased())); + connect(ui->dReverb,SIGNAL(sliderReleased()),this,SLOT(commonReleased())); + connect(ui->dChorus,SIGNAL(sliderReleased()),this,SLOT(commonReleased())); + connect(ui->dVol,SIGNAL(sliderReleased()),this,SLOT(commonReleased())); + connect(ui->dPan,SIGNAL(sliderReleased()),this,SLOT(commonReleased())); + connect(ui->dAttack,SIGNAL(sliderReleased()),this,SLOT(commonReleased())); + connect(ui->dDecay,SIGNAL(sliderReleased()),this,SLOT(commonReleased())); + connect(ui->dRelease,SIGNAL(sliderReleased()),this,SLOT(commonReleased())); + connect(ui->dRate,SIGNAL(sliderReleased()),this,SLOT(commonReleased())); + connect(ui->dDepth,SIGNAL(sliderReleased()),this,SLOT(commonReleased())); + connect(ui->dDelay,SIGNAL(sliderReleased()),this,SLOT(commonReleased())); + + connect(ui->dCut,SIGNAL(valueChanged(int)),this,SLOT(commonChanged())); + connect(ui->dReso,SIGNAL(valueChanged(int)),this,SLOT(commonChanged())); + connect(ui->dReverb,SIGNAL(valueChanged(int)),this,SLOT(commonChanged())); + connect(ui->dChorus,SIGNAL(valueChanged(int)),this,SLOT(commonChanged())); + connect(ui->dVol,SIGNAL(valueChanged(int)),this,SLOT(commonChanged())); + connect(ui->dPan,SIGNAL(valueChanged(int)),this,SLOT(commonChanged())); + connect(ui->dAttack,SIGNAL(valueChanged(int)),this,SLOT(commonChanged())); + connect(ui->dDecay,SIGNAL(valueChanged(int)),this,SLOT(commonChanged())); + connect(ui->dRelease,SIGNAL(valueChanged(int)),this,SLOT(commonChanged())); + connect(ui->dRate,SIGNAL(valueChanged(int)),this,SLOT(commonChanged())); + connect(ui->dDepth,SIGNAL(valueChanged(int)),this,SLOT(commonChanged())); + connect(ui->dDelay,SIGNAL(valueChanged(int)),this,SLOT(commonChanged())); +} -void qmpChannelEditor::on_dDelay_valueChanged() -{rc;} +void qmpChannelEditor::disconnectSlots() +{ + disconnect(ui->dCut,SIGNAL(sliderPressed()),this,SLOT(commonPressed())); + disconnect(ui->dReso,SIGNAL(sliderPressed()),this,SLOT(commonPressed())); + disconnect(ui->dReverb,SIGNAL(sliderPressed()),this,SLOT(commonPressed())); + disconnect(ui->dChorus,SIGNAL(sliderPressed()),this,SLOT(commonPressed())); + disconnect(ui->dVol,SIGNAL(sliderPressed()),this,SLOT(commonPressed())); + disconnect(ui->dPan,SIGNAL(sliderPressed()),this,SLOT(commonPressed())); + disconnect(ui->dAttack,SIGNAL(sliderPressed()),this,SLOT(commonPressed())); + disconnect(ui->dDecay,SIGNAL(sliderPressed()),this,SLOT(commonPressed())); + disconnect(ui->dRelease,SIGNAL(sliderPressed()),this,SLOT(commonPressed())); + disconnect(ui->dRate,SIGNAL(sliderPressed()),this,SLOT(commonPressed())); + disconnect(ui->dDepth,SIGNAL(sliderPressed()),this,SLOT(commonPressed())); + disconnect(ui->dDelay,SIGNAL(sliderPressed()),this,SLOT(commonPressed())); + + disconnect(ui->dCut,SIGNAL(sliderReleased()),this,SLOT(commonReleased())); + disconnect(ui->dReso,SIGNAL(sliderReleased()),this,SLOT(commonReleased())); + disconnect(ui->dReverb,SIGNAL(sliderReleased()),this,SLOT(commonReleased())); + disconnect(ui->dChorus,SIGNAL(sliderReleased()),this,SLOT(commonReleased())); + disconnect(ui->dVol,SIGNAL(sliderReleased()),this,SLOT(commonReleased())); + disconnect(ui->dPan,SIGNAL(sliderReleased()),this,SLOT(commonReleased())); + disconnect(ui->dAttack,SIGNAL(sliderReleased()),this,SLOT(commonReleased())); + disconnect(ui->dDecay,SIGNAL(sliderReleased()),this,SLOT(commonReleased())); + disconnect(ui->dRelease,SIGNAL(sliderReleased()),this,SLOT(commonReleased())); + disconnect(ui->dRate,SIGNAL(sliderReleased()),this,SLOT(commonReleased())); + disconnect(ui->dDepth,SIGNAL(sliderReleased()),this,SLOT(commonReleased())); + disconnect(ui->dDelay,SIGNAL(sliderReleased()),this,SLOT(commonReleased())); + + disconnect(ui->dCut,SIGNAL(valueChanged(int)),this,SLOT(commonChanged())); + disconnect(ui->dReso,SIGNAL(valueChanged(int)),this,SLOT(commonChanged())); + disconnect(ui->dReverb,SIGNAL(valueChanged(int)),this,SLOT(commonChanged())); + disconnect(ui->dChorus,SIGNAL(valueChanged(int)),this,SLOT(commonChanged())); + disconnect(ui->dVol,SIGNAL(valueChanged(int)),this,SLOT(commonChanged())); + disconnect(ui->dPan,SIGNAL(valueChanged(int)),this,SLOT(commonChanged())); + disconnect(ui->dAttack,SIGNAL(valueChanged(int)),this,SLOT(commonChanged())); + disconnect(ui->dDecay,SIGNAL(valueChanged(int)),this,SLOT(commonChanged())); + disconnect(ui->dRelease,SIGNAL(valueChanged(int)),this,SLOT(commonChanged())); + disconnect(ui->dRate,SIGNAL(valueChanged(int)),this,SLOT(commonChanged())); + disconnect(ui->dDepth,SIGNAL(valueChanged(int)),this,SLOT(commonChanged())); + disconnect(ui->dDelay,SIGNAL(valueChanged(int)),this,SLOT(commonChanged())); +} diff --git a/qmpchanneleditor.hpp b/qmpchanneleditor.hpp index 5927122..c98bfd5 100644 --- a/qmpchanneleditor.hpp +++ b/qmpchanneleditor.hpp @@ -23,49 +23,18 @@ class qmpChannelEditor:public QDialog void setupWindow(int chid=-1); private slots: + void commonPressed(); + void commonReleased(); + void commonChanged(); void on_pbChLeft_clicked(); void on_pbChRight_clicked(); - void on_dCut_sliderPressed(); - void on_dReso_sliderPressed(); - void on_dReverb_sliderPressed(); - void on_dChorus_sliderPressed(); - void on_dVol_sliderPressed(); - void on_dPan_sliderPressed(); - void on_dAttack_sliderPressed(); - void on_dDecay_sliderPressed(); - void on_dRelease_sliderPressed(); - void on_dRate_sliderPressed(); - void on_dDepth_sliderPressed(); - void on_dDelay_sliderPressed(); - void on_dAttack_sliderReleased(); - void on_dDecay_sliderReleased(); - void on_dRelease_sliderReleased(); - void on_dRate_sliderReleased(); - void on_dDepth_sliderReleased(); - void on_dDelay_sliderReleased(); - void on_dCut_sliderReleased(); - void on_dReso_sliderReleased(); - void on_dReverb_sliderReleased(); - void on_dChorus_sliderReleased(); - void on_dVol_sliderReleased(); - void on_dPan_sliderReleased(); - void on_dCut_valueChanged(); - void on_dReso_valueChanged(); - void on_dReverb_valueChanged(); - void on_dChorus_valueChanged(); - void on_dVol_valueChanged(); - void on_dPan_valueChanged(); - void on_dAttack_valueChanged(); - void on_dDecay_valueChanged(); - void on_dRelease_valueChanged(); - void on_dRate_valueChanged(); - void on_dDepth_valueChanged(); - void on_dDelay_valueChanged(); private: Ui::qmpChannelEditor *ui; - int ch; + int ch,knobpressed; void sendCC(); + void connectSlots(); + void disconnectSlots(); }; #endif // QMPCHANNELEDITOR_H diff --git a/qmpchannelswindow.hpp b/qmpchannelswindow.hpp index a3ce667..992b264 100644 --- a/qmpchannelswindow.hpp +++ b/qmpchannelswindow.hpp @@ -55,9 +55,7 @@ class qmpChannelsWindow:public QDialog void channelMSChanged(); void showPresetWindow(int chid); void showChannelEditorWindow(int chid); - private slots: void on_pbUnmute_clicked(); - void on_pbUnsolo_clicked(); private: diff --git a/qmpefxwindow.ui b/qmpefxwindow.ui index 53d3fff..39c4d6a 100644 --- a/qmpefxwindow.ui +++ b/qmpefxwindow.ui @@ -10,442 +10,444 @@ 177 + + + 546 + 177 + + + + + 546 + 177 + + Effects - - - - 10 - 10 - 261 - 161 - - - - Reverb - - - - - 80 - 4 - 21 - 24 - - - - - - - - - - 10 - 30 - 50 - 51 - - - - 120 - - - - - - 200 - 30 - 50 - 51 - - - - 100 - - - - - - 10 - 103 - 50 - 51 - - - - 100 - - - - - - 200 - 103 - 50 - 51 - - - - 100 - - - - - - 60 - 30 - 41 - 20 - - - - Room - - - - - - 60 - 50 - 51 - 21 - - - - 120 - - - - - - 140 - 30 - 51 - 20 - - - - Damp - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - 140 - 50 - 56 - 21 - - - - 100 - - - - - - 60 - 100 - 51 - 20 - - - - Width - - - - - - 60 - 120 - 56 - 21 - - - - 100 - - - - - - 145 - 100 - 51 - 20 - - - - Level - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - 140 - 120 - 56 - 21 - - - - 100 - - - - - - - 270 - 10 - 261 - 161 - - - - Chorus - - - - - 80 - 4 - 21 - 24 - - - - - - - - - - 10 - 30 - 50 - 51 - - - - 99 - - - - - - 200 - 30 - 50 - 51 - - - - 29 - - - 500 - - - 29 - - - - - - 10 - 103 - 50 - 51 - - - - 210 - - - - - - 200 - 103 - 50 - 51 - - - - 100 - - - - - - 60 - 30 - 71 - 20 - - - - Feedback - - - - - - 60 - 50 - 51 - 21 - - - - 99 - - - - - - 140 - 30 - 51 - 20 - - - - Rate - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - 60 - 100 - 51 - 20 - - - - Depth - - - - - - 145 - 100 - 51 - 20 - - - - Level - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - 140 - 120 - 56 - 21 - - - - 100 - - - - - - 137 - 50 - 61 - 21 - - - - 0.290000000000000 - - - 5.000000000000000 - - - 0.100000000000000 - - - - - - 35 - 77 - 41 - 20 - - - - LFO - - - - - - 70 - 77 - 61 - 20 - - - - Sine - - - - - - 145 - 77 - 91 - 20 - - - - Trian&gle - - - - - - 60 - 120 - 51 - 21 - - - - 1 - - - 21.000000000000000 - - - 0.100000000000000 - - - + + + + + Reverb + + + + + 80 + 4 + 21 + 24 + + + + + + + + + + 10 + 30 + 50 + 51 + + + + 120 + + + + + + 200 + 30 + 50 + 51 + + + + 100 + + + + + + 10 + 103 + 50 + 51 + + + + 100 + + + + + + 200 + 103 + 50 + 51 + + + + 100 + + + + + + 60 + 30 + 41 + 20 + + + + Room + + + + + + 60 + 50 + 51 + 21 + + + + 120 + + + + + + 140 + 30 + 51 + 20 + + + + Damp + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 140 + 50 + 56 + 21 + + + + 100 + + + + + + 60 + 100 + 51 + 20 + + + + Width + + + + + + 60 + 120 + 56 + 21 + + + + 100 + + + + + + 145 + 100 + 51 + 20 + + + + Level + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 140 + 120 + 56 + 21 + + + + 100 + + + + + + + + Chorus + + + + + 80 + 4 + 21 + 24 + + + + + + + + + + 10 + 30 + 50 + 51 + + + + 99 + + + + + + 200 + 30 + 50 + 51 + + + + 29 + + + 500 + + + 29 + + + + + + 10 + 103 + 50 + 51 + + + + 210 + + + + + + 200 + 103 + 50 + 51 + + + + 100 + + + + + + 60 + 30 + 71 + 20 + + + + Feedback + + + + + + 60 + 50 + 51 + 21 + + + + 99 + + + + + + 140 + 30 + 51 + 20 + + + + Rate + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 60 + 100 + 51 + 20 + + + + Depth + + + + + + 145 + 100 + 51 + 20 + + + + Level + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 140 + 120 + 56 + 21 + + + + 100 + + + + + + 137 + 50 + 61 + 21 + + + + 0.290000000000000 + + + 5.000000000000000 + + + 0.100000000000000 + + + + + + 35 + 77 + 41 + 20 + + + + LFO + + + + + + 70 + 77 + 61 + 20 + + + + Sine + + + + + + 145 + 77 + 91 + 20 + + + + Trian&gle + + + + + + 60 + 120 + 51 + 21 + + + + 1 + + + 21.000000000000000 + + + 0.100000000000000 + + + + + diff --git a/qmpinfowindow.cpp b/qmpinfowindow.cpp index 93cbb81..4e214b4 100644 --- a/qmpinfowindow.cpp +++ b/qmpinfowindow.cpp @@ -23,11 +23,15 @@ void qmpInfoWindow::updateInfo() CMidiPlayer* player=qmpMainWindow::getInstance()->getPlayer(); ui->lbFileName->setText(QString("File name: ")+qmpMainWindow::getInstance()->getFileName()); if(player->getTitle())ui->lbTitle->setText(QString("Title: ")+player->getTitle()); + else ui->lbTitle->setText(QString("Title: ")); if(player->getCopyright())ui->lbCopyright->setText(QString("Copyright: ")+player->getCopyright()); + else ui->lbCopyright->setText(QString("Copyright: ")); ui->lbTempo->setText(QString("Tempo: ")+QString::number(player->getTempo(),'g',5)); int t,r;player->getCurrentKeySignature(&t);r=(int8_t)((t>>8)&0xFF)+7; strncpy(str,t&0xFF?minors+2*r:majors+2*r,2);str[2]='\0'; ui->lbKeySig->setText(QString("Key Sig.: ")+str); player->getCurrentTimeSignature(&t,&r);sprintf(str,"Time Sig.: %d/%d",t,r); ui->lbTimeSig->setText(str); + sprintf(str,"Note count: %u",player->getFileNoteCount()); + ui->lbNoteCount->setText(str); } diff --git a/qmpinfowindow.ui b/qmpinfowindow.ui index 689b817..480c3ec 100644 --- a/qmpinfowindow.ui +++ b/qmpinfowindow.ui @@ -7,9 +7,15 @@ 0 0 400 - 111 + 135 + + + 400 + 135 + + File Information @@ -60,6 +66,13 @@ + + + + Note count: + + + diff --git a/qmpmainwindow.cpp b/qmpmainwindow.cpp index dd2d74a..3756417 100644 --- a/qmpmainwindow.cpp +++ b/qmpmainwindow.cpp @@ -17,6 +17,7 @@ qmpMainWindow::qmpMainWindow(QWidget *parent) : chnlw=new qmpChannelsWindow(this); efxw=new qmpEfxWindow(this); infow=new qmpInfoWindow(this); + settingsw=new qmpSettingsWindow(this); timer=new QTimer(this);ref=this; fnA1=new QAction("File Information",ui->lbFileName); ui->lbFileName->addAction(fnA1); @@ -35,11 +36,14 @@ qmpMainWindow::~qmpMainWindow() void qmpMainWindow::closeEvent(QCloseEvent *event) { on_pbStop_clicked(); - efxw->close();chnlw->close();plistw->close();infow->close(); + efxw->close();chnlw->close(); + plistw->close();infow->close(); + settingsw->close(); delete efxw;efxw=NULL; delete chnlw;chnlw=NULL; delete plistw;plistw=NULL; delete infow;infow=NULL; + delete settingsw;settingsw=NULL; event->accept(); } @@ -52,6 +56,7 @@ void qmpMainWindow::updateWidgets() timer->stop();stopped=true;playing=false; player->playerDeinit();playerTh->join(); delete playerTh;playerTh=NULL; + chnlw->on_pbUnmute_clicked();chnlw->on_pbUnsolo_clicked(); ui->pbPlayPause->setIcon(QIcon(":/img/play.png")); ui->hsTimer->setValue(0); ui->lbPolyphone->setText("Poly: 0/0"); @@ -62,6 +67,7 @@ void qmpMainWindow::updateWidgets() timer->stop();player->playerDeinit();playerTh->join(); delete playerTh;playerTh=NULL; ui->hsTimer->setValue(0); + chnlw->on_pbUnmute_clicked();chnlw->on_pbUnsolo_clicked(); QString fns=plistw->getNextItem(); ui->lbFileName->setText(QUrl(fns).fileName()); player->playerLoadFile(fns.toStdString().c_str()); @@ -164,6 +170,7 @@ void qmpMainWindow::on_pbStop_clicked() timer->stop();stopped=true;playing=false; player->playerDeinit(); if(playerTh){playerTh->join();delete playerTh;playerTh=NULL;} + chnlw->on_pbUnmute_clicked();chnlw->on_pbUnsolo_clicked(); ui->pbPlayPause->setIcon(QIcon(":/img/play.png")); ui->hsTimer->setValue(0); ui->lbPolyphone->setText("Poly: 0/0"); @@ -176,6 +183,7 @@ void qmpMainWindow::dialogClosed() if(!plistw->isVisible())ui->pbPList->setChecked(false); if(!chnlw->isVisible())ui->pbChannels->setChecked(false); if(!efxw->isVisible())ui->pbEfx->setChecked(false); + if(!settingsw->isVisible())ui->pbSettings->setChecked(false); } void qmpMainWindow::on_pbPList_clicked() @@ -192,7 +200,7 @@ void qmpMainWindow::on_pbPrev_clicked() { timer->stop();player->playerDeinit(); if(playerTh){playerTh->join();delete playerTh;playerTh=NULL;} - ui->hsTimer->setValue(0); + ui->hsTimer->setValue(0);chnlw->on_pbUnmute_clicked();chnlw->on_pbUnsolo_clicked(); QString fns=plistw->getPrevItem();if(fns.length()==0)return on_pbStop_clicked(); ui->lbFileName->setText(QUrl(fns).fileName()); player->playerLoadFile(fns.toStdString().c_str()); @@ -209,7 +217,7 @@ void qmpMainWindow::on_pbNext_clicked() { timer->stop();player->playerDeinit(); if(playerTh){playerTh->join();delete playerTh;playerTh=NULL;} - ui->hsTimer->setValue(0); + ui->hsTimer->setValue(0);chnlw->on_pbUnmute_clicked();chnlw->on_pbUnsolo_clicked(); QString fns=plistw->getNextItem();if(fns.length()==0)return on_pbStop_clicked(); ui->lbFileName->setText(QUrl(fns).fileName()); player->playerLoadFile(fns.toStdString().c_str()); @@ -229,6 +237,7 @@ void qmpMainWindow::selectionChanged() timer->stop();player->playerDeinit(); if(playerTh){playerTh->join();delete playerTh;playerTh=NULL;} ui->hsTimer->setValue(0); + chnlw->on_pbUnmute_clicked();chnlw->on_pbUnsolo_clicked(); QString fns=plistw->getSelectedItem(); ui->lbFileName->setText(QUrl(fns).fileName()); player->playerLoadFile(fns.toStdString().c_str()); @@ -243,7 +252,7 @@ void qmpMainWindow::selectionChanged() void qmpMainWindow::on_pbEfx_clicked() { - efxw->show(); + if(ui->pbEfx->isChecked())efxw->show();else efxw->close(); } void qmpMainWindow::on_lbFileName_customContextMenuRequested(const QPoint &pos) @@ -257,3 +266,8 @@ void qmpMainWindow::onfnA1() { infow->show(); } + +void qmpMainWindow::on_pbSettings_clicked() +{ + if(ui->pbSettings->isChecked())settingsw->show();else settingsw->close(); +} diff --git a/qmpmainwindow.hpp b/qmpmainwindow.hpp index b123feb..de45d3b 100644 --- a/qmpmainwindow.hpp +++ b/qmpmainwindow.hpp @@ -13,6 +13,7 @@ #include "qmpchannelswindow.hpp" #include "qmpefxwindow.hpp" #include "qmpinfowindow.hpp" +#include "qmpsettingswindow.hpp" namespace Ui { class qmpMainWindow; @@ -44,7 +45,9 @@ class qmpMainWindow:public QMainWindow void on_lbFileName_customContextMenuRequested(const QPoint &pos); void onfnA1(); - public slots: + void on_pbSettings_clicked(); + + public slots: void dialogClosed(); void selectionChanged(); @@ -60,6 +63,7 @@ class qmpMainWindow:public QMainWindow qmpChannelsWindow *chnlw; qmpEfxWindow *efxw; qmpInfoWindow *infow; + qmpSettingsWindow *settingsw; QAction *fnA1,*fnA2; public: QString getFileName(); diff --git a/qmpmainwindow.ui b/qmpmainwindow.ui index 4f00da1..1439166 100644 --- a/qmpmainwindow.ui +++ b/qmpmainwindow.ui @@ -187,6 +187,9 @@ 32 + + true + @@ -277,6 +280,9 @@ 32 + + true + diff --git a/qmpmidiplay.cpp b/qmpmidiplay.cpp index 0eae6aa..adfdeb6 100644 --- a/qmpmidiplay.cpp +++ b/qmpmidiplay.cpp @@ -8,7 +8,6 @@ void CMidiPlayer::fluidInitialize(const char* sf) settings=new_fluid_settings(); fluid_settings_setstr(settings,"audio.driver","pulseaudio"); fluid_settings_setint(settings,"synth.cpu-cores",4); - fluid_settings_setint(settings,"synth.min-note-length",0); fluid_settings_setint(settings,"synth.polyphony",2048); synth=new_fluid_synth(settings); adriver=new_fluid_audio_driver(settings,synth); @@ -149,7 +148,7 @@ void CMidiPlayer::fileTimer2Pass() for(int i=0;i<16;++i)for(int j=0;j<132;++j) ccstamps[c][i][j]=ccc[i][j]; stamps[c++]=eptr; - if(c>100)throw; + if(c>100)break; } ct=midiFile->getEvent(eptr)->time; } @@ -211,6 +210,7 @@ void CMidiPlayer::setTCeptr(uint32_t ep,uint32_t st) double CMidiPlayer::getFtime(){return ftime;} void CMidiPlayer::getCurrentTimeSignature(int *n,int *d){*n=ctsn;*d=ctsd;} void CMidiPlayer::getCurrentKeySignature(int *ks){*ks=cks;} +uint32_t CMidiPlayer::getFileNoteCount(){return midiFile->getNoteCount();} const char* CMidiPlayer::getTitle(){return midiFile->getTitle();} const char* CMidiPlayer::getCopyright(){return midiFile->getCopyright();} double CMidiPlayer::getTempo(){return 60./(ctempo/1e6)*ctsd/4.;} diff --git a/qmpmidiplay.hpp b/qmpmidiplay.hpp index 472e46e..88aa097 100644 --- a/qmpmidiplay.hpp +++ b/qmpmidiplay.hpp @@ -36,13 +36,14 @@ class CMidiFile int eventReader(); void trackChunkReader(); void headerChunkReader(); - void chunkReader(int hdrXp); + int chunkReader(int hdrXp); public: CMidiFile(const char* fn); ~CMidiFile(); const SEvent* getEvent(uint32_t id); uint32_t getEventCount(); uint32_t getDivision(); + uint32_t getNoteCount(); const char* getTitle(); const char* getCopyright(); }; @@ -91,6 +92,7 @@ class CMidiPlayer double getFtime(); void getCurrentTimeSignature(int *n,int *d); void getCurrentKeySignature(int *ks); + uint32_t getFileNoteCount(); double getTempo(); const char* getTitle(); const char* getCopyright(); diff --git a/qmpmidiread.cpp b/qmpmidiread.cpp index 0d9a7bc..8f7ad28 100644 --- a/qmpmidiread.cpp +++ b/qmpmidiread.cpp @@ -181,27 +181,29 @@ void CMidiFile::headerChunkReader() if(divs&0x8000)error(1,"E: SMTPE format is not supported."); for(;byteread0;--chnklen)fgetc(f); + for(int chnklen=readDW();chnklen>0;--chnklen)fgetc(f);return 0; } - else trackChunkReader(); + else return trackChunkReader(),1; } CMidiFile::CMidiFile(const char* fn) { - title=copyright=NULL; + if(title)delete[] title; + if(copyright)delete[] copyright; + title=copyright=NULL;notes=0; if(!(f=fopen(fn,"rb")))exit((printf("E: file %s doesn't exist!\n",fn),2)); chunkReader(1); - for(uint32_t i=0;isetupUi(this); + connect(this,SIGNAL(dialogClosing()),parent,SLOT(dialogClosed())); +} + +qmpSettingsWindow::~qmpSettingsWindow() +{ + delete ui; +} + +void qmpSettingsWindow::closeEvent(QCloseEvent *event) +{ + setVisible(false); + emit dialogClosing(); + event->accept(); +} + +void qmpSettingsWindow::on_buttonBox_accepted() +{ + emit dialogClosing(); +} + +void qmpSettingsWindow::on_buttonBox_rejected() +{ + emit dialogClosing(); +} diff --git a/qmpsettingswindow.hpp b/qmpsettingswindow.hpp new file mode 100644 index 0000000..0b5f886 --- /dev/null +++ b/qmpsettingswindow.hpp @@ -0,0 +1,31 @@ +#ifndef QMPSETTINGSWINDOW_H +#define QMPSETTINGSWINDOW_H + +#include +#include + +namespace Ui { + class qmpSettingsWindow; +} + +class qmpSettingsWindow:public QDialog +{ + Q_OBJECT + + public: + explicit qmpSettingsWindow(QWidget *parent=0); + ~qmpSettingsWindow(); + void closeEvent(QCloseEvent *event); + signals: + void dialogClosing(); + + private slots: + void on_buttonBox_accepted(); + + void on_buttonBox_rejected(); + + private: + Ui::qmpSettingsWindow *ui; +}; + +#endif // QMPSETTINGSWINDOW_H diff --git a/qmpsettingswindow.ui b/qmpsettingswindow.ui new file mode 100644 index 0000000..36f4616 --- /dev/null +++ b/qmpsettingswindow.ui @@ -0,0 +1,538 @@ + + + qmpSettingsWindow + + + + 0 + 0 + 439 + 407 + + + + + 439 + 407 + + + + Settings + + + + + + 0 + + + + Midi + + + + + + Disable Midi Mapping + + + + + + + Default Output Device + + + + + + + + + + Send SysEx + + + + + + + Text Encoding + + + + + + + + Unicode + + + + + Big5 + + + + + Big5-HKSCS + + + + + CP949 + + + + + EUC-JP + + + + + EUC-KR + + + + + GB18030 + + + + + KOI8-R + + + + + KOI8-U + + + + + Macintosh + + + + + Shift-JIS + + + + + + + + + Synth + + + + + + Audio Buffer Count + + + + + + + Audio Buffer Size + + + + + + + true + + + + + + + Audio Frequency + + + + + + + true + + + + + + + Audio Driver + + + + + + + + + + Audio Format + + + + + + + + + + + + + 1 + + + 65535 + + + 2048 + + + + + + + Max Polyphony + + + + + + + Auto bank select mode + + + + + + + Bank select mode + + + + + + + + + + + Soundfonts + + + + + + + + + + + + + + + :/img/add.png:/img/add.png + + + + 24 + 24 + + + + + + + + + + + + :/img/remove.png:/img/remove.png + + + + 24 + 24 + + + + + + + + + + + + :/img/up.png:/img/up.png + + + + 24 + 24 + + + + + + + + + + + + :/img/down.png:/img/down.png + + + + 24 + 24 + + + + + + + + + + + Behavior + + + + + + Restore last playlist on startup + + + + + + + Load files in the same folder + + + + + + + Save dialog status + + + + + + + Save parameters in effects window + + + + + + + + + Visualization Mode + + + + + + + + + + + + + + View distance + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 50 + 20 + + + + + + + + + 60 + 0 + + + + Qt::Horizontal + + + + + + + + + + + + + + Note stretch + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 60 + 20 + + + + + + + + + 60 + 0 + + + + Qt::Horizontal + + + + + + + + + + + + + + Fog Start + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 82 + 20 + + + + + + + + + 60 + 0 + + + + Qt::Horizontal + + + + + + + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + + + buttonBox + accepted() + qmpSettingsWindow + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + qmpSettingsWindow + reject() + + + 316 + 260 + + + 286 + 274 + + + + + -- cgit v1.2.3