summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2015-12-29 23:54:24 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2015-12-29 23:54:24 +0800
commit8dc90ae27c24aec1851215f2cc28ee24eff01ea5 (patch)
tree13a604bf55804960ced6ec7559f626962a1265bd
parent40ea6580aaf3d19aa77f43551185a55013d216d9 (diff)
downloadQMidiPlayer-8dc90ae27c24aec1851215f2cc28ee24eff01ea5.tar.xz
Master Spark. (WTF)
-rw-r--r--ChangeLog4
-rw-r--r--qmidiplayer.pro12
-rw-r--r--qmpchanneleditor.cpp14
-rw-r--r--qmpchanneleditor.hpp22
-rw-r--r--qmpchanneleditor.ui579
-rw-r--r--qmpchannelswindow.cpp12
-rw-r--r--qmpchannelswindow.hpp22
-rw-r--r--qmpmidiplay.cpp10
-rw-r--r--qmpmidiplay.hpp6
-rw-r--r--qmppresetselect.cpp93
-rw-r--r--qmppresetselect.hpp36
-rw-r--r--qmppresetselect.ui106
12 files changed, 909 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index a4ea71e..79dc9fd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,10 @@
2015-12-28 primitive version
+Implemented the channel preset chooser.
+
+2015-12-28 primitive version
Partially implemented the channel window.
Fixed a seeking bug.
+Minor cleanups.
2015-12-27 primitive version
Implemented the play list.
diff --git a/qmidiplayer.pro b/qmidiplayer.pro
index 12745ee..c89da2c 100644
--- a/qmidiplayer.pro
+++ b/qmidiplayer.pro
@@ -17,16 +17,22 @@ SOURCES += main.cpp\
qmpmidiplay.cpp \
qmpmidiread.cpp \
qmpplistwindow.cpp \
- qmpchannelswindow.cpp
+ qmpchannelswindow.cpp \
+ qmppresetselect.cpp \
+ qmpchanneleditor.cpp
HEADERS += qmpmainwindow.hpp \
qmpmidiplay.hpp \
qmpplistwindow.hpp \
- qmpchannelswindow.hpp
+ qmpchannelswindow.hpp \
+ qmppresetselect.hpp \
+ qmpchanneleditor.hpp
FORMS += qmpmainwindow.ui \
qmpplistwindow.ui \
- qmpchannelswindow.ui
+ qmpchannelswindow.ui \
+ qmppresetselect.ui \
+ qmpchanneleditor.ui
QMAKE_CXXFLAGS += -std=c++11 -Wall
LIBS += -lfluidsynth
diff --git a/qmpchanneleditor.cpp b/qmpchanneleditor.cpp
new file mode 100644
index 0000000..287d3f1
--- /dev/null
+++ b/qmpchanneleditor.cpp
@@ -0,0 +1,14 @@
+#include "qmpchanneleditor.hpp"
+#include "ui_qmpchanneleditor.h"
+
+qmpchanneleditor::qmpchanneleditor(QWidget *parent) :
+ QDialog(parent),
+ ui(new Ui::qmpchanneleditor)
+{
+ ui->setupUi(this);
+}
+
+qmpchanneleditor::~qmpchanneleditor()
+{
+ delete ui;
+}
diff --git a/qmpchanneleditor.hpp b/qmpchanneleditor.hpp
new file mode 100644
index 0000000..cef3b0b
--- /dev/null
+++ b/qmpchanneleditor.hpp
@@ -0,0 +1,22 @@
+#ifndef QMPCHANNELEDITOR_HPP
+#define QMPCHANNELEDITOR_HPP
+
+#include <QDialog>
+
+namespace Ui {
+ class qmpchanneleditor;
+}
+
+class qmpchanneleditor : public QDialog
+{
+ Q_OBJECT
+
+ public:
+ explicit qmpchanneleditor(QWidget *parent = 0);
+ ~qmpchanneleditor();
+
+ private:
+ Ui::qmpchanneleditor *ui;
+};
+
+#endif // QMPCHANNELEDITOR_HPP
diff --git a/qmpchanneleditor.ui b/qmpchanneleditor.ui
new file mode 100644
index 0000000..c482811
--- /dev/null
+++ b/qmpchanneleditor.ui
@@ -0,0 +1,579 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>qmpchanneleditor</class>
+ <widget class="QDialog" name="qmpchanneleditor">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>422</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>422</width>
+ <height>300</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>422</width>
+ <height>300</height>
+ </size>
+ </property>
+ <property name="windowTitle">
+ <string>Dialog</string>
+ </property>
+ <widget class="QPushButton" name="pbChLeft">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>10</y>
+ <width>21</width>
+ <height>21</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>&lt;</string>
+ </property>
+ </widget>
+ <widget class="QLabel" name="lbChannelNumber">
+ <property name="geometry">
+ <rect>
+ <x>30</x>
+ <y>10</y>
+ <width>21</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="pbChRight">
+ <property name="geometry">
+ <rect>
+ <x>50</x>
+ <y>10</y>
+ <width>21</width>
+ <height>21</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>&gt;</string>
+ </property>
+ </widget>
+ <widget class="QLabel" name="lbPresetName">
+ <property name="geometry">
+ <rect>
+ <x>90</x>
+ <y>10</y>
+ <width>261</width>
+ <height>51</height>
+ </rect>
+ </property>
+ <property name="font">
+ <font>
+ <pointsize>16</pointsize>
+ </font>
+ </property>
+ <property name="text">
+ <string>Yamaha Grand Piano</string>
+ </property>
+ </widget>
+ <widget class="QDial" name="dVol">
+ <property name="geometry">
+ <rect>
+ <x>290</x>
+ <y>80</y>
+ <width>50</width>
+ <height>51</height>
+ </rect>
+ </property>
+ <property name="maximum">
+ <number>127</number>
+ </property>
+ <property name="value">
+ <number>127</number>
+ </property>
+ </widget>
+ <widget class="QLabel" name="lbBank">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>30</y>
+ <width>81</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Bank: 0</string>
+ </property>
+ </widget>
+ <widget class="QLabel" name="lbPreset">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>50</y>
+ <width>81</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>PC: 0</string>
+ </property>
+ </widget>
+ <widget class="QLabel" name="lbVol">
+ <property name="geometry">
+ <rect>
+ <x>280</x>
+ <y>130</y>
+ <width>66</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Vol. 127</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ <widget class="QDial" name="dPan">
+ <property name="geometry">
+ <rect>
+ <x>360</x>
+ <y>80</y>
+ <width>50</width>
+ <height>51</height>
+ </rect>
+ </property>
+ <property name="maximum">
+ <number>127</number>
+ </property>
+ <property name="value">
+ <number>64</number>
+ </property>
+ </widget>
+ <widget class="QLabel" name="lbPan">
+ <property name="geometry">
+ <rect>
+ <x>350</x>
+ <y>130</y>
+ <width>66</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Pan. C</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ <widget class="QGroupBox" name="gFilters">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>70</y>
+ <width>141</width>
+ <height>101</height>
+ </rect>
+ </property>
+ <property name="title">
+ <string>Filters</string>
+ </property>
+ <widget class="QLabel" name="lbReso">
+ <property name="geometry">
+ <rect>
+ <x>70</x>
+ <y>80</y>
+ <width>66</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Res. 64</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ <widget class="QDial" name="dReso">
+ <property name="geometry">
+ <rect>
+ <x>80</x>
+ <y>30</y>
+ <width>50</width>
+ <height>51</height>
+ </rect>
+ </property>
+ <property name="maximum">
+ <number>127</number>
+ </property>
+ <property name="value">
+ <number>64</number>
+ </property>
+ </widget>
+ <widget class="QDial" name="dCut">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>30</y>
+ <width>50</width>
+ <height>51</height>
+ </rect>
+ </property>
+ <property name="maximum">
+ <number>127</number>
+ </property>
+ <property name="value">
+ <number>64</number>
+ </property>
+ </widget>
+ <widget class="QLabel" name="lbCut">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>80</y>
+ <width>71</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Cut. 64</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </widget>
+ <widget class="QGroupBox" name="gEffects">
+ <property name="geometry">
+ <rect>
+ <x>140</x>
+ <y>70</y>
+ <width>141</width>
+ <height>101</height>
+ </rect>
+ </property>
+ <property name="title">
+ <string>Effects</string>
+ </property>
+ <widget class="QLabel" name="lbChorus">
+ <property name="geometry">
+ <rect>
+ <x>70</x>
+ <y>80</y>
+ <width>66</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Chr. 64</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ <widget class="QDial" name="dChorus">
+ <property name="geometry">
+ <rect>
+ <x>80</x>
+ <y>30</y>
+ <width>50</width>
+ <height>51</height>
+ </rect>
+ </property>
+ <property name="maximum">
+ <number>127</number>
+ </property>
+ <property name="value">
+ <number>64</number>
+ </property>
+ </widget>
+ <widget class="QDial" name="dReverb">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>30</y>
+ <width>50</width>
+ <height>51</height>
+ </rect>
+ </property>
+ <property name="maximum">
+ <number>127</number>
+ </property>
+ <property name="value">
+ <number>64</number>
+ </property>
+ </widget>
+ <widget class="QLabel" name="lbReverb">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>80</y>
+ <width>71</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Rev. 64</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </widget>
+ <widget class="QGroupBox" name="gEnvelope">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>170</y>
+ <width>211</width>
+ <height>101</height>
+ </rect>
+ </property>
+ <property name="title">
+ <string>Envelope</string>
+ </property>
+ <widget class="QLabel" name="lbDecay">
+ <property name="geometry">
+ <rect>
+ <x>70</x>
+ <y>80</y>
+ <width>66</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Dec. 64</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ <widget class="QDial" name="dDecay">
+ <property name="geometry">
+ <rect>
+ <x>80</x>
+ <y>30</y>
+ <width>50</width>
+ <height>51</height>
+ </rect>
+ </property>
+ <property name="maximum">
+ <number>127</number>
+ </property>
+ <property name="value">
+ <number>64</number>
+ </property>
+ </widget>
+ <widget class="QDial" name="dAttack">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>30</y>
+ <width>50</width>
+ <height>51</height>
+ </rect>
+ </property>
+ <property name="maximum">
+ <number>127</number>
+ </property>
+ <property name="value">
+ <number>64</number>
+ </property>
+ </widget>
+ <widget class="QLabel" name="lbAttack">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>80</y>
+ <width>71</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Atk. 64</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ <widget class="QDial" name="dRelease">
+ <property name="geometry">
+ <rect>
+ <x>150</x>
+ <y>30</y>
+ <width>50</width>
+ <height>51</height>
+ </rect>
+ </property>
+ <property name="maximum">
+ <number>127</number>
+ </property>
+ <property name="value">
+ <number>64</number>
+ </property>
+ </widget>
+ <widget class="QLabel" name="lbRelease">
+ <property name="geometry">
+ <rect>
+ <x>140</x>
+ <y>80</y>
+ <width>66</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Rel. 64</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </widget>
+ <widget class="QGroupBox" name="gVibrato">
+ <property name="geometry">
+ <rect>
+ <x>210</x>
+ <y>170</y>
+ <width>211</width>
+ <height>101</height>
+ </rect>
+ </property>
+ <property name="title">
+ <string>Vibrato</string>
+ </property>
+ <widget class="QLabel" name="lbDepth">
+ <property name="geometry">
+ <rect>
+ <x>70</x>
+ <y>80</y>
+ <width>66</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Dep. 64</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ <widget class="QDial" name="dDepth">
+ <property name="geometry">
+ <rect>
+ <x>80</x>
+ <y>30</y>
+ <width>50</width>
+ <height>51</height>
+ </rect>
+ </property>
+ <property name="maximum">
+ <number>127</number>
+ </property>
+ <property name="value">
+ <number>64</number>
+ </property>
+ </widget>
+ <widget class="QDial" name="dRate">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>30</y>
+ <width>50</width>
+ <height>51</height>
+ </rect>
+ </property>
+ <property name="maximum">
+ <number>127</number>
+ </property>
+ <property name="value">
+ <number>64</number>
+ </property>
+ </widget>
+ <widget class="QLabel" name="lbRate">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>80</y>
+ <width>71</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Rate 64</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ <widget class="QDial" name="dDelay">
+ <property name="geometry">
+ <rect>
+ <x>150</x>
+ <y>30</y>
+ <width>50</width>
+ <height>51</height>
+ </rect>
+ </property>
+ <property name="maximum">
+ <number>127</number>
+ </property>
+ <property name="value">
+ <number>64</number>
+ </property>
+ </widget>
+ <widget class="QLabel" name="lbDelay">
+ <property name="geometry">
+ <rect>
+ <x>140</x>
+ <y>80</y>
+ <width>66</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Del. 64</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </widget>
+ <widget class="QPushButton" name="pushButton">
+ <property name="geometry">
+ <rect>
+ <x>350</x>
+ <y>0</y>
+ <width>71</width>
+ <height>31</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>OK</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="pushButton_2">
+ <property name="geometry">
+ <rect>
+ <x>350</x>
+ <y>40</y>
+ <width>71</width>
+ <height>31</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/qmpchannelswindow.cpp b/qmpchannelswindow.cpp
index 6aca878..635918e 100644
--- a/qmpchannelswindow.cpp
+++ b/qmpchannelswindow.cpp
@@ -1,7 +1,6 @@
#include <QCheckBox>
#include <QPushButton>
#include <QComboBox>
-#include <QLabel>
#include "qmpchannelswindow.hpp"
#include "ui_qmpchannelswindow.h"
#include "qmpmainwindow.hpp"
@@ -11,6 +10,7 @@ qmpchannelswindow::qmpchannelswindow(QWidget *parent) :
ui(new Ui::qmpchannelswindow)
{
ui->setupUi(this);
+ pselectw=new qmppresetselect(this);
connect(this,SIGNAL(dialogClosing()),parent,SLOT(dialogClosed()));
for(int i=0;i<16;++i)
{
@@ -22,7 +22,9 @@ qmpchannelswindow::qmpchannelswindow(QWidget *parent) :
QComboBox *cb=(QComboBox*)ui->twChannels->cellWidget(i,2);
//stub
cb->addItem("Internal fluidsynth");
- ui->twChannels->setCellWidget(i,3,new QLabel(""));
+ 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)));
ui->twChannels->setCellWidget(i,4,new QPushButton("..."));
}
ui->twChannels->setColumnWidth(0,32);
@@ -86,3 +88,9 @@ void qmpchannelswindow::on_pbUnsolo_clicked()
((qmpMainWindow*)this->parent())->getPlayer()->setSolo(i,false);
}
}
+
+void qmpchannelswindow::showPresetWindow(int chid)
+{
+ pselectw->show();
+ pselectw->setupWindow(chid);
+}
diff --git a/qmpchannelswindow.hpp b/qmpchannelswindow.hpp
index 4bf3ad2..a594a5a 100644
--- a/qmpchannelswindow.hpp
+++ b/qmpchannelswindow.hpp
@@ -1,14 +1,30 @@
#ifndef QMPCHANNELSWINDOW_H
#define QMPCHANNELSWINDOW_H
+#include <QLabel>
#include <QDialog>
#include <QCloseEvent>
+#include "qmppresetselect.hpp"
namespace Ui {
class qmpchannelswindow;
}
-class qmpchannelswindow : public QDialog
+class QDCLabel:public QLabel
+{
+ Q_OBJECT
+ using QLabel::QLabel;
+ private:
+ int id;
+ protected:
+ void mouseDoubleClickEvent(QMouseEvent *event){event->accept();emit onDoubleClick(id);}
+ public:
+ void setID(int _id){id=_id;}
+ signals:
+ void onDoubleClick(int id);
+};
+
+class qmpchannelswindow:public QDialog
{
Q_OBJECT
@@ -21,13 +37,15 @@ class qmpchannelswindow : public QDialog
public slots:
void channelWindowsUpdate();
void channelMSChanged();
+ void showPresetWindow(int chid);
private slots:
void on_pbUnmute_clicked();
void on_pbUnsolo_clicked();
- private:
+ private:
Ui::qmpchannelswindow *ui;
+ qmppresetselect *pselectw;
};
#endif // QMPCHANNELSWINDOW_H
diff --git a/qmpmidiplay.cpp b/qmpmidiplay.cpp
index b676c99..112b8e9 100644
--- a/qmpmidiplay.cpp
+++ b/qmpmidiplay.cpp
@@ -220,6 +220,12 @@ void CMidiPlayer::getChannelPreset(int ch,int *b,int *p,char *name)
*b=info.bank;*p=info.program;
strcpy(name,info.name);
}
+void CMidiPlayer::setChannelPreset(int ch,int b,int p)
+{
+ if(!synth)return;
+ fluid_synth_bank_select(synth,ch,b);
+ fluid_synth_program_change(synth,ch,p);
+}
//16MSB..LSB1
void CMidiPlayer::setBit(uint16_t &n, uint16_t bn, uint16_t b)
{n^=(-b^n)&(1<<bn);}
@@ -231,3 +237,7 @@ void CMidiPlayer::setSolo(int ch,bool s)
{
setBit(solo,ch,s?1:0);
}
+int CMidiPlayer::getSFCount()
+{return synth?fluid_synth_sfcount(synth):0;}
+fluid_sfont_t* CMidiPlayer::getSFPtr(int sfid)
+{return synth&&sfid<getSFCount()?fluid_synth_get_sfont(synth,sfid):NULL;}
diff --git a/qmpmidiplay.hpp b/qmpmidiplay.hpp
index d5f0c54..2f279b7 100644
--- a/qmpmidiplay.hpp
+++ b/qmpmidiplay.hpp
@@ -75,6 +75,7 @@ class CMidiPlayer
void playerThread();
void playerPanic();
+ //playing control methods
uint32_t getStamp(int id);
uint32_t getTCeptr();
void setTCeptr(uint32_t ep,uint32_t st);
@@ -89,8 +90,13 @@ class CMidiPlayer
int getMaxPolyphone();
void setMaxPolyphone(int p);
+ void setChannelPreset(int ch,int b,int p);
void getChannelPreset(int ch,int *b,int *p,char *name);
void setMute(int ch,bool m);
void setSolo(int ch,bool s);
+
+ //void pushSoundFont(const char* url);
+ int getSFCount();
+ fluid_sfont_t* getSFPtr(int sfid);
};
#endif
diff --git a/qmppresetselect.cpp b/qmppresetselect.cpp
new file mode 100644
index 0000000..f96c99e
--- /dev/null
+++ b/qmppresetselect.cpp
@@ -0,0 +1,93 @@
+#include <cstdio>
+#include "qmppresetselect.hpp"
+#include "ui_qmppresetselect.h"
+#include "qmpmainwindow.hpp"
+
+qmppresetselect::qmppresetselect(QWidget *parent) :
+ QDialog(parent),
+ ui(new Ui::qmppresetselect)
+{
+ ui->setupUi(this);
+}
+
+qmppresetselect::~qmppresetselect()
+{
+ delete ui;
+}
+
+void qmppresetselect::showEvent(QShowEvent *e)
+{
+ e->accept();memset(presets,0,sizeof(presets));
+ CMidiPlayer *plyr=((qmpMainWindow*)(this->parent()->parent()))->getPlayer();
+ int sfc=plyr->getSFCount();
+ for(int i=0;i<sfc;++i)
+ {
+ fluid_sfont_t* psf=plyr->getSFPtr(i);
+ fluid_preset_t preset;
+ psf->iteration_start(psf);
+ while(psf->iteration_next(psf,&preset))
+ strcpy(presets[preset.get_banknum(&preset)][preset.get_num(&preset)],preset.get_name(&preset));
+ }
+ ui->lwBankSelect->clear();
+ ui->lwPresetSelect->clear();
+ for(int i=0;i<=128;++i)
+ {
+ int b=0;
+ for(int j=0;j<128;++j)if(strlen(presets[i][j])){b=1;break;}
+ if(b)ui->lwBankSelect->addItem(QString::number(i));
+ }
+}
+void qmppresetselect::setupWindow(int chid)
+{
+ CMidiPlayer *plyr=((qmpMainWindow*)(this->parent()->parent()))->getPlayer();
+ ch=chid;int b,p,r;char name[30];
+ plyr->getChannelPreset(chid,&b,&p,name);
+ for(int i=0;i<ui->lwBankSelect->count();++i)
+ {
+ sscanf(ui->lwBankSelect->item(i)->text().toStdString().c_str(),"%d",&r);
+ if(r==b){ui->lwBankSelect->setCurrentRow(i);break;}
+ }
+ r=0;
+ for(int i=0,cr=0;i<128;++i)
+ if(strlen(presets[b][i]))
+ {
+ sprintf(name,"%d %s",i,presets[b][i]);
+ if(i==p)r=cr;
+ ui->lwPresetSelect->addItem(name);
+ cr++;
+ }
+ ui->lwPresetSelect->setCurrentRow(r);
+}
+
+void qmppresetselect::on_pbCancel_clicked()
+{
+ close();
+}
+
+void qmppresetselect::on_pbOk_clicked()
+{
+ CMidiPlayer *plyr=((qmpMainWindow*)(this->parent()->parent()))->getPlayer();
+ 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();
+}
+
+void qmppresetselect::on_lwPresetSelect_itemDoubleClicked()
+{
+ on_pbOk_clicked();
+}
+
+void qmppresetselect::on_lwBankSelect_currentRowChanged()
+{
+ ui->lwPresetSelect->clear();
+ if(!ui->lwBankSelect->currentItem())return;
+ char name[30];int b;
+ sscanf(ui->lwBankSelect->currentItem()->text().toStdString().c_str(),"%d",&b);
+ for(int i=0;i<128;++i)
+ if(strlen(presets[b][i]))
+ {
+ sprintf(name,"%d %s",i,presets[b][i]);
+ ui->lwPresetSelect->addItem(name);
+ }
+}
diff --git a/qmppresetselect.hpp b/qmppresetselect.hpp
new file mode 100644
index 0000000..51d0f21
--- /dev/null
+++ b/qmppresetselect.hpp
@@ -0,0 +1,36 @@
+#ifndef QMPPRESETSELECT_H
+#define QMPPRESETSELECT_H
+
+#include <QDialog>
+#include <QShowEvent>
+
+namespace Ui {
+ class qmppresetselect;
+}
+
+class qmppresetselect:public QDialog
+{
+ Q_OBJECT
+
+ public:
+ explicit qmppresetselect(QWidget *parent = 0);
+ ~qmppresetselect();
+ void showEvent(QShowEvent* e);
+ void setupWindow(int chid);
+
+ private slots:
+ void on_pbCancel_clicked();
+
+ void on_pbOk_clicked();
+
+ void on_lwBankSelect_currentRowChanged();
+
+ void on_lwPresetSelect_itemDoubleClicked();
+
+ private:
+ Ui::qmppresetselect *ui;
+ char presets[129][128][24];
+ int ch;
+};
+
+#endif // QMPPRESETSELECT_H
diff --git a/qmppresetselect.ui b/qmppresetselect.ui
new file mode 100644
index 0000000..65a03f4
--- /dev/null
+++ b/qmppresetselect.ui
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>qmppresetselect</class>
+ <widget class="QDialog" name="qmppresetselect">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>404</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>404</width>
+ <height>300</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>404</width>
+ <height>300</height>
+ </size>
+ </property>
+ <property name="windowTitle">
+ <string>Preset Selection</string>
+ </property>
+ <property name="modal">
+ <bool>true</bool>
+ </property>
+ <widget class="QListWidget" name="lwBankSelect">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>30</y>
+ <width>71</width>
+ <height>221</height>
+ </rect>
+ </property>
+ </widget>
+ <widget class="QListWidget" name="lwPresetSelect">
+ <property name="geometry">
+ <rect>
+ <x>90</x>
+ <y>30</y>
+ <width>301</width>
+ <height>221</height>
+ </rect>
+ </property>
+ </widget>
+ <widget class="QLabel" name="lbBnk">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>10</y>
+ <width>66</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Bank</string>
+ </property>
+ </widget>
+ <widget class="QLabel" name="lbPst">
+ <property name="geometry">
+ <rect>
+ <x>90</x>
+ <y>10</y>
+ <width>66</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Preset</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="pbOk">
+ <property name="geometry">
+ <rect>
+ <x>300</x>
+ <y>260</y>
+ <width>97</width>
+ <height>36</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>OK</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="pbCancel">
+ <property name="geometry">
+ <rect>
+ <x>190</x>
+ <y>260</y>
+ <width>97</width>
+ <height>36</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>