summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--README.md4
-rw-r--r--qmpchanneleditor.cpp186
-rw-r--r--qmpchanneleditor.hpp63
-rw-r--r--qmpchanneleditor.ui157
-rw-r--r--qmpchannelswindow.cpp21
-rw-r--r--qmpchannelswindow.hpp18
-rw-r--r--qmpmainwindow.cpp4
-rw-r--r--qmpmainwindow.hpp14
-rw-r--r--qmpmidiplay.cpp12
-rw-r--r--qmpmidiplay.hpp2
-rw-r--r--qmppresetselect.cpp8
12 files changed, 374 insertions, 120 deletions
diff --git a/ChangeLog b/ChangeLog
index 79dc9fd..4f8cfe6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,7 @@
-2015-12-28 primitive version
+2015-12-30 primitive version
+Implemented the channel parameter editor.
+
+2015-12-29 primitive version
Implemented the channel preset chooser.
2015-12-28 primitive version
diff --git a/README.md b/README.md
index 50eb3cd..0c06f83 100644
--- a/README.md
+++ b/README.md
@@ -4,8 +4,8 @@ A cross-platform midi file player based on libfluidsynth and Qt.
Currently it's still very incomplete and not suitable for everyday use.
Planned features:
-* Channel mute/solo (not implemented)
-* Editing channel parameters on-the-fly (not implemented)
+* Channel mute/solo
+* Editing channel parameters on-the-fly (partially implemented)
* Playlists (partially implemented)
* Editing synthesizer effects (not implemented)
* Visualization (not implemented)
diff --git a/qmpchanneleditor.cpp b/qmpchanneleditor.cpp
index 287d3f1..667d553 100644
--- a/qmpchanneleditor.cpp
+++ b/qmpchanneleditor.cpp
@@ -1,5 +1,7 @@
+#include <cstdio>
#include "qmpchanneleditor.hpp"
#include "ui_qmpchanneleditor.h"
+#include "qmpmainwindow.hpp"
qmpchanneleditor::qmpchanneleditor(QWidget *parent) :
QDialog(parent),
@@ -12,3 +14,187 @@ qmpchanneleditor::~qmpchanneleditor()
{
delete ui;
}
+
+void qmpchanneleditor::setupWindow(int chid)
+{
+ char str[30];if(~chid)ch=chid;
+ sprintf(str,"Channel Parameter Editor - Channel #%d",ch+1);
+ setWindowTitle(str);
+ CMidiPlayer* player=qmpMainWindow::getInstance()->getPlayer();
+ int b,p;
+ player->getChannelPreset(ch,&b,&p,str);
+ ui->lbPresetName->setText(str);
+ sprintf(str,"BK: %d",b);ui->lbBank->setText(str);
+ sprintf(str,"PC: %d",p);ui->lbPreset->setText(str);
+ ui->lbChannelNumber->setText(QString::number(ch+1));
+#define setupControl(ccid,lb,d,ccname)\
+ b=player->getCC(ch,ccid);\
+ sprintf(str,"%s %d",ccname,b);\
+ ui->lb->setText(str);\
+ ui->d->setValue(b);
+ setupControl(7,lbVol,dVol,"Vol.");
+ setupControl(91,lbReverb,dReverb,"Rev.");
+ setupControl(93,lbChorus,dChorus,"Chr.");
+ setupControl(71,lbReso,dReso,"Res.");
+ setupControl(74,lbCut,dCut,"Cut.");
+ setupControl(73,lbAttack,dAttack,"Atk.");
+ setupControl(75,lbDecay,dDecay,"Dec.");
+ setupControl(72,lbRelease,dRelease,"Rel.");
+ setupControl(76,lbRate,dRate,"Rate");
+ setupControl(77,lbDepth,dDepth,"Dep.");
+ setupControl(78,lbDelay,dDelay,"Del.");
+ b=player->getCC(ch,10);
+ if(b==64)strcpy(str,"Pan. C");
+ else if(b<64)sprintf(str,"Pan. L%d",64-b);else sprintf(str,"Pan. R%d",b-64);
+ ui->lbPan->setText(str);
+ ui->dPan->setValue(b);
+}
+
+void qmpchanneleditor::sendCC()
+{
+ CMidiPlayer* player=qmpMainWindow::getInstance()->getPlayer();
+ player->setCC(ch,7,ui->dVol->value());
+ player->setCC(ch,10,ui->dPan->value());
+ player->setCC(ch,91,ui->dReverb->value());
+ player->setCC(ch,93,ui->dChorus->value());
+ player->setCC(ch,71,ui->dReso->value());
+ player->setCC(ch,74,ui->dCut->value());
+ player->setCC(ch,73,ui->dAttack->value());
+ player->setCC(ch,75,ui->dDecay->value());
+ player->setCC(ch,72,ui->dRelease->value());
+ player->setCC(ch,76,ui->dRate->value());
+ player->setCC(ch,77,ui->dDepth->value());
+ player->setCC(ch,78,ui->dDelay->value());
+}
+
+void qmpchanneleditor::showEvent(QShowEvent *e)
+{
+ e->accept();
+ connect(qmpMainWindow::getInstance()->getTimer(),SIGNAL(timeout()),this,SLOT(setupWindow()));
+}
+void qmpchanneleditor::closeEvent(QCloseEvent *e)
+{
+ e->accept();
+ disconnect(qmpMainWindow::getInstance()->getTimer(),SIGNAL(timeout()),this,SLOT(setupWindow()));
+}
+
+void qmpchanneleditor::on_pbChLeft_clicked()
+{
+ if(ch>0)--ch;else ch=15;setupWindow();
+}
+
+void qmpchanneleditor::on_pbChRight_clicked()
+{
+ if(ch<15)++ch;else ch=0;setupWindow();
+}
+
+#define dc disconnect(qmpMainWindow::getInstance()->getTimer(),SIGNAL(timeout()),this,SLOT(setupWindow()))
+#define rc connect(qmpMainWindow::getInstance()->getTimer(),SIGNAL(timeout()),this,SLOT(setupWindow()));sendCC()
+
+void qmpchanneleditor::on_dCut_sliderPressed()
+{dc;}
+
+void qmpchanneleditor::on_dReso_sliderPressed()
+{dc;}
+
+void qmpchanneleditor::on_dReverb_sliderPressed()
+{dc;}
+
+void qmpchanneleditor::on_dChorus_sliderPressed()
+{dc;}
+
+void qmpchanneleditor::on_dVol_sliderPressed()
+{dc;}
+
+void qmpchanneleditor::on_dPan_sliderPressed()
+{dc;}
+
+void qmpchanneleditor::on_dAttack_sliderPressed()
+{dc;}
+
+void qmpchanneleditor::on_dDecay_sliderPressed()
+{dc;}
+
+void qmpchanneleditor::on_dRelease_sliderPressed()
+{dc;}
+
+void qmpchanneleditor::on_dRate_sliderPressed()
+{dc;}
+
+void qmpchanneleditor::on_dDepth_sliderPressed()
+{dc;}
+
+void qmpchanneleditor::on_dDelay_sliderPressed()
+{dc;}
+
+void qmpchanneleditor::on_dAttack_sliderReleased()
+{rc;}
+
+void qmpchanneleditor::on_dDecay_sliderReleased()
+{rc;}
+
+void qmpchanneleditor::on_dRelease_sliderReleased()
+{rc;}
+
+void qmpchanneleditor::on_dRate_sliderReleased()
+{rc;}
+
+void qmpchanneleditor::on_dDepth_sliderReleased()
+{rc;}
+
+void qmpchanneleditor::on_dDelay_sliderReleased()
+{rc;}
+
+void qmpchanneleditor::on_dCut_sliderReleased()
+{rc;}
+
+void qmpchanneleditor::on_dReso_sliderReleased()
+{rc;}
+
+void qmpchanneleditor::on_dReverb_sliderReleased()
+{rc;}
+
+void qmpchanneleditor::on_dChorus_sliderReleased()
+{rc;}
+
+void qmpchanneleditor::on_dVol_sliderReleased()
+{rc;}
+
+void qmpchanneleditor::on_dPan_sliderReleased()
+{rc;}
+
+void qmpchanneleditor::on_dCut_valueChanged()
+{rc;}
+
+void qmpchanneleditor::on_dReso_valueChanged()
+{rc;}
+
+void qmpchanneleditor::on_dReverb_valueChanged()
+{rc;}
+
+void qmpchanneleditor::on_dChorus_valueChanged()
+{rc;}
+
+void qmpchanneleditor::on_dVol_valueChanged()
+{rc;}
+
+void qmpchanneleditor::on_dPan_valueChanged()
+{rc;}
+
+void qmpchanneleditor::on_dAttack_valueChanged()
+{rc;}
+
+void qmpchanneleditor::on_dDecay_valueChanged()
+{rc;}
+
+void qmpchanneleditor::on_dRelease_valueChanged()
+{rc;}
+
+void qmpchanneleditor::on_dRate_valueChanged()
+{rc;}
+
+void qmpchanneleditor::on_dDepth_valueChanged()
+{rc;}
+
+void qmpchanneleditor::on_dDelay_valueChanged()
+{rc;}
diff --git a/qmpchanneleditor.hpp b/qmpchanneleditor.hpp
index cef3b0b..019cfb4 100644
--- a/qmpchanneleditor.hpp
+++ b/qmpchanneleditor.hpp
@@ -1,22 +1,71 @@
-#ifndef QMPCHANNELEDITOR_HPP
-#define QMPCHANNELEDITOR_HPP
+#ifndef QMPCHANNELEDITOR_H
+#define QMPCHANNELEDITOR_H
#include <QDialog>
+#include <QShowEvent>
+#include <QCloseEvent>
namespace Ui {
class qmpchanneleditor;
}
-class qmpchanneleditor : public QDialog
+class qmpchanneleditor:public QDialog
{
Q_OBJECT
public:
- explicit qmpchanneleditor(QWidget *parent = 0);
- ~qmpchanneleditor();
+ explicit qmpchanneleditor(QWidget *parent=0);
+ ~qmpchanneleditor();
+ protected:
+ void showEvent(QShowEvent *e);
+ void closeEvent(QCloseEvent *e);
+ public slots:
+ void setupWindow(int chid=-1);
+
+ private slots:
+ void on_pbChLeft_clicked();
+ void on_pbChRight_clicked();
+ void on_dCut_sliderPressed();
+ void on_dReso_sliderPressed();
+ void on_dReverb_sliderPressed();
+ void on_dChorus_sliderPressed();
+ void on_dVol_sliderPressed();
+ void on_dPan_sliderPressed();
+ void on_dAttack_sliderPressed();
+ void on_dDecay_sliderPressed();
+ void on_dRelease_sliderPressed();
+ void on_dRate_sliderPressed();
+ void on_dDepth_sliderPressed();
+ void on_dDelay_sliderPressed();
+ void on_dAttack_sliderReleased();
+ void on_dDecay_sliderReleased();
+ void on_dRelease_sliderReleased();
+ void on_dRate_sliderReleased();
+ void on_dDepth_sliderReleased();
+ void on_dDelay_sliderReleased();
+ void on_dCut_sliderReleased();
+ void on_dReso_sliderReleased();
+ void on_dReverb_sliderReleased();
+ void on_dChorus_sliderReleased();
+ void on_dVol_sliderReleased();
+ void on_dPan_sliderReleased();
+ void on_dCut_valueChanged();
+ void on_dReso_valueChanged();
+ void on_dReverb_valueChanged();
+ void on_dChorus_valueChanged();
+ void on_dVol_valueChanged();
+ void on_dPan_valueChanged();
+ void on_dAttack_valueChanged();
+ void on_dDecay_valueChanged();
+ void on_dRelease_valueChanged();
+ void on_dRate_valueChanged();
+ void on_dDepth_valueChanged();
+ void on_dDelay_valueChanged();
private:
- Ui::qmpchanneleditor *ui;
+ Ui::qmpchanneleditor *ui;
+ int ch;
+ void sendCC();
};
-#endif // QMPCHANNELEDITOR_HPP
+#endif // QMPCHANNELEDITOR_H
diff --git a/qmpchanneleditor.ui b/qmpchanneleditor.ui
index c482811..b45e7de 100644
--- a/qmpchanneleditor.ui
+++ b/qmpchanneleditor.ui
@@ -85,22 +85,6 @@
<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>
@@ -111,7 +95,7 @@
</rect>
</property>
<property name="text">
- <string>Bank: 0</string>
+ <string>BK: 0</string>
</property>
</widget>
<widget class="QLabel" name="lbPreset">
@@ -127,54 +111,6 @@
<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>
@@ -547,31 +483,82 @@
</property>
</widget>
</widget>
- <widget class="QPushButton" name="pushButton">
+ <widget class="QGroupBox" name="gMixer">
<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>
+ <x>280</x>
+ <y>70</y>
+ <width>141</width>
+ <height>101</height>
</rect>
</property>
- <property name="text">
- <string>Cancel</string>
+ <property name="title">
+ <string>Mixer</string>
</property>
+ <widget class="QLabel" name="lbPan">
+ <property name="geometry">
+ <rect>
+ <x>70</x>
+ <y>80</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="QDial" name="dPan">
+ <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="QLabel" name="lbVol">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>80</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="dVol">
+ <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>127</number>
+ </property>
+ </widget>
</widget>
</widget>
<resources/>
diff --git a/qmpchannelswindow.cpp b/qmpchannelswindow.cpp
index 635918e..ce05468 100644
--- a/qmpchannelswindow.cpp
+++ b/qmpchannelswindow.cpp
@@ -11,6 +11,7 @@ qmpchannelswindow::qmpchannelswindow(QWidget *parent) :
{
ui->setupUi(this);
pselectw=new qmppresetselect(this);
+ ceditw=new qmpchanneleditor(this);
connect(this,SIGNAL(dialogClosing()),parent,SLOT(dialogClosed()));
for(int i=0;i<16;++i)
{
@@ -25,7 +26,9 @@ qmpchannelswindow::qmpchannelswindow(QWidget *parent) :
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->setCellWidget(i,4,new QDCPushButton("..."));
+ ((QDCLabel*)ui->twChannels->cellWidget(i,4))->setID(i);
+ connect(ui->twChannels->cellWidget(i,4),SIGNAL(onClick(int)),this,SLOT(showChannelEditorWindow(int)));
}
ui->twChannels->setColumnWidth(0,32);
ui->twChannels->setColumnWidth(1,32);
@@ -47,7 +50,7 @@ void qmpchannelswindow::channelWindowsUpdate()
{
char data[128],nm[24];
int b,p;
- ((qmpMainWindow*)this->parent())->getPlayer()->getChannelPreset(i,&b,&p,nm);
+ qmpMainWindow::getInstance()->getPlayer()->getChannelPreset(i,&b,&p,nm);
sprintf(data,"%d:%d %s",b,p,nm);
((QLabel*)ui->twChannels->cellWidget(i,3))->setText(data);
}
@@ -61,8 +64,8 @@ void qmpchannelswindow::channelMSChanged()
m=(QCheckBox*)ui->twChannels->cellWidget(i,0);
s=(QCheckBox*)ui->twChannels->cellWidget(i,1);
if(m->isChecked()&&s->isChecked())s->setChecked(false);
- ((qmpMainWindow*)this->parent())->getPlayer()->setMute(i,m->isChecked());
- ((qmpMainWindow*)this->parent())->getPlayer()->setSolo(i,s->isChecked());
+ qmpMainWindow::getInstance()->getPlayer()->setMute(i,m->isChecked());
+ qmpMainWindow::getInstance()->getPlayer()->setSolo(i,s->isChecked());
}
}
@@ -76,7 +79,7 @@ void qmpchannelswindow::on_pbUnmute_clicked()
for(int i=0;i<16;++i)
{
((QCheckBox*)ui->twChannels->cellWidget(i,0))->setChecked(false);
- ((qmpMainWindow*)this->parent())->getPlayer()->setMute(i,false);
+ qmpMainWindow::getInstance()->getPlayer()->setMute(i,false);
}
}
@@ -85,7 +88,7 @@ void qmpchannelswindow::on_pbUnsolo_clicked()
for(int i=0;i<16;++i)
{
((QCheckBox*)ui->twChannels->cellWidget(i,1))->setChecked(false);
- ((qmpMainWindow*)this->parent())->getPlayer()->setSolo(i,false);
+ qmpMainWindow::getInstance()->getPlayer()->setSolo(i,false);
}
}
@@ -94,3 +97,9 @@ void qmpchannelswindow::showPresetWindow(int chid)
pselectw->show();
pselectw->setupWindow(chid);
}
+
+void qmpchannelswindow::showChannelEditorWindow(int chid)
+{
+ ceditw->show();
+ ceditw->setupWindow(chid);
+}
diff --git a/qmpchannelswindow.hpp b/qmpchannelswindow.hpp
index a594a5a..c87a90f 100644
--- a/qmpchannelswindow.hpp
+++ b/qmpchannelswindow.hpp
@@ -2,9 +2,11 @@
#define QMPCHANNELSWINDOW_H
#include <QLabel>
+#include <QPushButton>
#include <QDialog>
#include <QCloseEvent>
#include "qmppresetselect.hpp"
+#include "qmpchanneleditor.hpp"
namespace Ui {
class qmpchannelswindow;
@@ -24,6 +26,20 @@ class QDCLabel:public QLabel
void onDoubleClick(int id);
};
+class QDCPushButton:public QPushButton
+{
+ Q_OBJECT
+ using QPushButton::QPushButton;
+ private:
+ int id;
+ protected:
+ void mousePressEvent(QMouseEvent *event){QPushButton::mousePressEvent(event);emit onClick(id);}
+ public:
+ void setID(int _id){id=_id;}
+ signals:
+ void onClick(int id);
+};
+
class qmpchannelswindow:public QDialog
{
Q_OBJECT
@@ -38,6 +54,7 @@ class qmpchannelswindow:public QDialog
void channelWindowsUpdate();
void channelMSChanged();
void showPresetWindow(int chid);
+ void showChannelEditorWindow(int chid);
private slots:
void on_pbUnmute_clicked();
@@ -46,6 +63,7 @@ class qmpchannelswindow:public QDialog
private:
Ui::qmpchannelswindow *ui;
qmppresetselect *pselectw;
+ qmpchanneleditor *ceditw;
};
#endif // QMPCHANNELSWINDOW_H
diff --git a/qmpmainwindow.cpp b/qmpmainwindow.cpp
index 69cf9df..f79583c 100644
--- a/qmpmainwindow.cpp
+++ b/qmpmainwindow.cpp
@@ -4,6 +4,8 @@
#include "ui_qmpmainwindow.h"
#include "qmpmidiplay.hpp"
+qmpMainWindow* qmpMainWindow::ref=NULL;
+
qmpMainWindow::qmpMainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::qmpMainWindow)
@@ -13,7 +15,7 @@ qmpMainWindow::qmpMainWindow(QWidget *parent) :
plistw=new qmpplistwindow(this);
chnlw=new qmpchannelswindow(this);
ui->lbFileName->setText("");
- timer=new QTimer(this);
+ timer=new QTimer(this);ref=this;
connect(timer,SIGNAL(timeout()),this,SLOT(updateWidgets()));
connect(timer,SIGNAL(timeout()),chnlw,SLOT(channelWindowsUpdate()));
}
diff --git a/qmpmainwindow.hpp b/qmpmainwindow.hpp
index 8d64f37..ae62bb4 100644
--- a/qmpmainwindow.hpp
+++ b/qmpmainwindow.hpp
@@ -14,7 +14,7 @@ namespace Ui {
class qmpMainWindow;
}
-class qmpMainWindow : public QMainWindow
+class qmpMainWindow:public QMainWindow
{
Q_OBJECT
@@ -23,24 +23,18 @@ class qmpMainWindow : public QMainWindow
void closeEvent(QCloseEvent *event);
~qmpMainWindow();
CMidiPlayer* getPlayer(){return player;}
+ QTimer* getTimer(){return timer;}
private slots:
void on_pbPlayPause_clicked();
void updateWidgets();
-
void on_hsTimer_sliderPressed();
-
void on_hsTimer_sliderReleased();
-
void on_vsMasterVol_valueChanged();
-
void on_pbStop_clicked();
-
void on_pbPList_clicked();
void on_pbPrev_clicked();
-
void on_pbNext_clicked();
-
void on_pbChannels_clicked();
public slots:
@@ -58,6 +52,8 @@ class qmpMainWindow : public QMainWindow
qmpplistwindow *plistw;
qmpchannelswindow *chnlw;
+ static qmpMainWindow* ref;
+ public: static qmpMainWindow* getInstance(){return ref;}
};
-#endif // QMPMAINWINDOW_HPP
+#endif // QMPMAINWINDOW_H
diff --git a/qmpmidiplay.cpp b/qmpmidiplay.cpp
index 112b8e9..e9014d0 100644
--- a/qmpmidiplay.cpp
+++ b/qmpmidiplay.cpp
@@ -230,13 +230,13 @@ void CMidiPlayer::setChannelPreset(int ch,int b,int p)
void CMidiPlayer::setBit(uint16_t &n, uint16_t bn, uint16_t b)
{n^=(-b^n)&(1<<bn);}
void CMidiPlayer::setMute(int ch,bool m)
-{
- setBit(mute,ch,m?1:0);
-}
+{setBit(mute,ch,m?1:0);}
void CMidiPlayer::setSolo(int ch,bool s)
-{
- setBit(solo,ch,s?1:0);
-}
+{setBit(solo,ch,s?1:0);}
+int CMidiPlayer::getCC(int ch, int id)
+{int ret=0;synth?fluid_synth_get_cc(synth,ch,id,&ret):0;return ret;}
+void CMidiPlayer::setCC(int ch, int id, int val)
+{synth?fluid_synth_cc(synth,ch,id,val):0;}
int CMidiPlayer::getSFCount()
{return synth?fluid_synth_sfcount(synth):0;}
fluid_sfont_t* CMidiPlayer::getSFPtr(int sfid)
diff --git a/qmpmidiplay.hpp b/qmpmidiplay.hpp
index 2f279b7..cdd6741 100644
--- a/qmpmidiplay.hpp
+++ b/qmpmidiplay.hpp
@@ -94,6 +94,8 @@ class CMidiPlayer
void getChannelPreset(int ch,int *b,int *p,char *name);
void setMute(int ch,bool m);
void setSolo(int ch,bool s);
+ int getCC(int ch,int id);
+ void setCC(int ch,int id,int val);
//void pushSoundFont(const char* url);
int getSFCount();
diff --git a/qmppresetselect.cpp b/qmppresetselect.cpp
index f96c99e..22b54ca 100644
--- a/qmppresetselect.cpp
+++ b/qmppresetselect.cpp
@@ -18,7 +18,7 @@ qmppresetselect::~qmppresetselect()
void qmppresetselect::showEvent(QShowEvent *e)
{
e->accept();memset(presets,0,sizeof(presets));
- CMidiPlayer *plyr=((qmpMainWindow*)(this->parent()->parent()))->getPlayer();
+ CMidiPlayer *plyr=qmpMainWindow::getInstance()->getPlayer();
int sfc=plyr->getSFCount();
for(int i=0;i<sfc;++i)
{
@@ -39,8 +39,10 @@ void qmppresetselect::showEvent(QShowEvent *e)
}
void qmppresetselect::setupWindow(int chid)
{
- CMidiPlayer *plyr=((qmpMainWindow*)(this->parent()->parent()))->getPlayer();
+ CMidiPlayer *plyr=qmpMainWindow::getInstance()->getPlayer();
ch=chid;int b,p,r;char name[30];
+ sprintf(name,"Preset Selection - Channel #%d",ch);
+ setWindowTitle(name);
plyr->getChannelPreset(chid,&b,&p,name);
for(int i=0;i<ui->lwBankSelect->count();++i)
{
@@ -66,7 +68,7 @@ void qmppresetselect::on_pbCancel_clicked()
void qmppresetselect::on_pbOk_clicked()
{
- CMidiPlayer *plyr=((qmpMainWindow*)(this->parent()->parent()))->getPlayer();
+ CMidiPlayer *plyr=qmpMainWindow::getInstance()->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);