aboutsummaryrefslogtreecommitdiff
path: root/qmidiplayer-desktop
diff options
context:
space:
mode:
Diffstat (limited to 'qmidiplayer-desktop')
-rw-r--r--qmidiplayer-desktop/qmidiplayer-desktop.pro12
-rw-r--r--qmidiplayer-desktop/qmpchannelswindow.cpp58
-rw-r--r--qmidiplayer-desktop/qmpchannelswindow.hpp13
-rw-r--r--qmidiplayer-desktop/qmpchannelswindow.ui9
-rw-r--r--qmidiplayer-desktop/qmphelpwindow.hpp2
-rw-r--r--qmidiplayer-desktop/qmpmainwindow.cpp22
-rw-r--r--qmidiplayer-desktop/qmpsettingswindow.cpp16
-rw-r--r--qmidiplayer-desktop/resources.qrc2
8 files changed, 97 insertions, 37 deletions
diff --git a/qmidiplayer-desktop/qmidiplayer-desktop.pro b/qmidiplayer-desktop/qmidiplayer-desktop.pro
index 0ac1b97..6ac0670 100644
--- a/qmidiplayer-desktop/qmidiplayer-desktop.pro
+++ b/qmidiplayer-desktop/qmidiplayer-desktop.pro
@@ -11,6 +11,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = qmidiplayer
TEMPLATE = app
+CONFIG += c++11
SOURCES += main.cpp\
qmpmainwindow.cpp \
@@ -57,9 +58,14 @@ unix{
BINDIR = $$PREFIX/bin
target.path = $$BINDIR
INSTALLS += target
- QMAKE_CXXFLAGS += -std=c++11 -Wall
+ QMAKE_CXXFLAGS += -Wall
LIBS += -lfluidsynth -lrtmidi
}
-win32:LIBS += e:/libs/fluidsynth/fluidsynth.lib winmm.lib #You have to change these
-win32:INCLUDEPATH += e:/libs/fluidsynth/include #before building...
+win32{
+ #change these before building...
+ LIBS += e:/libs/fluidsynth/fluidsynth.lib winmm.lib
+ LIBS += e:/libs/rtmidi/rtmidi.lib
+ INCLUDEPATH += e:/libs/fluidsynth/include
+ INCLUDEPATH += e:/libs/rtmidi
+}
RESOURCES = resources.qrc
diff --git a/qmidiplayer-desktop/qmpchannelswindow.cpp b/qmidiplayer-desktop/qmpchannelswindow.cpp
index 4d5f6ab..3e43c3d 100644
--- a/qmidiplayer-desktop/qmpchannelswindow.cpp
+++ b/qmidiplayer-desktop/qmpchannelswindow.cpp
@@ -14,30 +14,38 @@ qmpChannelsWindow::qmpChannelsWindow(QWidget *parent) :
ceditw=new qmpChannelEditor(this);
connect(this,SIGNAL(dialogClosing()),parent,SLOT(dialogClosed()));
mapper=qmpMainWindow::getInstance()->getPlayer()->getMidiMapper();
+ cha=new QPixmap(":/img/ledon.png");chi=new QPixmap(":/img/ledoff.png");
+ cb=new qmpCWNoteOnCB();
+ qmpMainWindow::getInstance()->getPlayer()->setNoteOnCallBack(cb,NULL);
+ connect(cb,SIGNAL(onNoteOn()),this,SLOT(updateChannelActivity()));
int devc=mapper->enumDevices();
for(int i=0;i<16;++i)
{
- ui->twChannels->setCellWidget(i,0,new QCheckBox(""));
- connect(ui->twChannels->cellWidget(i,0),SIGNAL(stateChanged(int)),this,SLOT(channelMSChanged()));
+ ui->twChannels->setItem(i,0,new QTableWidgetItem());
+ ui->twChannels->item(i,0)->setIcon(*chi);
+ ui->twChannels->item(i,0)->setFlags(ui->twChannels->item(i,0)->flags()^Qt::ItemIsEditable);
ui->twChannels->setCellWidget(i,1,new QCheckBox(""));
connect(ui->twChannels->cellWidget(i,1),SIGNAL(stateChanged(int)),this,SLOT(channelMSChanged()));
- ui->twChannels->setCellWidget(i,2,new QDCComboBox());
- QDCComboBox *cb=(QDCComboBox*)ui->twChannels->cellWidget(i,2);
+ ui->twChannels->setCellWidget(i,2,new QCheckBox(""));
+ connect(ui->twChannels->cellWidget(i,2),SIGNAL(stateChanged(int)),this,SLOT(channelMSChanged()));
+ ui->twChannels->setCellWidget(i,3,new QDCComboBox());
+ QDCComboBox *cb=(QDCComboBox*)ui->twChannels->cellWidget(i,3);
cb->addItem("Internal FluidSynth");cb->setID(i);
for(int j=0;j<devc;++j)cb->addItem(mapper->deviceName(j).c_str());
connect(cb,SIGNAL(onChange(int,int)),this,SLOT(changeMidiMapping(int,int)));
- ui->twChannels->setCellWidget(i,3,new QDCLabel(""));
- ((QDCLabel*)ui->twChannels->cellWidget(i,3))->setID(i);
- connect(ui->twChannels->cellWidget(i,3),SIGNAL(onDoubleClick(int)),this,SLOT(showPresetWindow(int)));
- ui->twChannels->setCellWidget(i,4,new QDCPushButton("..."));
+ ui->twChannels->setCellWidget(i,4,new QDCLabel(""));
((QDCLabel*)ui->twChannels->cellWidget(i,4))->setID(i);
- connect(ui->twChannels->cellWidget(i,4),SIGNAL(onClick(int)),this,SLOT(showChannelEditorWindow(int)));
+ connect(ui->twChannels->cellWidget(i,4),SIGNAL(onDoubleClick(int)),this,SLOT(showPresetWindow(int)));
+ ui->twChannels->setCellWidget(i,5,new QDCPushButton("..."));
+ ((QDCLabel*)ui->twChannels->cellWidget(i,5))->setID(i);
+ connect(ui->twChannels->cellWidget(i,5),SIGNAL(onClick(int)),this,SLOT(showChannelEditorWindow(int)));
}
- ui->twChannels->setColumnWidth(0,32);
+ ui->twChannels->setColumnWidth(0,24);
ui->twChannels->setColumnWidth(1,32);
- ui->twChannels->setColumnWidth(2,192);
+ ui->twChannels->setColumnWidth(2,32);
ui->twChannels->setColumnWidth(3,192);
- ui->twChannels->setColumnWidth(4,32);
+ ui->twChannels->setColumnWidth(4,192);
+ ui->twChannels->setColumnWidth(5,32);
}
void qmpChannelsWindow::showEvent(QShowEvent *event)
@@ -68,12 +76,19 @@ void qmpChannelsWindow::moveEvent(QMoveEvent *event)
}
}
+void qmpChannelsWindow::updateChannelActivity()
+{
+ for(int i=0;i<16;++i)
+ ui->twChannels->item(i,0)->setIcon(
+ qmpMainWindow::getInstance()->getPlayer()->getChstates()[i]?*cha:*chi);
+}
+
void qmpChannelsWindow::channelWindowsUpdate()
{
if(qmpMainWindow::getInstance()->getPlayer()->isFinished())
{
for(int i=0;i<16;++i)
- ((QLabel*)ui->twChannels->cellWidget(i,3))->setText("");
+ ((QLabel*)ui->twChannels->cellWidget(i,4))->setText("");
return;
}
for(int i=0;i<16;++i)
@@ -82,7 +97,11 @@ void qmpChannelsWindow::channelWindowsUpdate()
int b,p;
qmpMainWindow::getInstance()->getPlayer()->getChannelPreset(i,&b,&p,nm);
sprintf(data,"%d:%d %s",b,p,nm);
- ((QLabel*)ui->twChannels->cellWidget(i,3))->setText(data);
+ ((QLabel*)ui->twChannels->cellWidget(i,4))->setText(data);
+ ui->twChannels->item(i,0)->setIcon(
+ qmpMainWindow::getInstance()->getPlayer()->getChstates()[i]?*cha:*chi);
+ if(qmpMainWindow::getInstance()->getPlayer()->getChstates()[i])
+ qmpMainWindow::getInstance()->getPlayer()->getChstates()[i]=0;
}
}
@@ -91,8 +110,8 @@ void qmpChannelsWindow::channelMSChanged()
for(int i=0;i<16;++i)
{
QCheckBox *m,*s;
- m=(QCheckBox*)ui->twChannels->cellWidget(i,0);
- s=(QCheckBox*)ui->twChannels->cellWidget(i,1);
+ m=(QCheckBox*)ui->twChannels->cellWidget(i,1);
+ s=(QCheckBox*)ui->twChannels->cellWidget(i,2);
if(m->isChecked()&&s->isChecked())s->setChecked(false);
qmpMainWindow::getInstance()->getPlayer()->setMute(i,m->isChecked());
qmpMainWindow::getInstance()->getPlayer()->setSolo(i,s->isChecked());
@@ -101,14 +120,15 @@ void qmpChannelsWindow::channelMSChanged()
qmpChannelsWindow::~qmpChannelsWindow()
{
- delete ui;
+ delete chi;delete cha;
+ delete cb;delete ui;
}
void qmpChannelsWindow::on_pbUnmute_clicked()
{
for(int i=0;i<16;++i)
{
- ((QCheckBox*)ui->twChannels->cellWidget(i,0))->setChecked(false);
+ ((QCheckBox*)ui->twChannels->cellWidget(i,1))->setChecked(false);
qmpMainWindow::getInstance()->getPlayer()->setMute(i,false);
}
}
@@ -117,7 +137,7 @@ void qmpChannelsWindow::on_pbUnsolo_clicked()
{
for(int i=0;i<16;++i)
{
- ((QCheckBox*)ui->twChannels->cellWidget(i,1))->setChecked(false);
+ ((QCheckBox*)ui->twChannels->cellWidget(i,2))->setChecked(false);
qmpMainWindow::getInstance()->getPlayer()->setSolo(i,false);
}
}
diff --git a/qmidiplayer-desktop/qmpchannelswindow.hpp b/qmidiplayer-desktop/qmpchannelswindow.hpp
index 57f293e..80f427a 100644
--- a/qmidiplayer-desktop/qmpchannelswindow.hpp
+++ b/qmidiplayer-desktop/qmpchannelswindow.hpp
@@ -10,6 +10,7 @@
#include <QMoveEvent>
#include "qmppresetselect.hpp"
#include "qmpchanneleditor.hpp"
+#include "../core/qmpmidiplay.hpp"
#include "../core/qmpmidimappers.hpp"
namespace Ui {
@@ -58,6 +59,15 @@ class QDCComboBox:public QComboBox
void indexChangedSlot(int idx){emit(onChange(id,idx));}
};
+class qmpCWNoteOnCB:public QObject,public CMidiCallBack
+{
+ Q_OBJECT
+ public:
+ void callBack(void *data){if(data)data=NULL;emit(onNoteOn());}
+ signals:
+ void onNoteOn();
+};
+
class qmpChannelsWindow:public QDialog
{
Q_OBJECT
@@ -72,6 +82,7 @@ class qmpChannelsWindow:public QDialog
void dialogClosing();
public slots:
void channelWindowsUpdate();
+ void updateChannelActivity();
void channelMSChanged();
void showPresetWindow(int chid);
void showChannelEditorWindow(int chid);
@@ -84,6 +95,8 @@ class qmpChannelsWindow:public QDialog
qmpPresetSelector *pselectw;
qmpChannelEditor *ceditw;
qmpMidiMapperRtMidi *mapper;
+ QPixmap *cha,*chi;
+ qmpCWNoteOnCB *cb;
};
#endif // QMPCHANNELSWINDOW_H
diff --git a/qmidiplayer-desktop/qmpchannelswindow.ui b/qmidiplayer-desktop/qmpchannelswindow.ui
index a8b43cb..2d85ab0 100644
--- a/qmidiplayer-desktop/qmpchannelswindow.ui
+++ b/qmidiplayer-desktop/qmpchannelswindow.ui
@@ -49,7 +49,7 @@
<number>16</number>
</property>
<property name="columnCount">
- <number>5</number>
+ <number>6</number>
</property>
<row/>
<row/>
@@ -69,6 +69,11 @@
<row/>
<column>
<property name="text">
+ <string>A</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
<string>M</string>
</property>
</column>
@@ -92,7 +97,7 @@
<string>...</string>
</property>
</column>
- <item row="0" column="0">
+ <item row="0" column="1">
<property name="text">
<string/>
</property>
diff --git a/qmidiplayer-desktop/qmphelpwindow.hpp b/qmidiplayer-desktop/qmphelpwindow.hpp
index c2052b2..af1b746 100644
--- a/qmidiplayer-desktop/qmphelpwindow.hpp
+++ b/qmidiplayer-desktop/qmphelpwindow.hpp
@@ -2,7 +2,7 @@
#define QMPHELPWINDOW_H
#include <QDialog>
-#define APP_VERSION "0.7.0"
+#define APP_VERSION "0.7.1"
namespace Ui {
class qmpHelpWindow;
diff --git a/qmidiplayer-desktop/qmpmainwindow.cpp b/qmidiplayer-desktop/qmpmainwindow.cpp
index 32d28f2..37ca9f4 100644
--- a/qmidiplayer-desktop/qmpmainwindow.cpp
+++ b/qmidiplayer-desktop/qmpmainwindow.cpp
@@ -9,6 +9,7 @@
#ifdef _WIN32
#include <Windows.h>
#endif
+#define UPDATE_INTERVAL 66
qmpMainWindow* qmpMainWindow::ref=NULL;
@@ -188,7 +189,7 @@ void qmpMainWindow::updateWidgets()
SetThreadPriority(playerTh->native_handle(),THREAD_PRIORITY_TIME_CRITICAL);
#endif
st=std::chrono::steady_clock::now();offset=0;
- timer->start(100);
+ timer->start(UPDATE_INTERVAL);
}
}
if(renderTh)
@@ -199,7 +200,14 @@ void qmpMainWindow::updateWidgets()
ui->centralWidget->setEnabled(true);
delete renderTh;renderTh=NULL;
player->rendererDeinit();
- if(singleFS){player->fluidPreInitialize();playerSetup();player->fluidInitialize();}
+ if(singleFS)
+ {
+ player->fluidPreInitialize();
+ playerSetup();
+ player->fluidInitialize();
+ for(int i=settingsw->getSFWidget()->count()-1;i>=0;--i)
+ player->pushSoundFont(settingsw->getSFWidget()->item(i)->text().toStdString().c_str());
+ }
}
}
while(!player->isFinished()&&player->getTCeptr()>player->getStamp(ui->hsTimer->value())
@@ -281,7 +289,7 @@ void qmpMainWindow::on_pbPlayPause_clicked()
SetThreadPriority(playerTh->native_handle(),THREAD_PRIORITY_TIME_CRITICAL);
#endif
st=std::chrono::steady_clock::now();offset=0;
- timer->start(100);
+ timer->start(UPDATE_INTERVAL);
stopped=false;
}
else
@@ -405,7 +413,7 @@ void qmpMainWindow::on_pbPrev_clicked()
SetThreadPriority(playerTh->native_handle(),THREAD_PRIORITY_TIME_CRITICAL);
#endif
st=std::chrono::steady_clock::now();offset=0;
- timer->start(100);
+ timer->start(UPDATE_INTERVAL);
}
void qmpMainWindow::on_pbNext_clicked()
@@ -430,7 +438,7 @@ void qmpMainWindow::on_pbNext_clicked()
SetThreadPriority(playerTh->native_handle(),THREAD_PRIORITY_TIME_CRITICAL);
#endif
st=std::chrono::steady_clock::now();offset=0;
- timer->start(100);
+ timer->start(UPDATE_INTERVAL);
}
void qmpMainWindow::selectionChanged()
@@ -458,7 +466,7 @@ void qmpMainWindow::selectionChanged()
SetThreadPriority(playerTh->native_handle(),THREAD_PRIORITY_TIME_CRITICAL);
#endif
st=std::chrono::steady_clock::now();offset=0;
- timer->start(100);
+ timer->start(UPDATE_INTERVAL);
}
void qmpMainWindow::on_pbEfx_clicked()
@@ -495,7 +503,7 @@ void qmpMainWindow::onfnA2()
ui->centralWidget->setEnabled(false);
for(int i=settingsw->getSFWidget()->count()-1;i>=0;--i)
player->pushSoundFont(settingsw->getSFWidget()->item(i)->text().toStdString().c_str());
- player->setGain(ui->vsMasterVol->value()/250.);efxw->sendEfxChange();timer->start(100);
+ player->setGain(ui->vsMasterVol->value()/250.);efxw->sendEfxChange();timer->start(UPDATE_INTERVAL);
renderTh=new std::thread(&CMidiPlayer::rendererThread,player);
}
diff --git a/qmidiplayer-desktop/qmpsettingswindow.cpp b/qmidiplayer-desktop/qmpsettingswindow.cpp
index c2e31a2..2074972 100644
--- a/qmidiplayer-desktop/qmpsettingswindow.cpp
+++ b/qmidiplayer-desktop/qmpsettingswindow.cpp
@@ -82,7 +82,7 @@ void qmpSettingsWindow::settingsInit()
settings->setValue("Audio/Driver",ui->cbAudioDrv->currentText());
#ifdef _WIN32
-#define DefBufSize 8192
+#define DefBufSize 256
#else
#define DefBufSize 128
#endif
@@ -97,15 +97,21 @@ void qmpSettingsWindow::settingsInit()
settings->setValue("Audio/BufSize",ui->cbBufSize->currentText().toInt());
#undef DefBufSize
+#ifdef _WIN32
+#define DefBufCnt 8
+#else
+#define DefBufCnt 2
+#endif
selected=-1;
for(int i=0;i<ui->cbBufCnt->count();++i)
- if(ui->cbBufCnt->itemText(i).toInt()==settings->value("Audio/BufCnt",2).toInt())
+ if(ui->cbBufCnt->itemText(i).toInt()==settings->value("Audio/BufCnt",DefBufCnt).toInt())
{selected=i;break;}
if(~selected)ui->cbBufCnt->setCurrentIndex(selected);
- else if(settings->value("Audio/BufCnt",2).toInt()>=2&&settings->value("Audio/BufCnt",2).toInt()<=64)
- ui->cbBufCnt->setCurrentText(settings->value("Audio/BufCnt",2).toString());
- else ui->cbBufCnt->setCurrentText("2");
+ else if(settings->value("Audio/BufCnt",DefBufCnt).toInt()>=2&&settings->value("Audio/BufCnt",DefBufCnt).toInt()<=64)
+ ui->cbBufCnt->setCurrentText(settings->value("Audio/BufCnt",DefBufCnt).toString());
+ else ui->cbBufCnt->setCurrentText(QString::number(DefBufCnt));
settings->setValue("Audio/BufCnt",ui->cbBufCnt->currentText().toInt());
+#undef DefBufCnt
selected=-1;
for(int i=0;i<ui->cbFormat->count();++i)
diff --git a/qmidiplayer-desktop/resources.qrc b/qmidiplayer-desktop/resources.qrc
index 351d2fa..d34966d 100644
--- a/qmidiplayer-desktop/resources.qrc
+++ b/qmidiplayer-desktop/resources.qrc
@@ -25,6 +25,8 @@
<file>../img/stop.png</file>
<file>../img/up.png</file>
<file>../img/visualization.png</file>
+ <file>../img/ledon.png</file>
+ <file>../img/ledoff.png</file>
<file>../img/mainw.png</file>
<file>../img/chanw.png</file>
<file>../doc/index.html</file>