summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--README.md4
-rw-r--r--qmidiplayer.pro30
-rw-r--r--qmpchanneleditor.cpp90
-rw-r--r--qmpchanneleditor.hpp10
-rw-r--r--qmpchanneleditor.ui4
-rw-r--r--qmpchannelswindow.cpp24
-rw-r--r--qmpchannelswindow.hpp14
-rw-r--r--qmpchannelswindow.ui4
-rw-r--r--qmpefxwindow.cpp145
-rw-r--r--qmpefxwindow.hpp57
-rw-r--r--qmpefxwindow.ui452
-rw-r--r--qmpinfowindow.cpp33
-rw-r--r--qmpinfowindow.hpp24
-rw-r--r--qmpinfowindow.ui67
-rw-r--r--qmpmainwindow.cpp37
-rw-r--r--qmpmainwindow.hpp16
-rw-r--r--qmpmainwindow.ui7
-rw-r--r--qmpmidiplay.cpp46
-rw-r--r--qmpmidiplay.hpp18
-rw-r--r--qmpmidiread.cpp16
-rw-r--r--qmpplistwindow.cpp32
-rw-r--r--qmpplistwindow.hpp10
-rw-r--r--qmpplistwindow.ui4
-rw-r--r--qmppresetselect.cpp19
-rw-r--r--qmppresetselect.hpp10
-rw-r--r--qmppresetselect.ui4
27 files changed, 1042 insertions, 139 deletions
diff --git a/ChangeLog b/ChangeLog
index 4f8cfe6..7a4f458 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2015-12-31 0.5.0
+Implemented effect parameter editor and file information window.
+Bump version.
+
2015-12-30 primitive version
Implemented the channel parameter editor.
diff --git a/README.md b/README.md
index 0c06f83..31e0275 100644
--- a/README.md
+++ b/README.md
@@ -5,8 +5,8 @@ Currently it's still very incomplete and not suitable for everyday use.
Planned features:
* Channel mute/solo
-* Editing channel parameters on-the-fly (partially implemented)
+* Editing channel parameters on-the-fly
* Playlists (partially implemented)
-* Editing synthesizer effects (not implemented)
+* Editing synthesizer effects
* Visualization (not implemented)
* Rendering midi to wave file (not implemented)
diff --git a/qmidiplayer.pro b/qmidiplayer.pro
index c89da2c..5f505dc 100644
--- a/qmidiplayer.pro
+++ b/qmidiplayer.pro
@@ -16,23 +16,29 @@ SOURCES += main.cpp\
qmpmainwindow.cpp \
qmpmidiplay.cpp \
qmpmidiread.cpp \
- qmpplistwindow.cpp \
- qmpchannelswindow.cpp \
- qmppresetselect.cpp \
- qmpchanneleditor.cpp
+ qmpplistwindow.cpp \
+ qmpChannelsWindow.cpp \
+ qmppresetselect.cpp \
+ qmpchanneleditor.cpp \
+ qmpefxwindow.cpp \
+ qmpinfowindow.cpp
HEADERS += qmpmainwindow.hpp \
qmpmidiplay.hpp \
- qmpplistwindow.hpp \
- qmpchannelswindow.hpp \
- qmppresetselect.hpp \
- qmpchanneleditor.hpp
+ qmpplistwindow.hpp \
+ qmpChannelsWindow.hpp \
+ qmppresetselect.hpp \
+ qmpchanneleditor.hpp \
+ qmpefxwindow.hpp \
+ qmpinfowindow.hpp
FORMS += qmpmainwindow.ui \
- qmpplistwindow.ui \
- qmpchannelswindow.ui \
- qmppresetselect.ui \
- qmpchanneleditor.ui
+ qmpplistwindow.ui \
+ qmpChannelsWindow.ui \
+ qmppresetselect.ui \
+ qmpchanneleditor.ui \
+ qmpefxwindow.ui \
+ qmpinfowindow.ui
QMAKE_CXXFLAGS += -std=c++11 -Wall
LIBS += -lfluidsynth
diff --git a/qmpchanneleditor.cpp b/qmpchanneleditor.cpp
index 667d553..09308da 100644
--- a/qmpchanneleditor.cpp
+++ b/qmpchanneleditor.cpp
@@ -3,19 +3,19 @@
#include "ui_qmpchanneleditor.h"
#include "qmpmainwindow.hpp"
-qmpchanneleditor::qmpchanneleditor(QWidget *parent) :
+qmpChannelEditor::qmpChannelEditor(QWidget *parent) :
QDialog(parent),
- ui(new Ui::qmpchanneleditor)
+ ui(new Ui::qmpChannelEditor)
{
ui->setupUi(this);
}
-qmpchanneleditor::~qmpchanneleditor()
+qmpChannelEditor::~qmpChannelEditor()
{
delete ui;
}
-void qmpchanneleditor::setupWindow(int chid)
+void qmpChannelEditor::setupWindow(int chid)
{
char str[30];if(~chid)ch=chid;
sprintf(str,"Channel Parameter Editor - Channel #%d",ch+1);
@@ -50,7 +50,7 @@ void qmpchanneleditor::setupWindow(int chid)
ui->dPan->setValue(b);
}
-void qmpchanneleditor::sendCC()
+void qmpChannelEditor::sendCC()
{
CMidiPlayer* player=qmpMainWindow::getInstance()->getPlayer();
player->setCC(ch,7,ui->dVol->value());
@@ -67,23 +67,23 @@ void qmpchanneleditor::sendCC()
player->setCC(ch,78,ui->dDelay->value());
}
-void qmpchanneleditor::showEvent(QShowEvent *e)
+void qmpChannelEditor::showEvent(QShowEvent *e)
{
e->accept();
connect(qmpMainWindow::getInstance()->getTimer(),SIGNAL(timeout()),this,SLOT(setupWindow()));
}
-void qmpchanneleditor::closeEvent(QCloseEvent *e)
+void qmpChannelEditor::closeEvent(QCloseEvent *e)
{
e->accept();
disconnect(qmpMainWindow::getInstance()->getTimer(),SIGNAL(timeout()),this,SLOT(setupWindow()));
}
-void qmpchanneleditor::on_pbChLeft_clicked()
+void qmpChannelEditor::on_pbChLeft_clicked()
{
if(ch>0)--ch;else ch=15;setupWindow();
}
-void qmpchanneleditor::on_pbChRight_clicked()
+void qmpChannelEditor::on_pbChRight_clicked()
{
if(ch<15)++ch;else ch=0;setupWindow();
}
@@ -91,110 +91,110 @@ void qmpchanneleditor::on_pbChRight_clicked()
#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()
+void qmpChannelEditor::on_dCut_sliderPressed()
{dc;}
-void qmpchanneleditor::on_dReso_sliderPressed()
+void qmpChannelEditor::on_dReso_sliderPressed()
{dc;}
-void qmpchanneleditor::on_dReverb_sliderPressed()
+void qmpChannelEditor::on_dReverb_sliderPressed()
{dc;}
-void qmpchanneleditor::on_dChorus_sliderPressed()
+void qmpChannelEditor::on_dChorus_sliderPressed()
{dc;}
-void qmpchanneleditor::on_dVol_sliderPressed()
+void qmpChannelEditor::on_dVol_sliderPressed()
{dc;}
-void qmpchanneleditor::on_dPan_sliderPressed()
+void qmpChannelEditor::on_dPan_sliderPressed()
{dc;}
-void qmpchanneleditor::on_dAttack_sliderPressed()
+void qmpChannelEditor::on_dAttack_sliderPressed()
{dc;}
-void qmpchanneleditor::on_dDecay_sliderPressed()
+void qmpChannelEditor::on_dDecay_sliderPressed()
{dc;}
-void qmpchanneleditor::on_dRelease_sliderPressed()
+void qmpChannelEditor::on_dRelease_sliderPressed()
{dc;}
-void qmpchanneleditor::on_dRate_sliderPressed()
+void qmpChannelEditor::on_dRate_sliderPressed()
{dc;}
-void qmpchanneleditor::on_dDepth_sliderPressed()
+void qmpChannelEditor::on_dDepth_sliderPressed()
{dc;}
-void qmpchanneleditor::on_dDelay_sliderPressed()
+void qmpChannelEditor::on_dDelay_sliderPressed()
{dc;}
-void qmpchanneleditor::on_dAttack_sliderReleased()
+void qmpChannelEditor::on_dAttack_sliderReleased()
{rc;}
-void qmpchanneleditor::on_dDecay_sliderReleased()
+void qmpChannelEditor::on_dDecay_sliderReleased()
{rc;}
-void qmpchanneleditor::on_dRelease_sliderReleased()
+void qmpChannelEditor::on_dRelease_sliderReleased()
{rc;}
-void qmpchanneleditor::on_dRate_sliderReleased()
+void qmpChannelEditor::on_dRate_sliderReleased()
{rc;}
-void qmpchanneleditor::on_dDepth_sliderReleased()
+void qmpChannelEditor::on_dDepth_sliderReleased()
{rc;}
-void qmpchanneleditor::on_dDelay_sliderReleased()
+void qmpChannelEditor::on_dDelay_sliderReleased()
{rc;}
-void qmpchanneleditor::on_dCut_sliderReleased()
+void qmpChannelEditor::on_dCut_sliderReleased()
{rc;}
-void qmpchanneleditor::on_dReso_sliderReleased()
+void qmpChannelEditor::on_dReso_sliderReleased()
{rc;}
-void qmpchanneleditor::on_dReverb_sliderReleased()
+void qmpChannelEditor::on_dReverb_sliderReleased()
{rc;}
-void qmpchanneleditor::on_dChorus_sliderReleased()
+void qmpChannelEditor::on_dChorus_sliderReleased()
{rc;}
-void qmpchanneleditor::on_dVol_sliderReleased()
+void qmpChannelEditor::on_dVol_sliderReleased()
{rc;}
-void qmpchanneleditor::on_dPan_sliderReleased()
+void qmpChannelEditor::on_dPan_sliderReleased()
{rc;}
-void qmpchanneleditor::on_dCut_valueChanged()
+void qmpChannelEditor::on_dCut_valueChanged()
{rc;}
-void qmpchanneleditor::on_dReso_valueChanged()
+void qmpChannelEditor::on_dReso_valueChanged()
{rc;}
-void qmpchanneleditor::on_dReverb_valueChanged()
+void qmpChannelEditor::on_dReverb_valueChanged()
{rc;}
-void qmpchanneleditor::on_dChorus_valueChanged()
+void qmpChannelEditor::on_dChorus_valueChanged()
{rc;}
-void qmpchanneleditor::on_dVol_valueChanged()
+void qmpChannelEditor::on_dVol_valueChanged()
{rc;}
-void qmpchanneleditor::on_dPan_valueChanged()
+void qmpChannelEditor::on_dPan_valueChanged()
{rc;}
-void qmpchanneleditor::on_dAttack_valueChanged()
+void qmpChannelEditor::on_dAttack_valueChanged()
{rc;}
-void qmpchanneleditor::on_dDecay_valueChanged()
+void qmpChannelEditor::on_dDecay_valueChanged()
{rc;}
-void qmpchanneleditor::on_dRelease_valueChanged()
+void qmpChannelEditor::on_dRelease_valueChanged()
{rc;}
-void qmpchanneleditor::on_dRate_valueChanged()
+void qmpChannelEditor::on_dRate_valueChanged()
{rc;}
-void qmpchanneleditor::on_dDepth_valueChanged()
+void qmpChannelEditor::on_dDepth_valueChanged()
{rc;}
-void qmpchanneleditor::on_dDelay_valueChanged()
+void qmpChannelEditor::on_dDelay_valueChanged()
{rc;}
diff --git a/qmpchanneleditor.hpp b/qmpchanneleditor.hpp
index 019cfb4..5927122 100644
--- a/qmpchanneleditor.hpp
+++ b/qmpchanneleditor.hpp
@@ -6,16 +6,16 @@
#include <QCloseEvent>
namespace Ui {
- class qmpchanneleditor;
+ class qmpChannelEditor;
}
-class qmpchanneleditor:public QDialog
+class qmpChannelEditor:public QDialog
{
Q_OBJECT
public:
- explicit qmpchanneleditor(QWidget *parent=0);
- ~qmpchanneleditor();
+ explicit qmpChannelEditor(QWidget *parent=0);
+ ~qmpChannelEditor();
protected:
void showEvent(QShowEvent *e);
void closeEvent(QCloseEvent *e);
@@ -63,7 +63,7 @@ class qmpchanneleditor:public QDialog
void on_dDelay_valueChanged();
private:
- Ui::qmpchanneleditor *ui;
+ Ui::qmpChannelEditor *ui;
int ch;
void sendCC();
};
diff --git a/qmpchanneleditor.ui b/qmpchanneleditor.ui
index b45e7de..7e10c41 100644
--- a/qmpchanneleditor.ui
+++ b/qmpchanneleditor.ui
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
- <class>qmpchanneleditor</class>
- <widget class="QDialog" name="qmpchanneleditor">
+ <class>qmpChannelEditor</class>
+ <widget class="QDialog" name="qmpChannelEditor">
<property name="geometry">
<rect>
<x>0</x>
diff --git a/qmpchannelswindow.cpp b/qmpchannelswindow.cpp
index ce05468..65ed055 100644
--- a/qmpchannelswindow.cpp
+++ b/qmpchannelswindow.cpp
@@ -5,13 +5,13 @@
#include "ui_qmpchannelswindow.h"
#include "qmpmainwindow.hpp"
-qmpchannelswindow::qmpchannelswindow(QWidget *parent) :
+qmpChannelsWindow::qmpChannelsWindow(QWidget *parent) :
QDialog(parent),
- ui(new Ui::qmpchannelswindow)
+ ui(new Ui::qmpChannelsWindow)
{
ui->setupUi(this);
- pselectw=new qmppresetselect(this);
- ceditw=new qmpchanneleditor(this);
+ pselectw=new qmpPresetSelector(this);
+ ceditw=new qmpChannelEditor(this);
connect(this,SIGNAL(dialogClosing()),parent,SLOT(dialogClosed()));
for(int i=0;i<16;++i)
{
@@ -37,14 +37,14 @@ qmpchannelswindow::qmpchannelswindow(QWidget *parent) :
ui->twChannels->setColumnWidth(4,32);
}
-void qmpchannelswindow::closeEvent(QCloseEvent *event)
+void qmpChannelsWindow::closeEvent(QCloseEvent *event)
{
setVisible(false);
emit dialogClosing();
event->accept();
}
-void qmpchannelswindow::channelWindowsUpdate()
+void qmpChannelsWindow::channelWindowsUpdate()
{
for(int i=0;i<16;++i)
{
@@ -56,7 +56,7 @@ void qmpchannelswindow::channelWindowsUpdate()
}
}
-void qmpchannelswindow::channelMSChanged()
+void qmpChannelsWindow::channelMSChanged()
{
for(int i=0;i<16;++i)
{
@@ -69,12 +69,12 @@ void qmpchannelswindow::channelMSChanged()
}
}
-qmpchannelswindow::~qmpchannelswindow()
+qmpChannelsWindow::~qmpChannelsWindow()
{
delete ui;
}
-void qmpchannelswindow::on_pbUnmute_clicked()
+void qmpChannelsWindow::on_pbUnmute_clicked()
{
for(int i=0;i<16;++i)
{
@@ -83,7 +83,7 @@ void qmpchannelswindow::on_pbUnmute_clicked()
}
}
-void qmpchannelswindow::on_pbUnsolo_clicked()
+void qmpChannelsWindow::on_pbUnsolo_clicked()
{
for(int i=0;i<16;++i)
{
@@ -92,13 +92,13 @@ void qmpchannelswindow::on_pbUnsolo_clicked()
}
}
-void qmpchannelswindow::showPresetWindow(int chid)
+void qmpChannelsWindow::showPresetWindow(int chid)
{
pselectw->show();
pselectw->setupWindow(chid);
}
-void qmpchannelswindow::showChannelEditorWindow(int chid)
+void qmpChannelsWindow::showChannelEditorWindow(int chid)
{
ceditw->show();
ceditw->setupWindow(chid);
diff --git a/qmpchannelswindow.hpp b/qmpchannelswindow.hpp
index c87a90f..a3ce667 100644
--- a/qmpchannelswindow.hpp
+++ b/qmpchannelswindow.hpp
@@ -9,7 +9,7 @@
#include "qmpchanneleditor.hpp"
namespace Ui {
- class qmpchannelswindow;
+ class qmpChannelsWindow;
}
class QDCLabel:public QLabel
@@ -40,13 +40,13 @@ class QDCPushButton:public QPushButton
void onClick(int id);
};
-class qmpchannelswindow:public QDialog
+class qmpChannelsWindow:public QDialog
{
Q_OBJECT
public:
- explicit qmpchannelswindow(QWidget *parent = 0);
- ~qmpchannelswindow();
+ explicit qmpChannelsWindow(QWidget *parent = 0);
+ ~qmpChannelsWindow();
void closeEvent(QCloseEvent *event);
signals:
void dialogClosing();
@@ -61,9 +61,9 @@ class qmpchannelswindow:public QDialog
void on_pbUnsolo_clicked();
private:
- Ui::qmpchannelswindow *ui;
- qmppresetselect *pselectw;
- qmpchanneleditor *ceditw;
+ Ui::qmpChannelsWindow *ui;
+ qmpPresetSelector *pselectw;
+ qmpChannelEditor *ceditw;
};
#endif // QMPCHANNELSWINDOW_H
diff --git a/qmpchannelswindow.ui b/qmpchannelswindow.ui
index dba6009..a8b43cb 100644
--- a/qmpchannelswindow.ui
+++ b/qmpchannelswindow.ui
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
- <class>qmpchannelswindow</class>
- <widget class="QDialog" name="qmpchannelswindow">
+ <class>qmpChannelsWindow</class>
+ <widget class="QDialog" name="qmpChannelsWindow">
<property name="geometry">
<rect>
<x>0</x>
diff --git a/qmpefxwindow.cpp b/qmpefxwindow.cpp
new file mode 100644
index 0000000..b46cbb5
--- /dev/null
+++ b/qmpefxwindow.cpp
@@ -0,0 +1,145 @@
+#include <cmath>
+#include "qmpefxwindow.hpp"
+#include "ui_qmpefxwindow.h"
+#include "qmpmainwindow.hpp"
+
+qmpEfxWindow::qmpEfxWindow(QWidget *parent) :
+ QDialog(parent),
+ ui(new Ui::qmpEfxWindow)
+{
+ ui->setupUi(this);initialized=false;
+ connect(this,SIGNAL(dialogClosing()),parent,SLOT(dialogClosed()));
+ //stub. read these from settings after the setting module is implemented
+ ui->cbEnabledC->setChecked(true);
+ ui->cbEnabledR->setChecked(true);
+}
+
+qmpEfxWindow::~qmpEfxWindow()
+{
+ delete ui;
+}
+
+void qmpEfxWindow::closeEvent(QCloseEvent *event)
+{
+ setVisible(false);
+ emit dialogClosing();
+ event->accept();
+}
+
+void qmpEfxWindow::showEvent(QShowEvent *event)
+{
+ CMidiPlayer* player=qmpMainWindow::getInstance()->getPlayer();
+ player->getReverbPara(&rr,&rd,&rw,&rl);
+ player->getChorusPara(&cfb,&cl,&cr,&cd,&ct);
+ ui->sbRoom->setValue((int)round(rr*100));ui->dRoom->setValue((int)round(rr*100));
+ ui->sbDamp->setValue((int)round(rd*100));ui->dRoom->setValue((int)round(rd*100));
+ ui->sbWidth->setValue((int)round(rw*100));ui->dWidth->setValue((int)round(rw*100));
+ ui->sbLevelR->setValue((int)round(rl*100));ui->dLevelR->setValue((int)round(rl*100));
+
+ ui->sbFeedBack->setValue(cfb);ui->dFeedBack->setValue(cfb);
+ ui->sbRate->setValue(cr);ui->dRate->setValue((int)round(cr*100));
+ ui->sbDepth->setValue(cd);ui->dDepth->setValue((int)round(cd*10));
+ ui->sbLevelC->setValue((int)round(cl*100));ui->dLevelC->setValue((int)round(cl*100));
+ if(ct==FLUID_CHORUS_MOD_SINE)ui->rbSine->setChecked(true),ui->rbTriangle->setChecked(false);
+ if(ct==FLUID_CHORUS_MOD_TRIANGLE)ui->rbSine->setChecked(false),ui->rbTriangle->setChecked(true);
+ initialized=true;event->accept();
+}
+
+void qmpEfxWindow::sendEfxChange()
+{
+ if(!qmpMainWindow::getInstance()||!initialized)return;
+ rr=ui->sbRoom->value()/100.;rd=ui->sbDamp->value()/100.;
+ rw=ui->sbWidth->value()/100.;rl=ui->sbLevelR->value()/100.;
+ ct=ui->rbSine->isChecked()?FLUID_CHORUS_MOD_SINE:FLUID_CHORUS_MOD_TRIANGLE;
+ cfb=ui->sbFeedBack->value();cl=ui->sbLevelC->value()/100.;
+ cr=ui->sbRate->value();cd=ui->sbDepth->value();
+ CMidiPlayer* player=qmpMainWindow::getInstance()->getPlayer();
+ player->setReverbPara(ui->cbEnabledR->isChecked()?1:0,rr,rd,rw,rl);
+ player->setChorusPara(ui->cbEnabledC->isChecked()?1:0,cfb,cl,cr,cd,ct);
+}
+
+void qmpEfxWindow::dailValueChange()
+{
+ ui->sbRoom->setValue(ui->dRoom->value());
+ ui->sbDamp->setValue(ui->dDamp->value());
+ ui->sbWidth->setValue(ui->dWidth->value());
+ ui->sbLevelR->setValue(ui->dLevelR->value());
+ ui->sbFeedBack->setValue(ui->dFeedBack->value());
+ ui->sbRate->setValue(ui->dRate->value()/100.);
+ ui->sbDepth->setValue(ui->dDepth->value()/10.);
+ ui->sbLevelC->setValue(ui->dLevelC->value());
+ sendEfxChange();
+}
+
+void qmpEfxWindow::spinValueChange()
+{
+ ui->dRoom->setValue(ui->sbRoom->value());
+ ui->dDamp->setValue(ui->sbDamp->value());
+ ui->dWidth->setValue(ui->sbWidth->value());
+ ui->dLevelR->setValue(ui->sbLevelR->value());
+ ui->dFeedBack->setValue(ui->sbFeedBack->value());
+ ui->dRate->setValue((int)(ui->sbRate->value()*100));
+ ui->dDepth->setValue((int)(ui->sbDepth->value()*10));
+ ui->dLevelC->setValue(ui->sbLevelC->value());
+ sendEfxChange();
+}
+
+void qmpEfxWindow::on_dRoom_valueChanged()
+{dailValueChange();}
+
+void qmpEfxWindow::on_dDamp_valueChanged()
+{dailValueChange();}
+
+void qmpEfxWindow::on_dWidth_valueChanged()
+{dailValueChange();}
+
+void qmpEfxWindow::on_dLevelR_valueChanged()
+{dailValueChange();}
+
+void qmpEfxWindow::on_dFeedBack_valueChanged()
+{dailValueChange();}
+
+void qmpEfxWindow::on_dRate_valueChanged()
+{dailValueChange();}
+
+void qmpEfxWindow::on_dDepth_valueChanged()
+{dailValueChange();}
+
+void qmpEfxWindow::on_dLevelC_valueChanged()
+{dailValueChange();}
+
+void qmpEfxWindow::on_sbRoom_valueChanged(QString s)
+{s=QString();spinValueChange();}
+
+void qmpEfxWindow::on_sbDamp_valueChanged(QString s)
+{s=QString();spinValueChange();}
+
+void qmpEfxWindow::on_sbWidth_valueChanged(QString s)
+{s=QString();spinValueChange();}
+
+void qmpEfxWindow::on_sbLevelR_valueChanged(QString s)
+{s=QString();spinValueChange();}
+
+void qmpEfxWindow::on_sbFeedBack_valueChanged(QString s)
+{s=QString();spinValueChange();}
+
+void qmpEfxWindow::on_sbRate_valueChanged(QString s)
+{s=QString();spinValueChange();}
+
+void qmpEfxWindow::on_sbDepth_valueChanged(QString s)
+{s=QString();spinValueChange();}
+
+void qmpEfxWindow::on_sbLevelC_valueChanged(QString s)
+{s=QString();spinValueChange();}
+
+void qmpEfxWindow::on_cbEnabledC_stateChanged()
+{sendEfxChange();}
+
+void qmpEfxWindow::on_cbEnabledR_stateChanged()
+{sendEfxChange();}
+
+void qmpEfxWindow::on_rbSine_toggled()
+{sendEfxChange();}
+
+void qmpEfxWindow::on_rbTriangle_toggled()
+{sendEfxChange();}
diff --git a/qmpefxwindow.hpp b/qmpefxwindow.hpp
new file mode 100644
index 0000000..aa56263
--- /dev/null
+++ b/qmpefxwindow.hpp
@@ -0,0 +1,57 @@
+#ifndef QMPEFXWINDOW_HPP
+#define QMPEFXWINDOW_HPP
+
+#include <QDialog>
+#include <QCloseEvent>
+#include <QShowEvent>
+
+namespace Ui {
+ class qmpEfxWindow;
+}
+
+class qmpEfxWindow : public QDialog
+{
+ Q_OBJECT
+
+ public:
+ explicit qmpEfxWindow(QWidget *parent=0);
+ ~qmpEfxWindow();
+ void closeEvent(QCloseEvent *event);
+ void showEvent(QShowEvent *event);
+
+ signals:
+ void dialogClosing();
+
+ private slots:
+ void on_dRoom_valueChanged();
+ void on_dDamp_valueChanged();
+ void on_dWidth_valueChanged();
+ void on_dLevelR_valueChanged();
+ void on_dFeedBack_valueChanged();
+ void on_dRate_valueChanged();
+ void on_dDepth_valueChanged();
+ void on_dLevelC_valueChanged();
+ void on_sbRoom_valueChanged(QString s);
+ void on_sbDamp_valueChanged(QString s);
+ void on_sbWidth_valueChanged(QString s);
+ void on_sbLevelR_valueChanged(QString s);
+ void on_sbFeedBack_valueChanged(QString s);
+ void on_sbRate_valueChanged(QString s);
+ void on_sbDepth_valueChanged(QString s);
+ void on_sbLevelC_valueChanged(QString s);
+ void on_cbEnabledC_stateChanged();
+ void on_cbEnabledR_stateChanged();
+ void on_rbSine_toggled();
+ void on_rbTriangle_toggled();
+
+ private:
+ void dailValueChange();
+ void spinValueChange();
+ void sendEfxChange();
+ Ui::qmpEfxWindow *ui;
+ double rr,rd,rw,rl;
+ int cfb,ct,initialized;
+ double cl,cr,cd;
+};
+
+#endif // QMPEFXWINDOW_HPP
diff --git a/qmpefxwindow.ui b/qmpefxwindow.ui
new file mode 100644
index 0000000..53d3fff
--- /dev/null
+++ b/qmpefxwindow.ui
@@ -0,0 +1,452 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>qmpEfxWindow</class>
+ <widget class="QDialog" name="qmpEfxWindow">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>546</width>
+ <height>177</height>
+ </rect>
+ </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&amp;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>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/qmpinfowindow.cpp b/qmpinfowindow.cpp
new file mode 100644
index 0000000..93cbb81
--- /dev/null
+++ b/qmpinfowindow.cpp
@@ -0,0 +1,33 @@
+#include "qmpinfowindow.hpp"
+#include "ui_qmpinfowindow.h"
+#include "qmpmainwindow.hpp"
+
+const char* minors="abebbbf c g d a e b f#c#g#d#a#";
+const char* majors="CbGbDbAbEbBbF C G D A E B F#C#";
+
+qmpInfoWindow::qmpInfoWindow(QWidget *parent) :
+ QDialog(parent),
+ ui(new Ui::qmpInfoWindow)
+{
+ ui->setupUi(this);
+}
+
+qmpInfoWindow::~qmpInfoWindow()
+{
+ delete ui;
+}
+
+void qmpInfoWindow::updateInfo()
+{
+ char str[256];
+ CMidiPlayer* player=qmpMainWindow::getInstance()->getPlayer();
+ ui->lbFileName->setText(QString("File name: ")+qmpMainWindow::getInstance()->getFileName());
+ if(player->getTitle())ui->lbTitle->setText(QString("Title: ")+player->getTitle());
+ if(player->getCopyright())ui->lbCopyright->setText(QString("Copyright: ")+player->getCopyright());
+ 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);
+}
diff --git a/qmpinfowindow.hpp b/qmpinfowindow.hpp
new file mode 100644
index 0000000..9a1e389
--- /dev/null
+++ b/qmpinfowindow.hpp
@@ -0,0 +1,24 @@
+#ifndef QMPINFOWINDOW_HPP
+#define QMPINFOWINDOW_HPP
+
+#include <QDialog>
+
+namespace Ui {
+ class qmpInfoWindow;
+}
+
+class qmpInfoWindow : public QDialog
+{
+ Q_OBJECT
+
+ public:
+ explicit qmpInfoWindow(QWidget *parent = 0);
+ ~qmpInfoWindow();
+ public slots:
+ void updateInfo();
+
+ private:
+ Ui::qmpInfoWindow *ui;
+};
+
+#endif // QMPINFOWINDOW_HPP
diff --git a/qmpinfowindow.ui b/qmpinfowindow.ui
new file mode 100644
index 0000000..689b817
--- /dev/null
+++ b/qmpinfowindow.ui
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>qmpInfoWindow</class>
+ <widget class="QDialog" name="qmpInfoWindow">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>111</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>File Information</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QLabel" name="lbFileName">
+ <property name="text">
+ <string>File name: </string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="lbTempo">
+ <property name="text">
+ <string>Tempo: </string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="lbKeySig">
+ <property name="text">
+ <string>Key Sig.: </string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="lbTimeSig">
+ <property name="text">
+ <string>Time Sig.:</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QLabel" name="lbTitle">
+ <property name="text">
+ <string>Title: </string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="lbCopyright">
+ <property name="text">
+ <string>Copyright: </string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/qmpmainwindow.cpp b/qmpmainwindow.cpp
index f79583c..dd2d74a 100644
--- a/qmpmainwindow.cpp
+++ b/qmpmainwindow.cpp
@@ -11,13 +11,19 @@ qmpMainWindow::qmpMainWindow(QWidget *parent) :
ui(new Ui::qmpMainWindow)
{
ui->setupUi(this);player=new CMidiPlayer();
- playing=false;stopped=true;dragging=false;
- plistw=new qmpplistwindow(this);
- chnlw=new qmpchannelswindow(this);
ui->lbFileName->setText("");
+ playing=false;stopped=true;dragging=false;
+ plistw=new qmpPlistWindow(this);
+ chnlw=new qmpChannelsWindow(this);
+ efxw=new qmpEfxWindow(this);
+ infow=new qmpInfoWindow(this);
timer=new QTimer(this);ref=this;
+ fnA1=new QAction("File Information",ui->lbFileName);
+ ui->lbFileName->addAction(fnA1);
+ connect(fnA1,SIGNAL(triggered()),this,SLOT(onfnA1()));
connect(timer,SIGNAL(timeout()),this,SLOT(updateWidgets()));
connect(timer,SIGNAL(timeout()),chnlw,SLOT(channelWindowsUpdate()));
+ connect(timer,SIGNAL(timeout()),infow,SLOT(updateInfo()));
}
qmpMainWindow::~qmpMainWindow()
@@ -29,6 +35,11 @@ qmpMainWindow::~qmpMainWindow()
void qmpMainWindow::closeEvent(QCloseEvent *event)
{
on_pbStop_clicked();
+ efxw->close();chnlw->close();plistw->close();infow->close();
+ delete efxw;efxw=NULL;
+ delete chnlw;chnlw=NULL;
+ delete plistw;plistw=NULL;
+ delete infow;infow=NULL;
event->accept();
}
@@ -78,6 +89,8 @@ void qmpMainWindow::updateWidgets()
}
}
+QString qmpMainWindow::getFileName(){return ui->lbFileName->text();}
+
void qmpMainWindow::on_pbPlayPause_clicked()
{
playing=!playing;
@@ -162,6 +175,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);
}
void qmpMainWindow::on_pbPList_clicked()
@@ -226,3 +240,20 @@ void qmpMainWindow::selectionChanged()
st=std::chrono::steady_clock::now();offset=0;
timer->start(100);
}
+
+void qmpMainWindow::on_pbEfx_clicked()
+{
+ efxw->show();
+}
+
+void qmpMainWindow::on_lbFileName_customContextMenuRequested(const QPoint &pos)
+{
+ QMenu menu(ui->lbFileName);
+ menu.addActions(ui->lbFileName->actions());
+ menu.exec(this->pos()+ui->lbFileName->pos()+pos);
+}
+
+void qmpMainWindow::onfnA1()
+{
+ infow->show();
+}
diff --git a/qmpmainwindow.hpp b/qmpmainwindow.hpp
index ae62bb4..b123feb 100644
--- a/qmpmainwindow.hpp
+++ b/qmpmainwindow.hpp
@@ -4,11 +4,15 @@
#include <QMainWindow>
#include <QTimer>
#include <QCloseEvent>
+#include <QAction>
+#include <QMenu>
#include <thread>
#include <chrono>
#include "qmpmidiplay.hpp"
#include "qmpplistwindow.hpp"
#include "qmpchannelswindow.hpp"
+#include "qmpefxwindow.hpp"
+#include "qmpinfowindow.hpp"
namespace Ui {
class qmpMainWindow;
@@ -36,6 +40,9 @@ class qmpMainWindow:public QMainWindow
void on_pbPrev_clicked();
void on_pbNext_clicked();
void on_pbChannels_clicked();
+ void on_pbEfx_clicked();
+ void on_lbFileName_customContextMenuRequested(const QPoint &pos);
+ void onfnA1();
public slots:
void dialogClosed();
@@ -49,8 +56,13 @@ class qmpMainWindow:public QMainWindow
std::chrono::steady_clock::time_point st;
double offset;
CMidiPlayer *player;
- qmpplistwindow *plistw;
- qmpchannelswindow *chnlw;
+ qmpPlistWindow *plistw;
+ qmpChannelsWindow *chnlw;
+ qmpEfxWindow *efxw;
+ qmpInfoWindow *infow;
+ QAction *fnA1,*fnA2;
+ public:
+ QString getFileName();
static qmpMainWindow* ref;
public: static qmpMainWindow* getInstance(){return ref;}
diff --git a/qmpmainwindow.ui b/qmpmainwindow.ui
index 1cce37d..4f00da1 100644
--- a/qmpmainwindow.ui
+++ b/qmpmainwindow.ui
@@ -44,6 +44,9 @@
<pointsize>18</pointsize>
</font>
</property>
+ <property name="contextMenuPolicy">
+ <enum>Qt::CustomContextMenu</enum>
+ </property>
<property name="text">
<string>somefile.mid</string>
</property>
@@ -162,7 +165,7 @@
</size>
</property>
</widget>
- <widget class="QPushButton" name="pbNext_2">
+ <widget class="QPushButton" name="pbSettings">
<property name="geometry">
<rect>
<x>280</x>
@@ -275,7 +278,7 @@
</size>
</property>
</widget>
- <widget class="QPushButton" name="pbEfx_2">
+ <widget class="QPushButton" name="pbVisualization">
<property name="geometry">
<rect>
<x>190</x>
diff --git a/qmpmidiplay.cpp b/qmpmidiplay.cpp
index e9014d0..0eae6aa 100644
--- a/qmpmidiplay.cpp
+++ b/qmpmidiplay.cpp
@@ -9,7 +9,7 @@ void CMidiPlayer::fluidInitialize(const char* sf)
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",256);
+ fluid_settings_setint(settings,"synth.polyphony",2048);
synth=new_fluid_synth(settings);
adriver=new_fluid_audio_driver(settings,synth);
fluid_synth_sfload(synth,sf,1);
@@ -52,8 +52,11 @@ void CMidiPlayer::processEvent(const SEvent *e)
ctempo=e->p2;dpt=ctempo*1000/divs;
break;
case 0x58:
+ ctsn=e->p2>>24;
+ ctsd=1<<((e->p2>>16)&0xFF);
break;
case 0x59:
+ cks=e->p2;
break;
case 0x01:case 0x02:case 0x03:
case 0x04:case 0x05:case 0x06:
@@ -176,9 +179,12 @@ void CMidiPlayer::playerLoadFile(const char* fn)
}
void CMidiPlayer::playerInit()
{
- ctempo=0x7A120;ctsn=4;ctsd=2;dpt=ctempo*1000/divs;
+ ctempo=0x7A120;ctsn=4;ctsd=4;cks=0;dpt=ctempo*1000/divs;
tceptr=0;tcstop=0;tcpaused=0;finished=0;mute=solo=0;
fluidInitialize("/media/Files/FluidR3_Ext.sf2");
+ fluid_synth_set_chorus(synth,FLUID_CHORUS_DEFAULT_N,FLUID_CHORUS_DEFAULT_LEVEL,
+ FLUID_CHORUS_DEFAULT_SPEED,FLUID_CHORUS_DEFAULT_DEPTH,
+ FLUID_CHORUS_DEFAULT_TYPE);
}
void CMidiPlayer::playerDeinit()
{
@@ -199,10 +205,15 @@ void CMidiPlayer::setTCeptr(uint32_t ep,uint32_t st)
for(int j=0;j<120;++j)fluid_synth_cc(synth,i,j,ccstamps[st][i][j]);
fluid_synth_program_change(synth,i,ccstamps[st][i][128]);
//fluid_synth_pitch_bend(synth,i,ccstamps[st][i][130]);
- dpt=ccstamps[st][0][131];
+ dpt=ccstamps[st][0][131];ctempo=dpt*divs/1000;
}
}
double CMidiPlayer::getFtime(){return ftime;}
+void CMidiPlayer::getCurrentTimeSignature(int *n,int *d){*n=ctsn;*d=ctsd;}
+void CMidiPlayer::getCurrentKeySignature(int *ks){*ks=cks;}
+const char* CMidiPlayer::getTitle(){return midiFile->getTitle();}
+const char* CMidiPlayer::getCopyright(){return midiFile->getCopyright();}
+double CMidiPlayer::getTempo(){return 60./(ctempo/1e6)*ctsd/4.;}
uint32_t CMidiPlayer::getTCpaused(){return tcpaused;}
void CMidiPlayer::setTCpaused(uint32_t ps){tcpaused=ps;}
uint32_t CMidiPlayer::isFinished(){return finished;}
@@ -237,6 +248,35 @@ int CMidiPlayer::getCC(int ch, int id)
{int ret=0;synth?fluid_synth_get_cc(synth,ch,id,&ret):0;return ret;}
void CMidiPlayer::setCC(int ch, int id, int val)
{synth?fluid_synth_cc(synth,ch,id,val):0;}
+void CMidiPlayer::getReverbPara(double *r,double *d,double *w,double *l)
+{
+ if(!synth)return;
+ *r=fluid_synth_get_reverb_roomsize(synth);
+ *d=fluid_synth_get_reverb_damp(synth);
+ *w=fluid_synth_get_reverb_width(synth);
+ *l=fluid_synth_get_reverb_level(synth);
+}
+void CMidiPlayer::setReverbPara(int e,double r,double d,double w,double l)
+{
+ if(!synth)return;
+ fluid_synth_set_reverb_on(synth,e);
+ fluid_synth_set_reverb(synth,r,d,w,l);
+}
+void CMidiPlayer::getChorusPara(int *fb,double *l,double *r,double *d,int *type)
+{
+ if(!synth)return;
+ *fb=fluid_synth_get_chorus_nr(synth);
+ *l=fluid_synth_get_chorus_level(synth);
+ *r=fluid_synth_get_chorus_speed_Hz(synth);
+ *d=fluid_synth_get_chorus_depth_ms(synth);
+ *type=fluid_synth_get_chorus_type(synth);
+}
+void CMidiPlayer::setChorusPara(int e,int fb,double l,double r,double d,int type)
+{
+ if(!synth)return;
+ fluid_synth_set_chorus_on(synth,e);
+ fluid_synth_set_chorus(synth,fb,l,r,d,type);
+}
int CMidiPlayer::getSFCount()
{return synth?fluid_synth_sfcount(synth):0;}
fluid_sfont_t* CMidiPlayer::getSFPtr(int sfid)
diff --git a/qmpmidiplay.hpp b/qmpmidiplay.hpp
index cdd6741..472e46e 100644
--- a/qmpmidiplay.hpp
+++ b/qmpmidiplay.hpp
@@ -22,6 +22,7 @@ class CMidiFile
{
private:
SEvent *eventList[10000000];
+ char *title,*copyright;
uint32_t eventc;
uint32_t fmt,trk,divs;
FILE *f;
@@ -42,6 +43,8 @@ class CMidiFile
const SEvent* getEvent(uint32_t id);
uint32_t getEventCount();
uint32_t getDivision();
+ const char* getTitle();
+ const char* getCopyright();
};
class CMidiPlayer
{
@@ -54,7 +57,8 @@ class CMidiPlayer
fluid_settings_t* settings;
fluid_synth_t* synth;
fluid_audio_driver_t* adriver;
- uint32_t ctempo,ctsn,ctsd,dpt,divs;//delay_per_tick
+ uint32_t ctempo,ctsn,ctsd,dpt,divs,cks;
+ //raw tempo, timesig num., timesig den., delay per tick, division, keysig
//thread control
uint32_t tceptr,tcpaused,tcstop;
uint32_t finished,resumed;
@@ -81,10 +85,16 @@ class CMidiPlayer
void setTCeptr(uint32_t ep,uint32_t st);
uint32_t getTCpaused();
void setTCpaused(uint32_t ps);
- double getFtime();
uint32_t isFinished();
void setResumed();
+ double getFtime();
+ void getCurrentTimeSignature(int *n,int *d);
+ void getCurrentKeySignature(int *ks);
+ double getTempo();
+ const char* getTitle();
+ const char* getCopyright();
+
void setGain(double gain);
int getPolyphone();
int getMaxPolyphone();
@@ -96,6 +106,10 @@ class CMidiPlayer
void setSolo(int ch,bool s);
int getCC(int ch,int id);
void setCC(int ch,int id,int val);
+ void getReverbPara(double *r,double *d,double *w,double *l);
+ void setReverbPara(int e,double r,double d,double w,double l);
+ void getChorusPara(int *fb,double *l,double *r,double *d,int *type);
+ void setChorusPara(int e,int fb,double l,double r,double d,int type);
//void pushSoundFont(const char* url);
int getSFCount();
diff --git a/qmpmidiread.cpp b/qmpmidiread.cpp
index b960369..0d9a7bc 100644
--- a/qmpmidiread.cpp
+++ b/qmpmidiread.cpp
@@ -130,7 +130,17 @@ retry:
{
++byteread;if(str)str[c]=fgetc(f);else fgetc(f);
}
- eventList[eventc++]=new SEvent(curid,curt,type,metatype,0,str);
+ if(str)str[c]='\0';eventList[eventc++]=new SEvent(curid,curt,type,metatype,0,str);
+ if(str&&metatype==0x03&&!title)
+ {
+ title=new char[len+8];
+ strcpy(title,str);
+ }
+ if(str&&metatype==0x02&&!copyright)
+ {
+ copyright=new char[len+8];
+ strcpy(copyright,str);
+ }
if(len<=1024&&len>0)delete[] str;
}
}
@@ -188,6 +198,7 @@ void CMidiFile::chunkReader(int hdrXp)
}
CMidiFile::CMidiFile(const char* fn)
{
+ title=copyright=NULL;
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);
@@ -198,7 +209,10 @@ CMidiFile::CMidiFile(const char* fn)
CMidiFile::~CMidiFile()
{
for(uint32_t i=0;i<eventc;++i)delete eventList[i];
+ if(title)delete[] title;if(copyright)delete[] copyright;
}
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;}
+const char* CMidiFile::getTitle(){return title;}
+const char* CMidiFile::getCopyright(){return copyright;}
diff --git a/qmpplistwindow.cpp b/qmpplistwindow.cpp
index 65c01f8..e0c52db 100644
--- a/qmpplistwindow.cpp
+++ b/qmpplistwindow.cpp
@@ -5,9 +5,9 @@
#include "ui_qmpplistwindow.h"
#include "qmpmainwindow.hpp"
-qmpplistwindow::qmpplistwindow(QWidget *parent) :
+qmpPlistWindow::qmpPlistWindow(QWidget *parent) :
QDialog(parent),
- ui(new Ui::qmpplistwindow)
+ ui(new Ui::qmpPlistWindow)
{
ui->setupUi(this);
connect(this,SIGNAL(dialogClosing()),parent,SLOT(dialogClosed()));
@@ -15,19 +15,19 @@ qmpplistwindow::qmpplistwindow(QWidget *parent) :
repeat=0;shuffle=0;
}
-qmpplistwindow::~qmpplistwindow()
+qmpPlistWindow::~qmpPlistWindow()
{
delete ui;
}
-void qmpplistwindow::closeEvent(QCloseEvent *event)
+void qmpPlistWindow::closeEvent(QCloseEvent *event)
{
setVisible(false);
emit dialogClosing();
event->accept();
}
-void qmpplistwindow::on_pbAdd_clicked()
+void qmpPlistWindow::on_pbAdd_clicked()
{
QStringList sl=QFileDialog::getOpenFileNames(this,"Add File","","Midi files (*.mid *.midi)");
for(int i=0;i<sl.size();++i)
@@ -36,13 +36,13 @@ void qmpplistwindow::on_pbAdd_clicked()
}
}
-void qmpplistwindow::on_pbAddFolder_clicked()
+void qmpPlistWindow::on_pbAddFolder_clicked()
{
QFileDialog::getExistingDirectory(this,"Add Folder");
//...
}
-void qmpplistwindow::on_pbRemove_clicked()
+void qmpPlistWindow::on_pbRemove_clicked()
{
QList<QListWidgetItem*> sl=ui->lwFiles->selectedItems();
for(int i=0;i<sl.size();++i)
@@ -52,7 +52,7 @@ void qmpplistwindow::on_pbRemove_clicked()
}
}
-void qmpplistwindow::on_pbClear_clicked()
+void qmpPlistWindow::on_pbClear_clicked()
{
while(ui->lwFiles->count()>0)
{
@@ -62,7 +62,7 @@ void qmpplistwindow::on_pbClear_clicked()
}
}
-void qmpplistwindow::on_pbRepeat_clicked()
+void qmpPlistWindow::on_pbRepeat_clicked()
{
++repeat;repeat%=3;
switch(repeat)
@@ -82,7 +82,7 @@ void qmpplistwindow::on_pbRepeat_clicked()
}
}
-void qmpplistwindow::on_pbShuffle_clicked()
+void qmpPlistWindow::on_pbShuffle_clicked()
{
shuffle=1-shuffle;
switch(shuffle)
@@ -99,7 +99,7 @@ void qmpplistwindow::on_pbShuffle_clicked()
}
}
-QString qmpplistwindow::getFirstItem()
+QString qmpPlistWindow::getFirstItem()
{
if(ui->lwFiles->count()==0)return QString();
int id=0;
@@ -107,7 +107,7 @@ QString qmpplistwindow::getFirstItem()
ui->lwFiles->setCurrentRow(id);
return ui->lwFiles->item(id)->text();
}
-QString qmpplistwindow::getNextItem()
+QString qmpPlistWindow::getNextItem()
{
if(ui->lwFiles->count()==0)return QString();
if(repeat==1)return ui->lwFiles->item(ui->lwFiles->currentRow())->text();
@@ -116,7 +116,7 @@ QString qmpplistwindow::getNextItem()
ui->lwFiles->setCurrentRow(id);
return ui->lwFiles->item(id)->text();
}
-QString qmpplistwindow::getPrevItem()
+QString qmpPlistWindow::getPrevItem()
{
if(ui->lwFiles->count()==0)return QString();
if(repeat==1)return ui->lwFiles->item(ui->lwFiles->currentRow())->text();
@@ -126,14 +126,14 @@ QString qmpplistwindow::getPrevItem()
ui->lwFiles->setCurrentRow(id);
return ui->lwFiles->item(id)->text();
}
-QString qmpplistwindow::getSelectedItem()
+QString qmpPlistWindow::getSelectedItem()
{
if(ui->lwFiles->count()==0)return QString();
return ui->lwFiles->item(ui->lwFiles->currentRow())->text();
}
-int qmpplistwindow::getRepeat(){return repeat;}
+int qmpPlistWindow::getRepeat(){return repeat;}
-void qmpplistwindow::on_lwFiles_itemDoubleClicked()
+void qmpPlistWindow::on_lwFiles_itemDoubleClicked()
{
emit selectionChanging();
}
diff --git a/qmpplistwindow.hpp b/qmpplistwindow.hpp
index 3c2e712..17d7420 100644
--- a/qmpplistwindow.hpp
+++ b/qmpplistwindow.hpp
@@ -6,16 +6,16 @@
#include <QListWidgetItem>
namespace Ui {
- class qmpplistwindow;
+ class qmpPlistWindow;
}
-class qmpplistwindow : public QDialog
+class qmpPlistWindow : public QDialog
{
Q_OBJECT
public:
- explicit qmpplistwindow(QWidget *parent=0);
- ~qmpplistwindow();
+ explicit qmpPlistWindow(QWidget *parent=0);
+ ~qmpPlistWindow();
void closeEvent(QCloseEvent *event);
int getRepeat();
QString getFirstItem();
@@ -44,7 +44,7 @@ class qmpplistwindow : public QDialog
void on_lwFiles_itemDoubleClicked();
private:
- Ui::qmpplistwindow *ui;
+ Ui::qmpPlistWindow *ui;
int shuffle,repeat;//rep 0=off 1=one 2=all
};
diff --git a/qmpplistwindow.ui b/qmpplistwindow.ui
index 964cc41..c4e6fbc 100644
--- a/qmpplistwindow.ui
+++ b/qmpplistwindow.ui
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
- <class>qmpplistwindow</class>
- <widget class="QDialog" name="qmpplistwindow">
+ <class>qmpPlistWindow</class>
+ <widget class="QDialog" name="qmpPlistWindow">
<property name="geometry">
<rect>
<x>0</x>
diff --git a/qmppresetselect.cpp b/qmppresetselect.cpp
index 22b54ca..46c0e6d 100644
--- a/qmppresetselect.cpp
+++ b/qmppresetselect.cpp
@@ -3,19 +3,19 @@
#include "ui_qmppresetselect.h"
#include "qmpmainwindow.hpp"
-qmppresetselect::qmppresetselect(QWidget *parent) :
+qmpPresetSelector::qmpPresetSelector(QWidget *parent) :
QDialog(parent),
- ui(new Ui::qmppresetselect)
+ ui(new Ui::qmpPresetSelector)
{
ui->setupUi(this);
}
-qmppresetselect::~qmppresetselect()
+qmpPresetSelector::~qmpPresetSelector()
{
delete ui;
}
-void qmppresetselect::showEvent(QShowEvent *e)
+void qmpPresetSelector::showEvent(QShowEvent *e)
{
e->accept();memset(presets,0,sizeof(presets));
CMidiPlayer *plyr=qmpMainWindow::getInstance()->getPlayer();
@@ -37,7 +37,7 @@ void qmppresetselect::showEvent(QShowEvent *e)
if(b)ui->lwBankSelect->addItem(QString::number(i));
}
}
-void qmppresetselect::setupWindow(int chid)
+void qmpPresetSelector::setupWindow(int chid)
{
CMidiPlayer *plyr=qmpMainWindow::getInstance()->getPlayer();
ch=chid;int b,p,r;char name[30];
@@ -50,6 +50,7 @@ void qmppresetselect::setupWindow(int chid)
if(r==b){ui->lwBankSelect->setCurrentRow(i);break;}
}
r=0;
+ ui->lwPresetSelect->clear();
for(int i=0,cr=0;i<128;++i)
if(strlen(presets[b][i]))
{
@@ -61,12 +62,12 @@ void qmppresetselect::setupWindow(int chid)
ui->lwPresetSelect->setCurrentRow(r);
}
-void qmppresetselect::on_pbCancel_clicked()
+void qmpPresetSelector::on_pbCancel_clicked()
{
close();
}
-void qmppresetselect::on_pbOk_clicked()
+void qmpPresetSelector::on_pbOk_clicked()
{
CMidiPlayer *plyr=qmpMainWindow::getInstance()->getPlayer();
int b,p;sscanf(ui->lwBankSelect->currentItem()->text().toStdString().c_str(),"%d",&b);
@@ -75,12 +76,12 @@ void qmppresetselect::on_pbOk_clicked()
close();
}
-void qmppresetselect::on_lwPresetSelect_itemDoubleClicked()
+void qmpPresetSelector::on_lwPresetSelect_itemDoubleClicked()
{
on_pbOk_clicked();
}
-void qmppresetselect::on_lwBankSelect_currentRowChanged()
+void qmpPresetSelector::on_lwBankSelect_currentRowChanged()
{
ui->lwPresetSelect->clear();
if(!ui->lwBankSelect->currentItem())return;
diff --git a/qmppresetselect.hpp b/qmppresetselect.hpp
index 51d0f21..8a185f8 100644
--- a/qmppresetselect.hpp
+++ b/qmppresetselect.hpp
@@ -5,16 +5,16 @@
#include <QShowEvent>
namespace Ui {
- class qmppresetselect;
+ class qmpPresetSelector;
}
-class qmppresetselect:public QDialog
+class qmpPresetSelector:public QDialog
{
Q_OBJECT
public:
- explicit qmppresetselect(QWidget *parent = 0);
- ~qmppresetselect();
+ explicit qmpPresetSelector(QWidget *parent = 0);
+ ~qmpPresetSelector();
void showEvent(QShowEvent* e);
void setupWindow(int chid);
@@ -28,7 +28,7 @@ class qmppresetselect:public QDialog
void on_lwPresetSelect_itemDoubleClicked();
private:
- Ui::qmppresetselect *ui;
+ Ui::qmpPresetSelector *ui;
char presets[129][128][24];
int ch;
};
diff --git a/qmppresetselect.ui b/qmppresetselect.ui
index 65a03f4..f18600d 100644
--- a/qmppresetselect.ui
+++ b/qmppresetselect.ui
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
- <class>qmppresetselect</class>
- <widget class="QDialog" name="qmppresetselect">
+ <class>qmpPresetSelector</class>
+ <widget class="QDialog" name="qmpPresetSelector">
<property name="geometry">
<rect>
<x>0</x>