From 8f8782f43bd838e825f3792b611d27fffa90399b Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Thu, 7 Apr 2016 23:39:02 +0800 Subject: Lunatic Princess. --- qmidiplayer-desktop/qmidiplayer-desktop.pro | 7 ++++--- qmidiplayer-desktop/qmpchannelswindow.cpp | 16 ++++++++++++---- qmidiplayer-desktop/qmpchannelswindow.hpp | 18 ++++++++++++++++++ qmidiplayer-desktop/qmpimidimapper.hpp | 16 ---------------- qmidiplayer-desktop/qmpmainwindow.cpp | 4 ++-- 5 files changed, 36 insertions(+), 25 deletions(-) delete mode 100644 qmidiplayer-desktop/qmpimidimapper.hpp (limited to 'qmidiplayer-desktop') 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;jaddItem(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 #include #include +#include #include #include #include #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());} -- cgit v1.2.3