diff options
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | core/qmpmidiplay.cpp | 38 | ||||
-rw-r--r-- | core/qmpmidiplay.hpp | 1 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmppresetselect.cpp | 69 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmppresetselect.hpp | 9 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmppresetselect.ui | 71 | ||||
-rw-r--r-- | visualization/visualization.pro | 6 |
7 files changed, 139 insertions, 64 deletions
@@ -1,5 +1,10 @@ -2016-10-28 0.8.3 alpha -Fixed the dbus bug by switching to the GLFW backend for SMELT. +2016-09-23 0.8.3 alpha +Update the preset selection dialog to improve support +for external MIDI devices. + +2016-09-23 0.8.3 alpha +Add a set of icons for dark themes and a option to +change the icon theme. 2016-09-16 0.8.3 alpha Minor bug fix. Update documentation. diff --git a/core/qmpmidiplay.cpp b/core/qmpmidiplay.cpp index 31784e3..bb2279d 100644 --- a/core/qmpmidiplay.cpp +++ b/core/qmpmidiplay.cpp @@ -302,19 +302,20 @@ void CMidiPlayer::playerPanic(bool reset) { for(int i=0;i<16;++i) { - if(reset) - { - fluid_synth_cc(synth,i,0,0); - fluid_synth_cc(synth,i,7,100); - fluid_synth_cc(synth,i,10,64); - fluid_synth_cc(synth,i,11,127); - fluid_synth_cc(synth,i,32,0); + if(synth){ + if(reset){ + fluid_synth_cc(synth,i,0,0); + fluid_synth_cc(synth,i,7,100); + fluid_synth_cc(synth,i,10,64); + fluid_synth_cc(synth,i,11,127); + fluid_synth_cc(synth,i,32,0); + } + fluid_synth_cc(synth,i,64,0); + fluid_synth_pitch_wheel_sens(synth,i,2); + fluid_synth_pitch_bend(synth,i,8192); + //all sounds off causes the minus polyphone bug... + fluid_synth_all_notes_off(synth,i); } - fluid_synth_cc(synth,i,64,0); - fluid_synth_pitch_wheel_sens(synth,i,2); - fluid_synth_pitch_bend(synth,i,8192); - //all sounds off causes the minus polyphone bug... - fluid_synth_all_notes_off(synth,i); if(deviceusage[i])for(int j=0;j<16;++j) reset?mapper->reset(i,j):mapper->panic(i,j); } @@ -441,17 +442,18 @@ void CMidiPlayer::getChannelPreset(int ch,int *b,int *p,char *name) void CMidiPlayer::setChannelPreset(int ch,int b,int p) { if(!synth)return; - chstatus[ch][0]=b;//!!FIXME: This is not correct... chstatus[ch][128]=p; if(mappedoutput[ch]) { //external device mode? - mapper->ctrlChange(mappedoutput[ch]-1,ch,0,b); - mapper->ctrlChange(mappedoutput[ch]-1,ch,32,b); + chstatus[ch][0]=b>>7;chstatus[ch][32]=b&0x7F; + mapper->ctrlChange(mappedoutput[ch]-1,ch,0,b>>7); + mapper->ctrlChange(mappedoutput[ch]-1,ch,32,b&0x7F); mapper->progChange(mappedoutput[ch]-1,ch,p); } else { + chstatus[ch][0]=b;//!!FIXME: This is not correct... fluid_synth_bank_select(synth,ch,b); fluid_synth_program_change(synth,ch,p); } @@ -519,6 +521,10 @@ fluid_sfont_t* CMidiPlayer::getSFPtr(int sfid) {return synth&&sfid<getSFCount()?fluid_synth_get_sfont(synth,sfid):NULL;} qmpMidiMapperRtMidi* CMidiPlayer::getMidiMapper(){return mapper;} +int CMidiPlayer::getChannelOutput(int ch) +{ + return mappedoutput[ch]; +} void CMidiPlayer::setChannelOutput(int ch,int devid) { int origoutput=mappedoutput[ch]; @@ -541,7 +547,7 @@ void CMidiPlayer::setChannelOutput(int ch,int devid) { --deviceusage[origoutput-1];mapper->panic(origoutput-1,ch); if(!deviceusage[origoutput-1])mapper->deviceDeinit(origoutput-1); - }else fluid_synth_all_notes_off(synth,ch); + }else if(synth)fluid_synth_all_notes_off(synth,ch); } uint8_t* CMidiPlayer::getChstates(){return chstate;} int CMidiPlayer::setEventHandlerCB(IMidiCallBack *cb,void *userdata) diff --git a/core/qmpmidiplay.hpp b/core/qmpmidiplay.hpp index 6436192..f7b81af 100644 --- a/core/qmpmidiplay.hpp +++ b/core/qmpmidiplay.hpp @@ -157,6 +157,7 @@ class CMidiPlayer fluid_sfont_t* getSFPtr(int sfid); qmpMidiMapperRtMidi* getMidiMapper(); + int getChannelOutput(int ch); void setChannelOutput(int ch,int devid); uint8_t* getChstates(); int setEventHandlerCB(IMidiCallBack *cb,void *userdata); diff --git a/qmidiplayer-desktop/qmppresetselect.cpp b/qmidiplayer-desktop/qmppresetselect.cpp index 4c9148c..c5132b3 100644 --- a/qmidiplayer-desktop/qmppresetselect.cpp +++ b/qmidiplayer-desktop/qmppresetselect.cpp @@ -49,22 +49,38 @@ void qmpPresetSelector::setupWindow(int chid) sprintf(name,"Preset Selection - Channel #%d",ch+1); setWindowTitle(name); plyr->getChannelPreset(chid,&b,&p,name); - for(int i=0;i<ui->lwBankSelect->count();++i) - { - sscanf(ui->lwBankSelect->item(i)->text().toStdString().c_str(),"%3d",&r); - if(r==b){ui->lwBankSelect->setCurrentRow(i);break;} + if(plyr->getChannelOutput(chid)){ + ui->lwPresetSelect->setEnabled(false); + ui->lwBankSelect->setEnabled(false); + ui->spCustomLSB->setEnabled(true); + ui->spCustomMSB->setEnabled(true); + ui->spCustomPC->setEnabled(true); + ui->spCustomMSB->setValue(plyr->getCC(chid,0)); + ui->spCustomLSB->setValue(plyr->getCC(chid,32)); + ui->spCustomPC->setValue(p); } - r=0; - ui->lwPresetSelect->clear(); - for(int i=0,cr=0;i<128;++i) - if(strlen(presets[b][i])) - { - sprintf(name,"%03d %s",i,presets[b][i]); - if(i==p)r=cr; - ui->lwPresetSelect->addItem(name); - cr++; + else{ + ui->lwPresetSelect->setEnabled(true); + ui->lwBankSelect->setEnabled(true); + ui->spCustomLSB->setEnabled(false); + ui->spCustomMSB->setEnabled(false); + ui->spCustomPC->setEnabled(false); + for(int i=0;i<ui->lwBankSelect->count();++i){ + sscanf(ui->lwBankSelect->item(i)->text().toStdString().c_str(),"%3d",&r); + 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])) + { + sprintf(name,"%03d %s",i,presets[b][i]); + if(i==p)r=cr; + ui->lwPresetSelect->addItem(name); + cr++; + } + ui->lwPresetSelect->setCurrentRow(r); } - ui->lwPresetSelect->setCurrentRow(r); } void qmpPresetSelector::on_pbCancel_clicked() @@ -75,10 +91,17 @@ void qmpPresetSelector::on_pbCancel_clicked() void qmpPresetSelector::on_pbOk_clicked() { CMidiPlayer *plyr=qmpMainWindow::getInstance()->getPlayer(); - if(!ui->lwBankSelect->currentItem()||!ui->lwPresetSelect->currentItem())return (void)close(); - int b,p;sscanf(ui->lwBankSelect->currentItem()->text().toStdString().c_str(),"%d",&b); - sscanf(ui->lwPresetSelect->currentItem()->text().toStdString().c_str(),"%d",&p); - plyr->setChannelPreset(ch,b,p); + if(plyr->getChannelOutput(ch)){ + plyr->setChannelPreset(ch,(ui->spCustomMSB->value()<<7)|ui->spCustomLSB->value(),ui->spCustomPC->value()); + //plyr->setCC(ch,0,ui->spCustomMSB->value()); + //plyr->setCC(ch,32,ui->spCustomLSB->value()); + } + else{ + if(!ui->lwBankSelect->currentItem()||!ui->lwPresetSelect->currentItem())return (void)close(); + int b,p;sscanf(ui->lwBankSelect->currentItem()->text().toStdString().c_str(),"%d",&b); + sscanf(ui->lwPresetSelect->currentItem()->text().toStdString().c_str(),"%d",&p); + plyr->setChannelPreset(ch,b,p); + } close(); } @@ -100,3 +123,13 @@ void qmpPresetSelector::on_lwBankSelect_currentRowChanged() ui->lwPresetSelect->addItem(name); } } + +void qmpPresetSelector::on_buttonBox_accepted() +{ + on_pbOk_clicked(); +} + +void qmpPresetSelector::on_buttonBox_rejected() +{ + on_pbCancel_clicked(); +} diff --git a/qmidiplayer-desktop/qmppresetselect.hpp b/qmidiplayer-desktop/qmppresetselect.hpp index 54f5764..0186578 100644 --- a/qmidiplayer-desktop/qmppresetselect.hpp +++ b/qmidiplayer-desktop/qmppresetselect.hpp @@ -19,17 +19,20 @@ class qmpPresetSelector:public QDialog void setupWindow(int chid); private slots: - void on_pbCancel_clicked(); - - void on_pbOk_clicked(); void on_lwBankSelect_currentRowChanged(); void on_lwPresetSelect_itemDoubleClicked(); + void on_buttonBox_accepted(); + + void on_buttonBox_rejected(); + private: Ui::qmpPresetSelector *ui; char presets[129][128][24]; + void on_pbCancel_clicked(); + void on_pbOk_clicked(); int ch; }; diff --git a/qmidiplayer-desktop/qmppresetselect.ui b/qmidiplayer-desktop/qmppresetselect.ui index 7b82fec..a52b97b 100644 --- a/qmidiplayer-desktop/qmppresetselect.ui +++ b/qmidiplayer-desktop/qmppresetselect.ui @@ -72,6 +72,52 @@ </layout> </item> <item> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <item> + <widget class="QLabel" name="lbCustomMSB"> + <property name="text"> + <string>Bank MSB</string> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="spCustomMSB"> + <property name="maximum"> + <number>127</number> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="lbCustomLSB"> + <property name="text"> + <string>Bank LSB</string> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="spCustomLSB"> + <property name="maximum"> + <number>127</number> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="lbCustomPC"> + <property name="text"> + <string>Patch</string> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="spCustomPC"> + <property name="maximum"> + <number>127</number> + </property> + </widget> + </item> + </layout> + </item> + <item> <layout class="QHBoxLayout" name="horizontalLayout"> <item> <spacer name="horizontalSpacer"> @@ -87,28 +133,9 @@ </spacer> </item> <item> - <widget class="QPushButton" name="pbCancel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Cancel</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="pbOk"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>OK</string> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> </property> </widget> </item> diff --git a/visualization/visualization.pro b/visualization/visualization.pro index f8e4851..65f1a48 100644 --- a/visualization/visualization.pro +++ b/visualization/visualization.pro @@ -34,7 +34,7 @@ unix { res.files += ../img/chequerboard.png ../img/particle.png ../img/kb_128.png } #well... -INCLUDEPATH += /home/chrisoft/devel/BulletLabRemixIII/include/ /usr/include/freetype2 -LIBS += -L/home/chrisoft/devel/BulletLabRemixIII/smelt/glfw/ -LIBS += -L/home/chrisoft/devel/BulletLabRemixIII/extensions/ +INCLUDEPATH += /home/chrisoft/devel/SMELT/include/ /usr/include/freetype2 +LIBS += -L/home/chrisoft/devel/SMELT/smelt/glfw/ +LIBS += -L/home/chrisoft/devel/SMELT/extensions/ LIBS += -lstdc++ -lfreetype -lz -lsmeltext -lsmelt-dumb -lCxImage -ljpeg -lpng -lglfw -lGLEW -lGL |