diff options
author | Chris Xiong <chirs241097@gmail.com> | 2016-04-10 23:39:45 +0800 |
---|---|---|
committer | Chris Xiong <chirs241097@gmail.com> | 2016-04-10 23:39:45 +0800 |
commit | 841eb920676d6c8ac6440c8929e7422e95a9c4c5 (patch) | |
tree | c28dd11fb908682e69d5eb6dc953d1e5bf66b5a7 | |
parent | e0e4f9f84bb8eed6cde71ff4d67286c2e26e4693 (diff) | |
download | QMidiPlayer-841eb920676d6c8ac6440c8929e7422e95a9c4c5.tar.xz |
The Last Judgement.
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | core/qmpmidimapperrtmidi.cpp | 4 | ||||
-rw-r--r-- | core/qmpmidiplay.cpp | 10 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmpchannelswindow.cpp | 26 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmpsettingswindow.cpp | 9 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmpsettingswindow.hpp | 6 |
6 files changed, 46 insertions, 13 deletions
@@ -1,3 +1,7 @@ +2016-04-10 0.7.1 beta +Implement output mapping related options. +Fixed several stupid mistakes and typos. + 2016-04-09 0.7.1 beta Add the fuse mechanism to avoid black midi blocking the main thread. diff --git a/core/qmpmidimapperrtmidi.cpp b/core/qmpmidimapperrtmidi.cpp index adba267..10f830e 100644 --- a/core/qmpmidimapperrtmidi.cpp +++ b/core/qmpmidimapperrtmidi.cpp @@ -77,8 +77,8 @@ void qmpMidiMapperRtMidi::pitchBend(int iid,int ch,int val) { if(!ports[iid])return;ch&=0x0F; std::vector<unsigned char>message; - message.push_back(0xE0|ch);message.push_back(val&0xFF); - message.push_back(val>>8);ports[iid]->sendMessage(&message); + message.push_back(0xE0|ch);message.push_back(val&0x7F); + message.push_back(val>>7);ports[iid]->sendMessage(&message); } void qmpMidiMapperRtMidi::sysEx(int iid,int length,const char *data) { diff --git a/core/qmpmidiplay.cpp b/core/qmpmidiplay.cpp index 4ee812f..2ea0873 100644 --- a/core/qmpmidiplay.cpp +++ b/core/qmpmidiplay.cpp @@ -48,7 +48,7 @@ void CMidiPlayer::processEvent(const SEvent *e) { case 0x80://Note off if(mappedoutput[e->type&0x0F]) - mapper->noteOff(mappedoutput[e->type&0x0F]-1,e->type*0x0F,e->p1); + mapper->noteOff(mappedoutput[e->type&0x0F]-1,e->type&0x0F,e->p1); else fluid_synth_noteoff(synth,e->type&0x0F,e->p1); break; @@ -57,7 +57,7 @@ void CMidiPlayer::processEvent(const SEvent *e) if(solo&&!((solo>>(e->type&0x0F))&1))break; if(noteOnCB)noteOnCB->callBack(noteOnCBUserData); if(mappedoutput[e->type&0x0F]) - mapper->noteOn(mappedoutput[e->type&0x0F]-1,e->type*0x0F,e->p1,e->p2); + mapper->noteOn(mappedoutput[e->type&0x0F]-1,e->type&0x0F,e->p1,e->p2); else fluid_synth_noteon(synth,e->type&0x0F,e->p1,e->p2); chstate[e->type&0x0F]=1; @@ -71,19 +71,19 @@ void CMidiPlayer::processEvent(const SEvent *e) rpnid=rpnval=-1; } if(mappedoutput[e->type&0x0F]) - mapper->ctrlChange(mappedoutput[e->type&0x0F]-1,e->type*0x0F,e->p1,e->p2); + mapper->ctrlChange(mappedoutput[e->type&0x0F]-1,e->type&0x0F,e->p1,e->p2); else fluid_synth_cc(synth,e->type&0x0F,e->p1,e->p2); break; case 0xC0://PC if(mappedoutput[e->type&0x0F]) - mapper->progChange(mappedoutput[e->type&0x0F]-1,e->type*0x0F,e->p1); + mapper->progChange(mappedoutput[e->type&0x0F]-1,e->type&0x0F,e->p1); else fluid_synth_program_change(synth,e->type&0x0F,e->p1); break; case 0xE0://PW if(mappedoutput[e->type&0x0F]) - mapper->pitchBend(mappedoutput[e->type&0x0F]-1,e->type*0x0F,e->p1); + mapper->pitchBend(mappedoutput[e->type&0x0F]-1,e->type&0x0F,e->p1); else fluid_synth_pitch_bend(synth,e->type&0x0F,e->p1); break; diff --git a/qmidiplayer-desktop/qmpchannelswindow.cpp b/qmidiplayer-desktop/qmpchannelswindow.cpp index 17c0893..0c33043 100644 --- a/qmidiplayer-desktop/qmpchannelswindow.cpp +++ b/qmidiplayer-desktop/qmpchannelswindow.cpp @@ -20,6 +20,18 @@ qmpChannelsWindow::qmpChannelsWindow(QWidget *parent) : qmpMainWindow::getInstance()->getPlayer()->setNoteOnCallBack(cb,NULL); connect(cb,SIGNAL(onNoteOn()),this,SLOT(updateChannelActivity())); int devc=mapper->enumDevices(); + //We setup default output here... + //Pretty strange... + for(int i=0;i<devc;++i) + { + qmpSettingsWindow::getDefaultOutWidget()->addItem(mapper->deviceName(i).c_str()); + if(!QString(mapper->deviceName(i).c_str()).compare(qmpSettingsWindow::getSettingsIntf()-> + value("Midi/DefaultOutput","Internal FluidSynth").toString())) + qmpSettingsWindow::getDefaultOutWidget()->setCurrentIndex(i+1); + } + qmpSettingsWindow::getSettingsIntf()->setValue("Midi/DefaultOutput", + qmpSettingsWindow::getDefaultOutWidget()->currentText()); + qmpSettingsWindow::getSettingsIntf(); for(int i=0;i<16;++i) { ui->twChannels->setItem(i,0,new QTableWidgetItem()); @@ -32,7 +44,19 @@ qmpChannelsWindow::qmpChannelsWindow(QWidget *parent) : 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()); + for(int j=0;j<devc;++j) + { + cb->addItem(mapper->deviceName(j).c_str()); + if(!qmpSettingsWindow::getSettingsIntf()-> + value("Midi/DefaultOutput","Internal FluidSynth").toString().compare( + QString(mapper->deviceName(j).c_str()))) + { + cb->setCurrentIndex(j+1); + changeMidiMapping(i,j+1); + } + } + if(qmpSettingsWindow::getSettingsIntf()->value("Midi/DisableMapping",0).toInt()) + cb->setEnabled(false); connect(cb,SIGNAL(onChange(int,int)),this,SLOT(changeMidiMapping(int,int))); ui->twChannels->setCellWidget(i,4,new QDCLabel("")); ((QDCLabel*)ui->twChannels->cellWidget(i,4))->setID(i); diff --git a/qmidiplayer-desktop/qmpsettingswindow.cpp b/qmidiplayer-desktop/qmpsettingswindow.cpp index 2074972..2e6af6d 100644 --- a/qmidiplayer-desktop/qmpsettingswindow.cpp +++ b/qmidiplayer-desktop/qmpsettingswindow.cpp @@ -4,7 +4,8 @@ #include "ui_qmpsettingswindow.h" #include "qmpmainwindow.hpp" -QSettings *qmpSettingsWindow::settings=NULL; +QSettings* qmpSettingsWindow::settings=NULL; +QComboBox* qmpSettingsWindow::outwidget=NULL; void qmpFluidForEachOpt(void* data,char* /*name*/,char* option) { @@ -19,7 +20,7 @@ qmpSettingsWindow::qmpSettingsWindow(QWidget *parent) : ui->setupUi(this); connect(this,SIGNAL(dialogClosing()),parent,SLOT(dialogClosed())); settings=new QSettings(QDir::homePath()+QString("/.config/qmprc"),QSettings::IniFormat); - settingsInit(); + settingsInit();outwidget=ui->cbOutputDevice; } qmpSettingsWindow::~qmpSettingsWindow() @@ -37,6 +38,7 @@ void qmpSettingsWindow::closeEvent(QCloseEvent *event) } QListWidget* qmpSettingsWindow::getSFWidget(){return ui->lwSoundfont;} +QComboBox* qmpSettingsWindow::getDefaultOutWidget(){return outwidget;} void qmpSettingsWindow::on_buttonBox_accepted() { @@ -173,8 +175,7 @@ void qmpSettingsWindow::settingsInit() void qmpSettingsWindow::settingsUpdate() { - settings->setValue("Midi/DefaultOutput",settings->value("Midi/DefaultOutput","Internal FluidSynth")); - //this item is still a stub... + settings->setValue("Midi/DefaultOutput",ui->cbOutputDevice->currentText()); settings->setValue("Midi/DisableMapping",ui->cbDisableMapping->isChecked()?1:0); diff --git a/qmidiplayer-desktop/qmpsettingswindow.hpp b/qmidiplayer-desktop/qmpsettingswindow.hpp index c506de4..cac691e 100644 --- a/qmidiplayer-desktop/qmpsettingswindow.hpp +++ b/qmidiplayer-desktop/qmpsettingswindow.hpp @@ -5,6 +5,7 @@ #include <QCloseEvent> #include <QSettings> #include <QListWidget> +#include <QComboBox> namespace Ui { class qmpSettingsWindow; @@ -41,7 +42,10 @@ class qmpSettingsWindow:public QDialog Ui::qmpSettingsWindow *ui; void settingsUpdate(); static QSettings *settings; - public: static QSettings* getSettingsIntf(){return settings;} + static QComboBox* outwidget; + public: + static QSettings* getSettingsIntf(){return settings;} + static QComboBox* getDefaultOutWidget(); }; #endif // QMPSETTINGSWINDOW_H |