diff options
author | Chris Xiong <chirs241097@gmail.com> | 2016-01-01 23:54:06 +0800 |
---|---|---|
committer | Chris Xiong <chirs241097@gmail.com> | 2016-01-01 23:54:06 +0800 |
commit | d418712c981d9854fa6429d65773368ca63b8dac (patch) | |
tree | 48eb1f25753a1734a3d7cf5d8303e7936c4844f3 | |
parent | 3db127ce64eadb54568e218124744a1de713667e (diff) | |
download | QMidiPlayer-d418712c981d9854fa6429d65773368ca63b8dac.tar.xz |
Strawberry Crisis. (WTF)
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | qmidiplayer.pro | 15 | ||||
-rw-r--r-- | qmpchanneleditor.cpp | 208 | ||||
-rw-r--r-- | qmpchanneleditor.hpp | 43 | ||||
-rw-r--r-- | qmpchannelswindow.hpp | 2 | ||||
-rw-r--r-- | qmpefxwindow.ui | 868 | ||||
-rw-r--r-- | qmpinfowindow.cpp | 4 | ||||
-rw-r--r-- | qmpinfowindow.ui | 15 | ||||
-rw-r--r-- | qmpmainwindow.cpp | 22 | ||||
-rw-r--r-- | qmpmainwindow.hpp | 6 | ||||
-rw-r--r-- | qmpmainwindow.ui | 6 | ||||
-rw-r--r-- | qmpmidiplay.cpp | 4 | ||||
-rw-r--r-- | qmpmidiplay.hpp | 4 | ||||
-rw-r--r-- | qmpmidiread.cpp | 17 | ||||
-rw-r--r-- | qmpsettingswindow.cpp | 33 | ||||
-rw-r--r-- | qmpsettingswindow.hpp | 31 | ||||
-rw-r--r-- | qmpsettingswindow.ui | 538 |
18 files changed, 1217 insertions, 605 deletions
@@ -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. @@ -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 @@ <height>177</height> </rect> </property> + <property name="minimumSize"> + <size> + <width>546</width> + <height>177</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>546</width> + <height>177</height> + </size> + </property> <property name="windowTitle"> <string>Effects</string> </property> - <widget class="QGroupBox" name="gReverb"> - <property name="geometry"> - <rect> - <x>10</x> - <y>10</y> - <width>261</width> - <height>161</height> - </rect> - </property> - <property name="title"> - <string>Reverb</string> - </property> - <widget class="QCheckBox" name="cbEnabledR"> - <property name="geometry"> - <rect> - <x>80</x> - <y>4</y> - <width>21</width> - <height>24</height> - </rect> - </property> - <property name="text"> - <string/> - </property> - </widget> - <widget class="QDial" name="dRoom"> - <property name="geometry"> - <rect> - <x>10</x> - <y>30</y> - <width>50</width> - <height>51</height> - </rect> - </property> - <property name="maximum"> - <number>120</number> - </property> - </widget> - <widget class="QDial" name="dDamp"> - <property name="geometry"> - <rect> - <x>200</x> - <y>30</y> - <width>50</width> - <height>51</height> - </rect> - </property> - <property name="maximum"> - <number>100</number> - </property> - </widget> - <widget class="QDial" name="dWidth"> - <property name="geometry"> - <rect> - <x>10</x> - <y>103</y> - <width>50</width> - <height>51</height> - </rect> - </property> - <property name="maximum"> - <number>100</number> - </property> - </widget> - <widget class="QDial" name="dLevelR"> - <property name="geometry"> - <rect> - <x>200</x> - <y>103</y> - <width>50</width> - <height>51</height> - </rect> - </property> - <property name="maximum"> - <number>100</number> - </property> - </widget> - <widget class="QLabel" name="lbRoom"> - <property name="geometry"> - <rect> - <x>60</x> - <y>30</y> - <width>41</width> - <height>20</height> - </rect> - </property> - <property name="text"> - <string>Room</string> - </property> - </widget> - <widget class="QSpinBox" name="sbRoom"> - <property name="geometry"> - <rect> - <x>60</x> - <y>50</y> - <width>51</width> - <height>21</height> - </rect> - </property> - <property name="maximum"> - <number>120</number> - </property> - </widget> - <widget class="QLabel" name="lbDamp"> - <property name="geometry"> - <rect> - <x>140</x> - <y>30</y> - <width>51</width> - <height>20</height> - </rect> - </property> - <property name="text"> - <string>Damp</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - </widget> - <widget class="QSpinBox" name="sbDamp"> - <property name="geometry"> - <rect> - <x>140</x> - <y>50</y> - <width>56</width> - <height>21</height> - </rect> - </property> - <property name="maximum"> - <number>100</number> - </property> - </widget> - <widget class="QLabel" name="lbWidth"> - <property name="geometry"> - <rect> - <x>60</x> - <y>100</y> - <width>51</width> - <height>20</height> - </rect> - </property> - <property name="text"> - <string>Width</string> - </property> - </widget> - <widget class="QSpinBox" name="sbWidth"> - <property name="geometry"> - <rect> - <x>60</x> - <y>120</y> - <width>56</width> - <height>21</height> - </rect> - </property> - <property name="maximum"> - <number>100</number> - </property> - </widget> - <widget class="QLabel" name="lbLevelR"> - <property name="geometry"> - <rect> - <x>145</x> - <y>100</y> - <width>51</width> - <height>20</height> - </rect> - </property> - <property name="text"> - <string>Level</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - </widget> - <widget class="QSpinBox" name="sbLevelR"> - <property name="geometry"> - <rect> - <x>140</x> - <y>120</y> - <width>56</width> - <height>21</height> - </rect> - </property> - <property name="maximum"> - <number>100</number> - </property> - </widget> - </widget> - <widget class="QGroupBox" name="gChorus"> - <property name="geometry"> - <rect> - <x>270</x> - <y>10</y> - <width>261</width> - <height>161</height> - </rect> - </property> - <property name="title"> - <string>Chorus</string> - </property> - <widget class="QCheckBox" name="cbEnabledC"> - <property name="geometry"> - <rect> - <x>80</x> - <y>4</y> - <width>21</width> - <height>24</height> - </rect> - </property> - <property name="text"> - <string/> - </property> - </widget> - <widget class="QDial" name="dFeedBack"> - <property name="geometry"> - <rect> - <x>10</x> - <y>30</y> - <width>50</width> - <height>51</height> - </rect> - </property> - <property name="maximum"> - <number>99</number> - </property> - </widget> - <widget class="QDial" name="dRate"> - <property name="geometry"> - <rect> - <x>200</x> - <y>30</y> - <width>50</width> - <height>51</height> - </rect> - </property> - <property name="minimum"> - <number>29</number> - </property> - <property name="maximum"> - <number>500</number> - </property> - <property name="value"> - <number>29</number> - </property> - </widget> - <widget class="QDial" name="dDepth"> - <property name="geometry"> - <rect> - <x>10</x> - <y>103</y> - <width>50</width> - <height>51</height> - </rect> - </property> - <property name="maximum"> - <number>210</number> - </property> - </widget> - <widget class="QDial" name="dLevelC"> - <property name="geometry"> - <rect> - <x>200</x> - <y>103</y> - <width>50</width> - <height>51</height> - </rect> - </property> - <property name="maximum"> - <number>100</number> - </property> - </widget> - <widget class="QLabel" name="lbFeedBack"> - <property name="geometry"> - <rect> - <x>60</x> - <y>30</y> - <width>71</width> - <height>20</height> - </rect> - </property> - <property name="text"> - <string>Feedback</string> - </property> - </widget> - <widget class="QSpinBox" name="sbFeedBack"> - <property name="geometry"> - <rect> - <x>60</x> - <y>50</y> - <width>51</width> - <height>21</height> - </rect> - </property> - <property name="maximum"> - <number>99</number> - </property> - </widget> - <widget class="QLabel" name="lbRate"> - <property name="geometry"> - <rect> - <x>140</x> - <y>30</y> - <width>51</width> - <height>20</height> - </rect> - </property> - <property name="text"> - <string>Rate</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - </widget> - <widget class="QLabel" name="lbDepth"> - <property name="geometry"> - <rect> - <x>60</x> - <y>100</y> - <width>51</width> - <height>20</height> - </rect> - </property> - <property name="text"> - <string>Depth</string> - </property> - </widget> - <widget class="QLabel" name="lbLevelC"> - <property name="geometry"> - <rect> - <x>145</x> - <y>100</y> - <width>51</width> - <height>20</height> - </rect> - </property> - <property name="text"> - <string>Level</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - </widget> - <widget class="QSpinBox" name="sbLevelC"> - <property name="geometry"> - <rect> - <x>140</x> - <y>120</y> - <width>56</width> - <height>21</height> - </rect> - </property> - <property name="maximum"> - <number>100</number> - </property> - </widget> - <widget class="QDoubleSpinBox" name="sbRate"> - <property name="geometry"> - <rect> - <x>137</x> - <y>50</y> - <width>61</width> - <height>21</height> - </rect> - </property> - <property name="minimum"> - <double>0.290000000000000</double> - </property> - <property name="maximum"> - <double>5.000000000000000</double> - </property> - <property name="singleStep"> - <double>0.100000000000000</double> - </property> - </widget> - <widget class="QLabel" name="lbLFO"> - <property name="geometry"> - <rect> - <x>35</x> - <y>77</y> - <width>41</width> - <height>20</height> - </rect> - </property> - <property name="text"> - <string>LFO</string> - </property> - </widget> - <widget class="QRadioButton" name="rbSine"> - <property name="geometry"> - <rect> - <x>70</x> - <y>77</y> - <width>61</width> - <height>20</height> - </rect> - </property> - <property name="text"> - <string>Sine</string> - </property> - </widget> - <widget class="QRadioButton" name="rbTriangle"> - <property name="geometry"> - <rect> - <x>145</x> - <y>77</y> - <width>91</width> - <height>20</height> - </rect> - </property> - <property name="text"> - <string>Trian&gle</string> - </property> - </widget> - <widget class="QDoubleSpinBox" name="sbDepth"> - <property name="geometry"> - <rect> - <x>60</x> - <y>120</y> - <width>51</width> - <height>21</height> - </rect> - </property> - <property name="decimals"> - <number>1</number> - </property> - <property name="maximum"> - <double>21.000000000000000</double> - </property> - <property name="singleStep"> - <double>0.100000000000000</double> - </property> - </widget> - </widget> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QGroupBox" name="gReverb"> + <property name="title"> + <string>Reverb</string> + </property> + <widget class="QCheckBox" name="cbEnabledR"> + <property name="geometry"> + <rect> + <x>80</x> + <y>4</y> + <width>21</width> + <height>24</height> + </rect> + </property> + <property name="text"> + <string/> + </property> + </widget> + <widget class="QDial" name="dRoom"> + <property name="geometry"> + <rect> + <x>10</x> + <y>30</y> + <width>50</width> + <height>51</height> + </rect> + </property> + <property name="maximum"> + <number>120</number> + </property> + </widget> + <widget class="QDial" name="dDamp"> + <property name="geometry"> + <rect> + <x>200</x> + <y>30</y> + <width>50</width> + <height>51</height> + </rect> + </property> + <property name="maximum"> + <number>100</number> + </property> + </widget> + <widget class="QDial" name="dWidth"> + <property name="geometry"> + <rect> + <x>10</x> + <y>103</y> + <width>50</width> + <height>51</height> + </rect> + </property> + <property name="maximum"> + <number>100</number> + </property> + </widget> + <widget class="QDial" name="dLevelR"> + <property name="geometry"> + <rect> + <x>200</x> + <y>103</y> + <width>50</width> + <height>51</height> + </rect> + </property> + <property name="maximum"> + <number>100</number> + </property> + </widget> + <widget class="QLabel" name="lbRoom"> + <property name="geometry"> + <rect> + <x>60</x> + <y>30</y> + <width>41</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>Room</string> + </property> + </widget> + <widget class="QSpinBox" name="sbRoom"> + <property name="geometry"> + <rect> + <x>60</x> + <y>50</y> + <width>51</width> + <height>21</height> + </rect> + </property> + <property name="maximum"> + <number>120</number> + </property> + </widget> + <widget class="QLabel" name="lbDamp"> + <property name="geometry"> + <rect> + <x>140</x> + <y>30</y> + <width>51</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>Damp</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + <widget class="QSpinBox" name="sbDamp"> + <property name="geometry"> + <rect> + <x>140</x> + <y>50</y> + <width>56</width> + <height>21</height> + </rect> + </property> + <property name="maximum"> + <number>100</number> + </property> + </widget> + <widget class="QLabel" name="lbWidth"> + <property name="geometry"> + <rect> + <x>60</x> + <y>100</y> + <width>51</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>Width</string> + </property> + </widget> + <widget class="QSpinBox" name="sbWidth"> + <property name="geometry"> + <rect> + <x>60</x> + <y>120</y> + <width>56</width> + <height>21</height> + </rect> + </property> + <property name="maximum"> + <number>100</number> + </property> + </widget> + <widget class="QLabel" name="lbLevelR"> + <property name="geometry"> + <rect> + <x>145</x> + <y>100</y> + <width>51</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>Level</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + <widget class="QSpinBox" name="sbLevelR"> + <property name="geometry"> + <rect> + <x>140</x> + <y>120</y> + <width>56</width> + <height>21</height> + </rect> + </property> + <property name="maximum"> + <number>100</number> + </property> + </widget> + </widget> + </item> + <item> + <widget class="QGroupBox" name="gChorus"> + <property name="title"> + <string>Chorus</string> + </property> + <widget class="QCheckBox" name="cbEnabledC"> + <property name="geometry"> + <rect> + <x>80</x> + <y>4</y> + <width>21</width> + <height>24</height> + </rect> + </property> + <property name="text"> + <string/> + </property> + </widget> + <widget class="QDial" name="dFeedBack"> + <property name="geometry"> + <rect> + <x>10</x> + <y>30</y> + <width>50</width> + <height>51</height> + </rect> + </property> + <property name="maximum"> + <number>99</number> + </property> + </widget> + <widget class="QDial" name="dRate"> + <property name="geometry"> + <rect> + <x>200</x> + <y>30</y> + <width>50</width> + <height>51</height> + </rect> + </property> + <property name="minimum"> + <number>29</number> + </property> + <property name="maximum"> + <number>500</number> + </property> + <property name="value"> + <number>29</number> + </property> + </widget> + <widget class="QDial" name="dDepth"> + <property name="geometry"> + <rect> + <x>10</x> + <y>103</y> + <width>50</width> + <height>51</height> + </rect> + </property> + <property name="maximum"> + <number>210</number> + </property> + </widget> + <widget class="QDial" name="dLevelC"> + <property name="geometry"> + <rect> + <x>200</x> + <y>103</y> + <width>50</width> + <height>51</height> + </rect> + </property> + <property name="maximum"> + <number>100</number> + </property> + </widget> + <widget class="QLabel" name="lbFeedBack"> + <property name="geometry"> + <rect> + <x>60</x> + <y>30</y> + <width>71</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>Feedback</string> + </property> + </widget> + <widget class="QSpinBox" name="sbFeedBack"> + <property name="geometry"> + <rect> + <x>60</x> + <y>50</y> + <width>51</width> + <height>21</height> + </rect> + </property> + <property name="maximum"> + <number>99</number> + </property> + </widget> + <widget class="QLabel" name="lbRate"> + <property name="geometry"> + <rect> + <x>140</x> + <y>30</y> + <width>51</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>Rate</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + <widget class="QLabel" name="lbDepth"> + <property name="geometry"> + <rect> + <x>60</x> + <y>100</y> + <width>51</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>Depth</string> + </property> + </widget> + <widget class="QLabel" name="lbLevelC"> + <property name="geometry"> + <rect> + <x>145</x> + <y>100</y> + <width>51</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>Level</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + <widget class="QSpinBox" name="sbLevelC"> + <property name="geometry"> + <rect> + <x>140</x> + <y>120</y> + <width>56</width> + <height>21</height> + </rect> + </property> + <property name="maximum"> + <number>100</number> + </property> + </widget> + <widget class="QDoubleSpinBox" name="sbRate"> + <property name="geometry"> + <rect> + <x>137</x> + <y>50</y> + <width>61</width> + <height>21</height> + </rect> + </property> + <property name="minimum"> + <double>0.290000000000000</double> + </property> + <property name="maximum"> + <double>5.000000000000000</double> + </property> + <property name="singleStep"> + <double>0.100000000000000</double> + </property> + </widget> + <widget class="QLabel" name="lbLFO"> + <property name="geometry"> + <rect> + <x>35</x> + <y>77</y> + <width>41</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>LFO</string> + </property> + </widget> + <widget class="QRadioButton" name="rbSine"> + <property name="geometry"> + <rect> + <x>70</x> + <y>77</y> + <width>61</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>Sine</string> + </property> + </widget> + <widget class="QRadioButton" name="rbTriangle"> + <property name="geometry"> + <rect> + <x>145</x> + <y>77</y> + <width>91</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>Trian&gle</string> + </property> + </widget> + <widget class="QDoubleSpinBox" name="sbDepth"> + <property name="geometry"> + <rect> + <x>60</x> + <y>120</y> + <width>51</width> + <height>21</height> + </rect> + </property> + <property name="decimals"> + <number>1</number> + </property> + <property name="maximum"> + <double>21.000000000000000</double> + </property> + <property name="singleStep"> + <double>0.100000000000000</double> + </property> + </widget> + </widget> + </item> + </layout> </widget> <resources/> <connections/> 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 @@ <x>0</x> <y>0</y> <width>400</width> - <height>111</height> + <height>135</height> </rect> </property> + <property name="minimumSize"> + <size> + <width>400</width> + <height>135</height> + </size> + </property> <property name="windowTitle"> <string>File Information</string> </property> @@ -60,6 +66,13 @@ </property> </widget> </item> + <item> + <widget class="QLabel" name="lbNoteCount"> + <property name="text"> + <string>Note count: </string> + </property> + </widget> + </item> </layout> </widget> <resources/> 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 @@ <height>32</height> </size> </property> + <property name="checkable"> + <bool>true</bool> + </property> </widget> <widget class="QPushButton" name="pbChannels"> <property name="geometry"> @@ -277,6 +280,9 @@ <height>32</height> </size> </property> + <property name="checkable"> + <bool>true</bool> + </property> </widget> <widget class="QPushButton" name="pbVisualization"> <property name="geometry"> 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(;byteread<chnklen;++byteread){fgetc(f);} } -void CMidiFile::chunkReader(int hdrXp) +int CMidiFile::chunkReader(int hdrXp) { char hdr[6]; if(!fgets(hdr,5,f))error(1,"E: Unexpected EOF."); if(hdrXp) - if(strncmp(hdr,"MThd",4))error(1,"E: Wrong MIDI header."); - else headerChunkReader(); + if(strncmp(hdr,"MThd",4)){error(1,"E: Wrong MIDI header.");throw;} + else return headerChunkReader(),0; else if(strncmp(hdr,"MTrk",4)) { error(0,"W: Wrong track chunk header. Ignoring the whole chunk."); - for(int chnklen=readDW();chnklen>0;--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;i<trk;++i)chunkReader(0); + for(uint32_t i=0;i<trk;i+=chunkReader(0)); printf("%d note(s)\n",notes); fclose(f); std::sort(eventList,eventList+eventc,cmp); @@ -214,5 +216,6 @@ CMidiFile::~CMidiFile() const SEvent* CMidiFile::getEvent(uint32_t id){return id<eventc?eventList[id]:NULL;} uint32_t CMidiFile::getEventCount(){return eventc;} uint32_t CMidiFile::getDivision(){return divs;} +uint32_t CMidiFile::getNoteCount(){return notes;} const char* CMidiFile::getTitle(){return title;} const char* CMidiFile::getCopyright(){return copyright;} diff --git a/qmpsettingswindow.cpp b/qmpsettingswindow.cpp new file mode 100644 index 0000000..d27547d --- /dev/null +++ b/qmpsettingswindow.cpp @@ -0,0 +1,33 @@ +#include "qmpsettingswindow.hpp" +#include "ui_qmpsettingswindow.h" +#include "qmpmainwindow.hpp" + +qmpSettingsWindow::qmpSettingsWindow(QWidget *parent) : + QDialog(parent), + ui(new Ui::qmpSettingsWindow) +{ + ui->setupUi(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 <QDialog> +#include <QCloseEvent> + +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 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>qmpSettingsWindow</class> + <widget class="QDialog" name="qmpSettingsWindow"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>439</width> + <height>407</height> + </rect> + </property> + <property name="minimumSize"> + <size> + <width>439</width> + <height>407</height> + </size> + </property> + <property name="windowTitle"> + <string>Settings</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QTabWidget" name="tabWidget"> + <property name="currentIndex"> + <number>0</number> + </property> + <widget class="QWidget" name="tab"> + <attribute name="title"> + <string>Midi</string> + </attribute> + <layout class="QGridLayout" name="gridLayout"> + <item row="1" column="0"> + <widget class="QCheckBox" name="cbDisableMapping"> + <property name="text"> + <string>Disable Midi Mapping</string> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="lbOutputDevice"> + <property name="text"> + <string>Default Output Device</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QComboBox" name="cbOutputDevice"/> + </item> + <item row="2" column="0"> + <widget class="QCheckBox" name="cbSendSysx"> + <property name="text"> + <string>Send SysEx</string> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="lbEncoding"> + <property name="text"> + <string>Text Encoding</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QComboBox" name="cbEncoding"> + <item> + <property name="text"> + <string>Unicode</string> + </property> + </item> + <item> + <property name="text"> + <string>Big5</string> + </property> + </item> + <item> + <property name="text"> + <string>Big5-HKSCS</string> + </property> + </item> + <item> + <property name="text"> + <string>CP949</string> + </property> + </item> + <item> + <property name="text"> + <string>EUC-JP</string> + </property> + </item> + <item> + <property name="text"> + <string>EUC-KR</string> + </property> + </item> + <item> + <property name="text"> + <string>GB18030</string> + </property> + </item> + <item> + <property name="text"> + <string>KOI8-R</string> + </property> + </item> + <item> + <property name="text"> + <string>KOI8-U</string> + </property> + </item> + <item> + <property name="text"> + <string>Macintosh</string> + </property> + </item> + <item> + <property name="text"> + <string>Shift-JIS</string> + </property> + </item> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="tab_2"> + <attribute name="title"> + <string>Synth</string> + </attribute> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="2" column="0"> + <widget class="QLabel" name="lbBufCnt"> + <property name="text"> + <string>Audio Buffer Count</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="lbBufSize"> + <property name="text"> + <string>Audio Buffer Size</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QComboBox" name="cbBufSize"> + <property name="editable"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="4" column="0"> + <widget class="QLabel" name="lbFrequency"> + <property name="text"> + <string>Audio Frequency</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QComboBox" name="cbBufCnt"> + <property name="editable"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="lbAudioDrv"> + <property name="text"> + <string>Audio Driver</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QComboBox" name="cbFormat"/> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="lbFormat"> + <property name="text"> + <string>Audio Format</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QComboBox" name="cbAudioDrv"/> + </item> + <item row="4" column="1"> + <widget class="QComboBox" name="cbFrequency"/> + </item> + <item row="5" column="1"> + <widget class="QSpinBox" name="sbPolyphony"> + <property name="minimum"> + <number>1</number> + </property> + <property name="maximum"> + <number>65535</number> + </property> + <property name="value"> + <number>2048</number> + </property> + </widget> + </item> + <item row="5" column="0"> + <widget class="QLabel" name="lbPolyphony"> + <property name="text"> + <string>Max Polyphony</string> + </property> + </widget> + </item> + <item row="6" column="0"> + <widget class="QCheckBox" name="cbAutoBS"> + <property name="text"> + <string>Auto bank select mode</string> + </property> + </widget> + </item> + <item row="7" column="0"> + <widget class="QLabel" name="lbBSMode"> + <property name="text"> + <string>Bank select mode</string> + </property> + </widget> + </item> + <item row="7" column="1"> + <widget class="QComboBox" name="cbBSMode"/> + </item> + </layout> + </widget> + <widget class="QWidget" name="tab_3"> + <attribute name="title"> + <string>Soundfonts</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <widget class="QListWidget" name="lwSoundfont"/> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QPushButton" name="pbAdd"> + <property name="text"> + <string/> + </property> + <property name="icon"> + <iconset resource="resources.qrc"> + <normaloff>:/img/add.png</normaloff>:/img/add.png</iconset> + </property> + <property name="iconSize"> + <size> + <width>24</width> + <height>24</height> + </size> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="pbRemove"> + <property name="text"> + <string/> + </property> + <property name="icon"> + <iconset resource="resources.qrc"> + <normaloff>:/img/remove.png</normaloff>:/img/remove.png</iconset> + </property> + <property name="iconSize"> + <size> + <width>24</width> + <height>24</height> + </size> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="pbUp"> + <property name="text"> + <string/> + </property> + <property name="icon"> + <iconset resource="resources.qrc"> + <normaloff>:/img/up.png</normaloff>:/img/up.png</iconset> + </property> + <property name="iconSize"> + <size> + <width>24</width> + <height>24</height> + </size> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="pbDown"> + <property name="text"> + <string/> + </property> + <property name="icon"> + <iconset resource="resources.qrc"> + <normaloff>:/img/down.png</normaloff>:/img/down.png</iconset> + </property> + <property name="iconSize"> + <size> + <width>24</width> + <height>24</height> + </size> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <widget class="QWidget" name="tab_4"> + <attribute name="title"> + <string>Behavior</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <item> + <widget class="QCheckBox" name="checkBox"> + <property name="text"> + <string>Restore last playlist on startup</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="checkBox_2"> + <property name="text"> + <string>Load files in the same folder</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="checkBox_3"> + <property name="text"> + <string>Save dialog status</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="checkBox_4"> + <property name="text"> + <string>Save parameters in effects window</string> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Visualization Mode</string> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="comboBox"/> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <item> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>View distance</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>50</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QSlider" name="horizontalSlider"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>60</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="spinBox"/> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_4"> + <item> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string>Note stretch</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>60</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QSlider" name="horizontalSlider_2"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>60</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="spinBox_2"/> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_5"> + <item> + <widget class="QLabel" name="label_4"> + <property name="text"> + <string>Fog Start</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_3"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>82</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QSlider" name="horizontalSlider_3"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>60</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="spinBox_3"/> + </item> + </layout> + </item> + </layout> + </widget> + </widget> + </item> + <item> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + </layout> + </widget> + <resources> + <include location="resources.qrc"/> + </resources> + <connections> + <connection> + <sender>buttonBox</sender> + <signal>accepted()</signal> + <receiver>qmpSettingsWindow</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel"> + <x>248</x> + <y>254</y> + </hint> + <hint type="destinationlabel"> + <x>157</x> + <y>274</y> + </hint> + </hints> + </connection> + <connection> + <sender>buttonBox</sender> + <signal>rejected()</signal> + <receiver>qmpSettingsWindow</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel"> + <x>316</x> + <y>260</y> + </hint> + <hint type="destinationlabel"> + <x>286</x> + <y>274</y> + </hint> + </hints> + </connection> + </connections> +</ui> |