aboutsummaryrefslogtreecommitdiff
path: root/qmidiplayer-desktop
diff options
context:
space:
mode:
Diffstat (limited to 'qmidiplayer-desktop')
-rw-r--r--qmidiplayer-desktop/qmppresetselect.cpp69
-rw-r--r--qmidiplayer-desktop/qmppresetselect.hpp9
-rw-r--r--qmidiplayer-desktop/qmppresetselect.ui71
3 files changed, 106 insertions, 43 deletions
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>