aboutsummaryrefslogtreecommitdiff
path: root/qmidiplayer-desktop
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2016-04-07 23:39:02 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2016-04-07 23:39:02 +0800
commit8f8782f43bd838e825f3792b611d27fffa90399b (patch)
tree1fbd96dd7ce061010edacf67f72f0ffb07889edf /qmidiplayer-desktop
parent70fd2d85c1bd6fb8732e680e8fda9d36c317c732 (diff)
downloadQMidiPlayer-8f8782f43bd838e825f3792b611d27fffa90399b.tar.xz
Lunatic Princess.
Diffstat (limited to 'qmidiplayer-desktop')
-rw-r--r--qmidiplayer-desktop/qmidiplayer-desktop.pro7
-rw-r--r--qmidiplayer-desktop/qmpchannelswindow.cpp16
-rw-r--r--qmidiplayer-desktop/qmpchannelswindow.hpp18
-rw-r--r--qmidiplayer-desktop/qmpimidimapper.hpp16
-rw-r--r--qmidiplayer-desktop/qmpmainwindow.cpp4
5 files changed, 36 insertions, 25 deletions
diff --git a/qmidiplayer-desktop/qmidiplayer-desktop.pro b/qmidiplayer-desktop/qmidiplayer-desktop.pro
index 328af5d..0ac1b97 100644
--- a/qmidiplayer-desktop/qmidiplayer-desktop.pro
+++ b/qmidiplayer-desktop/qmidiplayer-desktop.pro
@@ -24,7 +24,8 @@ SOURCES += main.cpp\
qmpinfowindow.cpp \
qmpsettingswindow.cpp \
qmphelpwindow.cpp \
- qdialskulpturestyle.cpp
+ qdialskulpturestyle.cpp \
+ ../core/qmpmidimapperrtmidi.cpp
HEADERS += qmpmainwindow.hpp \
../core/qmpmidiplay.hpp \
@@ -37,7 +38,7 @@ HEADERS += qmpmainwindow.hpp \
qmpsettingswindow.hpp \
qmphelpwindow.hpp \
qdialskulpturestyle.hpp \
- qmpimidimapper.hpp
+ ../core/qmpmidimappers.hpp
FORMS += qmpmainwindow.ui \
qmpplistwindow.ui \
@@ -57,7 +58,7 @@ unix{
target.path = $$BINDIR
INSTALLS += target
QMAKE_CXXFLAGS += -std=c++11 -Wall
- LIBS += -lfluidsynth
+ 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...
diff --git a/qmidiplayer-desktop/qmpchannelswindow.cpp b/qmidiplayer-desktop/qmpchannelswindow.cpp
index a9cf60e..4d5f6ab 100644
--- a/qmidiplayer-desktop/qmpchannelswindow.cpp
+++ b/qmidiplayer-desktop/qmpchannelswindow.cpp
@@ -13,16 +13,19 @@ qmpChannelsWindow::qmpChannelsWindow(QWidget *parent) :
pselectw=new qmpPresetSelector(this);
ceditw=new qmpChannelEditor(this);
connect(this,SIGNAL(dialogClosing()),parent,SLOT(dialogClosed()));
+ mapper=qmpMainWindow::getInstance()->getPlayer()->getMidiMapper();
+ 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->setCellWidget(i,1,new QCheckBox(""));
connect(ui->twChannels->cellWidget(i,1),SIGNAL(stateChanged(int)),this,SLOT(channelMSChanged()));
- ui->twChannels->setCellWidget(i,2,new QComboBox());
- QComboBox *cb=(QComboBox*)ui->twChannels->cellWidget(i,2);
- //stub
- cb->addItem("Internal FluidSynth");
+ ui->twChannels->setCellWidget(i,2,new QDCComboBox());
+ QDCComboBox *cb=(QDCComboBox*)ui->twChannels->cellWidget(i,2);
+ 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)));
@@ -130,3 +133,8 @@ void qmpChannelsWindow::showChannelEditorWindow(int chid)
ceditw->show();
ceditw->setupWindow(chid);
}
+
+void qmpChannelsWindow::changeMidiMapping(int chid,int idx)
+{
+ qmpMainWindow::getInstance()->getPlayer()->setChannelOutput(chid,idx);
+}
diff --git a/qmidiplayer-desktop/qmpchannelswindow.hpp b/qmidiplayer-desktop/qmpchannelswindow.hpp
index f0591b6..57f293e 100644
--- a/qmidiplayer-desktop/qmpchannelswindow.hpp
+++ b/qmidiplayer-desktop/qmpchannelswindow.hpp
@@ -4,11 +4,13 @@
#include <QLabel>
#include <QPushButton>
#include <QDialog>
+#include <QComboBox>
#include <QShowEvent>
#include <QCloseEvent>
#include <QMoveEvent>
#include "qmppresetselect.hpp"
#include "qmpchanneleditor.hpp"
+#include "../core/qmpmidimappers.hpp"
namespace Ui {
class qmpChannelsWindow;
@@ -42,6 +44,20 @@ class QDCPushButton:public QPushButton
void onClick(int id);
};
+class QDCComboBox:public QComboBox
+{
+ Q_OBJECT
+ private:
+ int id;
+ public:
+ QDCComboBox():QComboBox(){id=-1;connect(this,SIGNAL(currentIndexChanged(int)),this,SLOT(indexChangedSlot(int)));}
+ void setID(int _id){id=_id;}
+ signals:
+ void onChange(int id,int idx);
+ public slots:
+ void indexChangedSlot(int idx){emit(onChange(id,idx));}
+};
+
class qmpChannelsWindow:public QDialog
{
Q_OBJECT
@@ -59,6 +75,7 @@ class qmpChannelsWindow:public QDialog
void channelMSChanged();
void showPresetWindow(int chid);
void showChannelEditorWindow(int chid);
+ void changeMidiMapping(int chid,int idx);
void on_pbUnmute_clicked();
void on_pbUnsolo_clicked();
@@ -66,6 +83,7 @@ class qmpChannelsWindow:public QDialog
Ui::qmpChannelsWindow *ui;
qmpPresetSelector *pselectw;
qmpChannelEditor *ceditw;
+ qmpMidiMapperRtMidi *mapper;
};
#endif // QMPCHANNELSWINDOW_H
diff --git a/qmidiplayer-desktop/qmpimidimapper.hpp b/qmidiplayer-desktop/qmpimidimapper.hpp
deleted file mode 100644
index d35dbb9..0000000
--- a/qmidiplayer-desktop/qmpimidimapper.hpp
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef QMPIMIDIMAPPER_H
-#define QMPIMIDIMAPPER_H
-class qmpIMidiMapper
-{
- virtual void deviceInit(int id)=0;
- virtual void deviceDeinit(int id)=0;
- virtual void noteOn(int ch,int key,int vel)=0;
- virtual void noteOff(int ch,int key)=0;
- virtual void ctrlChange(int ch,int cc,int val)=0;
- virtual void progChange(int ch,int val)=0;
- virtual void pitchBend(int ch,int val)=0;
- virtual void sysEx(int length,const char* data)=0;
- virtual static int enumDevices()=0;
- virtual static char* deviceName(int id)=0;
-};
-#endif // QMPIMIDIMAPPER_H
diff --git a/qmidiplayer-desktop/qmpmainwindow.cpp b/qmidiplayer-desktop/qmpmainwindow.cpp
index 58caea1..32d28f2 100644
--- a/qmidiplayer-desktop/qmpmainwindow.cpp
+++ b/qmidiplayer-desktop/qmpmainwindow.cpp
@@ -20,6 +20,8 @@ qmpMainWindow::qmpMainWindow(QWidget *parent) :
ui->lbFileName->setText("");ref=this;
playing=false;stopped=true;dragging=false;
settingsw=new qmpSettingsWindow(this);
+ singleFS=qmpSettingsWindow::getSettingsIntf()->value("Behavior/SingleInstance",0).toInt();
+ player=new CMidiPlayer(singleFS);
plistw=new qmpPlistWindow(this);
chnlw=new qmpChannelsWindow(this);
efxw=new qmpEfxWindow(this);
@@ -30,8 +32,6 @@ qmpMainWindow::qmpMainWindow(QWidget *parent) :
fnA2=new QAction("Render to Wave",ui->lbFileName);
ui->lbFileName->addAction(fnA1);
ui->lbFileName->addAction(fnA2);
- singleFS=qmpSettingsWindow::getSettingsIntf()->value("Behavior/SingleInstance",0).toInt();
- player=new CMidiPlayer(singleFS);
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());}