aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2016-05-03 23:20:16 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2016-05-03 23:20:16 +0800
commit015a45c276caf34be3ce9175a1bcce644d736a0b (patch)
tree05ebec5acd744170981e5569c1e0aed4f78ed68f
parentbb82e7dfe2c6f3ee40a79f949db68cdd2c28456b (diff)
downloadQMidiPlayer-015a45c276caf34be3ce9175a1bcce644d736a0b.tar.xz
Finish option proxying for all types.
Add more options for the visualization plugin. Bump version to 0.8.0. Package the visualization plugin for debian.
-rw-r--r--ChangeLog6
-rw-r--r--debian/changelog6
-rw-r--r--debian/control5
-rw-r--r--debian/qmidiplayer-plugin-visualization.install2
-rw-r--r--debian/qmidiplayer.install3
-rw-r--r--doc/index.html2
-rw-r--r--doc/mainwindow.html2
-rw-r--r--img/chequerboard.pngbin0 -> 230 bytes
-rw-r--r--qmidiplayer-desktop/qmidiplayer-desktop.pro8
-rw-r--r--qmidiplayer-desktop/qmphelpwindow.hpp2
-rw-r--r--qmidiplayer-desktop/qmpplugin.cpp32
-rw-r--r--qmidiplayer-desktop/qmpsettingswindow.cpp203
-rw-r--r--qmidiplayer-desktop/qmpsettingswindow.hpp18
-rw-r--r--visualization/qmpvisualization.cpp55
-rw-r--r--visualization/qmpvisualization.hpp1
-rw-r--r--visualization/visualization.pro5
16 files changed, 301 insertions, 49 deletions
diff --git a/ChangeLog b/ChangeLog
index db9d2e9..5468866 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2016-05-03 0.8.0 beta
+Finish option proxying for all types.
+Add more options for the visualization plugin.
+Bump version to 0.8.0.
+Package the visualization plugin for debian.
+
2016-05-02 0.7.8 beta
Finally finished the option proxying infrastructure...
diff --git a/debian/changelog b/debian/changelog
index 298658b..5526c46 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+qmidiplayer (0.8.0-0) UNRELEASED; urgency=low
+
+ * New upstream release.
+
+ -- chrisoft <chirs241097@gmail.com> Tue, 03 May 2016 12:14:22 +0800
+
qmidiplayer (0.7.2-5) UNRELEASED; urgency=low
* Stable release.
diff --git a/debian/control b/debian/control
index d79bb76..94d7d57 100644
--- a/debian/control
+++ b/debian/control
@@ -22,3 +22,8 @@ Package: qmidiplayer-lite
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Midi player based on Qt and fluidsynth (Lite version).
+
+Package: qmidiplayer-plugin-visualization
+Architecture: any
+Depends: qmidiplayer, ${shlibs:Depends}, ${misc:Depends}
+Description: Midi visualization plugin for QMidiPlayer. \ No newline at end of file
diff --git a/debian/qmidiplayer-plugin-visualization.install b/debian/qmidiplayer-plugin-visualization.install
new file mode 100644
index 0000000..8b0b08d
--- /dev/null
+++ b/debian/qmidiplayer-plugin-visualization.install
@@ -0,0 +1,2 @@
+usr/lib/qmidiplayer/*
+usr/share/qmidiplayer/img/chequerboard.png \ No newline at end of file
diff --git a/debian/qmidiplayer.install b/debian/qmidiplayer.install
index e330b09..cfcbc70 100644
--- a/debian/qmidiplayer.install
+++ b/debian/qmidiplayer.install
@@ -4,4 +4,5 @@ usr/share/applications/qmidiplayer.desktop
usr/share/icons/hicolor/64x64/apps/qmidiplyr.png
usr/share/icons/hicolor/scalable/apps/qmidiplyr.svg
usr/share/menu/qmidiplayer
-usr/share/qmidiplayer
+usr/share/qmidiplayer/doc
+usr/share/qmidiplayer/img/qmidiplyr.png \ No newline at end of file
diff --git a/doc/index.html b/doc/index.html
index 27e6601..ccbf549 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -28,7 +28,7 @@
<ul>
<li>Playback of midi format 0/1 files.</li>
<li>Manipulate channel parameters on-the-fly.</li>
- <li>Visualization of midi file playback.(Not yet implemented)</li>
+ <li>Visualization of midi file playback.</li>
<li>Playlists.</li>
<li>Midi mapping.</li>
<li>Rendering midi files to wave.</li>
diff --git a/doc/mainwindow.html b/doc/mainwindow.html
index 57ffe79..fae519b 100644
--- a/doc/mainwindow.html
+++ b/doc/mainwindow.html
@@ -27,7 +27,7 @@
<ul>
<li>1. Now playing. Right clicking here will bring up the <a href="#fileop"> file operation menu</a>.</li>
<li>2. Playing control slider. The total playing time is estimated and isn't 100% accurate.</li>
- <li>3. Playing control buttons.</li>
+ <li>3. Playing control buttons. Self-explanatory.</li>
<li>4. Settings button. Read the Settings section for details.</li>
<li>5. Dialog toggle buttons.</li>
<li>6. Master gain slider.</li>
diff --git a/img/chequerboard.png b/img/chequerboard.png
new file mode 100644
index 0000000..9633a3f
--- /dev/null
+++ b/img/chequerboard.png
Binary files differ
diff --git a/qmidiplayer-desktop/qmidiplayer-desktop.pro b/qmidiplayer-desktop/qmidiplayer-desktop.pro
index 9e169e6..e3d6492 100644
--- a/qmidiplayer-desktop/qmidiplayer-desktop.pro
+++ b/qmidiplayer-desktop/qmidiplayer-desktop.pro
@@ -60,6 +60,14 @@ unix{
isEmpty(PREFIX) {
PREFIX = /usr/local
}
+ BUILDM = $$(QMP_BUILD_MODE)
+ isEmpty(BUILDM) {
+ message(Building in normal(debugging) mode...)
+ }
+ else {
+ message(Building in packaging mode...)
+ DEFINES += QMP_BUILD_UNIX_PACKAGE
+ }
BINDIR = $$PREFIX/bin
target.path = $$BINDIR
DATADIR = $$PREFIX/share
diff --git a/qmidiplayer-desktop/qmphelpwindow.hpp b/qmidiplayer-desktop/qmphelpwindow.hpp
index 209a753..053a738 100644
--- a/qmidiplayer-desktop/qmphelpwindow.hpp
+++ b/qmidiplayer-desktop/qmphelpwindow.hpp
@@ -2,7 +2,7 @@
#define QMPHELPWINDOW_H
#include <QDialog>
-#define APP_VERSION "0.7.8"
+#define APP_VERSION "0.8.0"
namespace Ui {
class qmpHelpWindow;
diff --git a/qmidiplayer-desktop/qmpplugin.cpp b/qmidiplayer-desktop/qmpplugin.cpp
index 7b089d7..f014902 100644
--- a/qmidiplayer-desktop/qmpplugin.cpp
+++ b/qmidiplayer-desktop/qmpplugin.cpp
@@ -25,6 +25,7 @@ void qmpPluginManager::scanPlugins()
DIR *dir;
struct dirent *file;
std::vector<std::string> cpluginpaths;
+#ifdef QMP_BUILD_UNIX_PACKAGE
if((dir=opendir("/usr/lib/qmidiplayer/")))
{
while((file=readdir(dir)))
@@ -32,6 +33,7 @@ void qmpPluginManager::scanPlugins()
cpluginpaths.push_back(std::string("/usr/lib/qmidiplayer/")+std::string(file->d_name));
closedir(dir);
}
+#endif
if((dir=opendir("./")))
{
while((file=readdir(dir)))
@@ -121,16 +123,20 @@ void qmpPluginAPI::unregisterVisualizationIntf(int intfhandle)
void qmpPluginAPI::registerOptionInt(std::string tab,std::string desc,std::string key,int min,int max,int defaultval)
{qsw->registerOptionInt(tab,desc,key,min,max,defaultval);}
int qmpPluginAPI::getOptionInt(std::string key){return qsw->getOptionInt(key);}
-void qmpPluginAPI::setOptionInt(std::string key,int val){qsw->SetOptionInt(key,val);}
-void qmpPluginAPI::registerOptionUint(std::string,std::string,std::string,unsigned,unsigned,unsigned){}
-unsigned qmpPluginAPI::getOptionUint(std::string){return 0;}
-void qmpPluginAPI::setOptionUint(std::string,unsigned){}
-void qmpPluginAPI::registerOptionBool(std::string,std::string,std::string,bool){}
-bool qmpPluginAPI::getOptionBool(std::string){return false;}
-void qmpPluginAPI::setOptionBool(std::string,bool){}
-void qmpPluginAPI::registerOptionDouble(std::string,std::string,std::string,double,double,double){}
-double qmpPluginAPI::getOptionDouble(std::string){return 0;}
-void qmpPluginAPI::setOptionDouble(std::string,double){}
-void qmpPluginAPI::registerOptionString(std::string,std::string,std::string,std::string){}
-std::string qmpPluginAPI::getOptionString(std::string){return "";}
-void qmpPluginAPI::setOptionString(std::string,std::string){}
+void qmpPluginAPI::setOptionInt(std::string key,int val){qsw->setOptionInt(key,val);}
+void qmpPluginAPI::registerOptionUint(std::string tab,std::string desc,std::string key,unsigned min,unsigned max,unsigned defaultval)
+{qsw->registerOptionUint(tab,desc,key,min,max,defaultval);}
+unsigned qmpPluginAPI::getOptionUint(std::string key){return qsw->getOptionUint(key);}
+void qmpPluginAPI::setOptionUint(std::string key,unsigned val){qsw->setOptionUint(key,val);}
+void qmpPluginAPI::registerOptionBool(std::string tab,std::string desc,std::string key,bool defaultval)
+{qsw->registerOptionBool(tab,desc,key,defaultval);}
+bool qmpPluginAPI::getOptionBool(std::string key){return qsw->getOptionBool(key);}
+void qmpPluginAPI::setOptionBool(std::string key,bool val){qsw->setOptionBool(key,val);}
+void qmpPluginAPI::registerOptionDouble(std::string tab,std::string desc,std::string key,double min,double max,double defaultval)
+{qsw->registerOptionDouble(tab,desc,key,min,max,defaultval);}
+double qmpPluginAPI::getOptionDouble(std::string key){return qsw->getOptionDouble(key);}
+void qmpPluginAPI::setOptionDouble(std::string key,double val){qsw->setOptionDouble(key,val);}
+void qmpPluginAPI::registerOptionString(std::string tab,std::string desc,std::string key,std::string defaultval)
+{qsw->registerOptionString(tab,desc,key,defaultval);}
+std::string qmpPluginAPI::getOptionString(std::string key){return qsw->getOptionString(key);}
+void qmpPluginAPI::setOptionString(std::string key,std::string val){return qsw->setOptionString(key,val);}
diff --git a/qmidiplayer-desktop/qmpsettingswindow.cpp b/qmidiplayer-desktop/qmpsettingswindow.cpp
index 011aaeb..ad9ac14 100644
--- a/qmidiplayer-desktop/qmpsettingswindow.cpp
+++ b/qmidiplayer-desktop/qmpsettingswindow.cpp
@@ -1,3 +1,4 @@
+#include <QPlainTextEdit>
#include <QFileDialog>
#include <QDir>
#include "qmpsettingswindow.hpp"
@@ -247,7 +248,7 @@ void qmpSettingsWindow::settingsUpdate()
settings->setValue(
QString("PluginSwitch/")+ui->twPluginList->item(i,1)->text(),
((QCheckBox*)ui->twPluginList->cellWidget(i,0))->isChecked()?1:0);
- updateCustomeOptions();
+ updateCustomOptions();
settings->sync();
}
@@ -322,15 +323,33 @@ void qmpSettingsWindow::updatePluginList(qmpPluginManager *pmgr)
ui->twPluginList->setColumnWidth(3,128);
}
-void qmpSettingsWindow::updateCustomeOptions()
+void qmpSettingsWindow::updateCustomOptions()
{
for(auto i=customOptions.begin();i!=customOptions.end();++i)
switch(i->second.type)
{
- case 0:
+ case 0:case 1:
+ {
QSpinBox* sb=(QSpinBox*)i->second.widget;
settings->setValue(QString(i->first.c_str()),sb->value());
- break;
+ break;
+ }
+ case 2:
+ {
+ settings->setValue(QString(i->first.c_str()),((QCheckBox*)i->second.widget)->isChecked()?1:0);
+ break;
+ }
+ case 3:
+ {
+ QDoubleSpinBox* sb=(QDoubleSpinBox*)i->second.widget;
+ settings->setValue(QString(i->first.c_str()),sb->value());
+ break;
+ }
+ case 4:
+ {
+ QPlainTextEdit* te=(QPlainTextEdit*)i->second.widget;
+ settings->setValue(QString(i->first.c_str()),te->toPlainText());
+ }
}
}
@@ -344,20 +363,24 @@ void qmpSettingsWindow::registerOptionInt(std::string tab,std::string desc,std::
customOptions[key].type=0;
if(desc.length())
{
- QFormLayout* page=NULL;
+ QGridLayout* page=NULL;
if(customOptPages[tab])page=customOptPages[tab];
else
{
QWidget* w=new QWidget;
- page=new QFormLayout(w);w->setLayout(page);
+ page=new QGridLayout(w);
+ w->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
ui->tabWidget->addTab(w,QString(tab.c_str()));
customOptPages[tab]=page;
}
QSpinBox* sb=new QSpinBox(page->parentWidget());
QLabel* lb=new QLabel(desc.c_str(),page->parentWidget());
customOptions[key].widget=sb;
- lb->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred);
- page->addRow(lb,sb);
+ sb->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed);
+ lb->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
+ int row=page->rowCount();
+ page->addWidget(lb,row,0);
+ page->addWidget(sb,row,1);
sb->setMaximum(max);
sb->setMinimum(min);
sb->setValue(settings->value(QString(key.c_str()),defaultval).toInt());
@@ -367,7 +390,169 @@ int qmpSettingsWindow::getOptionInt(std::string key)
{
return settings->value(QString(key.c_str()),customOptions[key].defaultval).toInt();
}
-void qmpSettingsWindow::SetOptionInt(std::string key,int val)
+void qmpSettingsWindow::setOptionInt(std::string key,int val)
+{
+ settings->setValue(QString(key.c_str()),val);
+ ((QSpinBox*)customOptions[key].widget)->setValue(val);
+}
+
+void qmpSettingsWindow::registerOptionUint(std::string tab,std::string desc,std::string key,unsigned min,unsigned max,unsigned defaultval)
+{
+ customOptions[key].widget=NULL;
+ customOptions[key].desc=desc;
+ customOptions[key].defaultval=defaultval;
+ customOptions[key].minv=min;
+ customOptions[key].maxv=max;
+ customOptions[key].type=1;
+ if(desc.length())
+ {
+ QGridLayout* page=NULL;
+ if(customOptPages[tab])page=customOptPages[tab];
+ else
+ {
+ QWidget* w=new QWidget;
+ page=new QGridLayout(w);
+ w->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
+ ui->tabWidget->addTab(w,QString(tab.c_str()));
+ customOptPages[tab]=page;
+ }
+ QSpinBox* sb=new QSpinBox(page->parentWidget());
+ QLabel* lb=new QLabel(desc.c_str(),page->parentWidget());
+ customOptions[key].widget=sb;
+ sb->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed);
+ lb->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
+ int row=page->rowCount();
+ page->addWidget(lb,row,0);
+ page->addWidget(sb,row,1);
+ sb->setMaximum(max);
+ sb->setMinimum(min);
+ sb->setValue(settings->value(QString(key.c_str()),defaultval).toUInt());
+ }
+}
+unsigned qmpSettingsWindow::getOptionUint(std::string key)
+{
+ return settings->value(QString(key.c_str()),customOptions[key].defaultval).toUInt();
+}
+void qmpSettingsWindow::setOptionUint(std::string key,unsigned val)
+{
+ settings->setValue(QString(key.c_str()),val);
+ ((QSpinBox*)customOptions[key].widget)->setValue(val);
+}
+
+void qmpSettingsWindow::registerOptionBool(std::string tab,std::string desc,std::string key,bool defaultval)
+{
+ customOptions[key].widget=NULL;
+ customOptions[key].desc=desc;
+ customOptions[key].defaultval=defaultval;
+ customOptions[key].type=2;
+ if(desc.length())
+ {
+ QGridLayout* page=NULL;
+ if(customOptPages[tab])page=customOptPages[tab];
+ else
+ {
+ QWidget* w=new QWidget;
+ page=new QGridLayout(w);
+ w->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
+ ui->tabWidget->addTab(w,QString(tab.c_str()));
+ customOptPages[tab]=page;
+ }
+ QCheckBox* cb=new QCheckBox(desc.c_str(),page->parentWidget());
+ customOptions[key].widget=cb;
+ cb->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
+ int row=page->rowCount();
+ page->addWidget(cb,row,0,1,2);
+ cb->setChecked(settings->value(QString(key.c_str()),(int)defaultval).toInt());
+ }
+}
+bool qmpSettingsWindow::getOptionBool(std::string key)
+{
+ return settings->value(QString(key.c_str()),(int)customOptions[key].defaultval.toBool()).toInt();
+}
+void qmpSettingsWindow::setOptionBool(std::string key,bool val)
+{
+ settings->setValue(QString(key.c_str()),val?1:0);
+ ((QCheckBox*)customOptions[key].widget)->setChecked(val);
+}
+
+void qmpSettingsWindow::registerOptionDouble(std::string tab,std::string desc,std::string key,double min,double max,double defaultval)
+{
+ customOptions[key].widget=NULL;
+ customOptions[key].desc=desc;
+ customOptions[key].defaultval=defaultval;
+ customOptions[key].minv=min;
+ customOptions[key].maxv=max;
+ customOptions[key].type=3;
+ if(desc.length())
+ {
+ QGridLayout* page=NULL;
+ if(customOptPages[tab])page=customOptPages[tab];
+ else
+ {
+ QWidget* w=new QWidget;
+ page=new QGridLayout(w);
+ w->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
+ ui->tabWidget->addTab(w,QString(tab.c_str()));
+ customOptPages[tab]=page;
+ }
+ QDoubleSpinBox* sb=new QDoubleSpinBox(page->parentWidget());
+ QLabel* lb=new QLabel(desc.c_str(),page->parentWidget());
+ customOptions[key].widget=sb;
+ sb->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed);
+ lb->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
+ int row=page->rowCount();
+ page->addWidget(lb,row,0);
+ page->addWidget(sb,row,1);
+ sb->setMaximum(max);
+ sb->setMinimum(min);
+ sb->setValue(settings->value(QString(key.c_str()),defaultval).toDouble());
+ }
+}
+double qmpSettingsWindow::getOptionDouble(std::string key)
+{
+ return settings->value(QString(key.c_str()),customOptions[key].defaultval).toDouble();
+}
+void qmpSettingsWindow::setOptionDouble(std::string key,double val)
{
settings->setValue(QString(key.c_str()),val);
+ ((QDoubleSpinBox*)customOptions[key].widget)->setValue(val);
+}
+
+void qmpSettingsWindow::registerOptionString(std::string tab,std::string desc,std::string key,std::string defaultval)
+{
+ customOptions[key].widget=NULL;
+ customOptions[key].desc=desc;
+ customOptions[key].defaultval=QString(defaultval.c_str());
+ customOptions[key].type=4;
+ if(desc.length())
+ {
+ QGridLayout* page=NULL;
+ if(customOptPages[tab])page=customOptPages[tab];
+ else
+ {
+ QWidget* w=new QWidget;
+ page=new QGridLayout(w);
+ w->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
+ ui->tabWidget->addTab(w,QString(tab.c_str()));
+ customOptPages[tab]=page;
+ }
+ QPlainTextEdit* te=new QPlainTextEdit(page->parentWidget());
+ QLabel* lb=new QLabel(desc.c_str(),page->parentWidget());
+ customOptions[key].widget=te;
+ te->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed);
+ lb->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
+ int row=page->rowCount();
+ page->addWidget(lb,row,0);
+ page->addWidget(te,row,1);
+ te->setPlainText(defaultval.c_str());
+ }
+}
+std::string qmpSettingsWindow::getOptionString(std::string key)
+{
+ return settings->value(QString(key.c_str()),customOptions[key].defaultval).toString().toStdString();
+}
+void qmpSettingsWindow::setOptionString(std::string key,std::string val)
+{
+ settings->setValue(QString(key.c_str()),QString(val.c_str()));
+ ((QPlainTextEdit*)customOptions[key].widget)->setPlainText(val.c_str());
}
diff --git a/qmidiplayer-desktop/qmpsettingswindow.hpp b/qmidiplayer-desktop/qmpsettingswindow.hpp
index 13442fd..efa69d5 100644
--- a/qmidiplayer-desktop/qmpsettingswindow.hpp
+++ b/qmidiplayer-desktop/qmpsettingswindow.hpp
@@ -34,7 +34,19 @@ class qmpSettingsWindow:public QDialog
void updatePluginList(qmpPluginManager *pmgr);
void registerOptionInt(std::string tab,std::string desc,std::string key,int min,int max,int defaultval);
int getOptionInt(std::string key);
- void SetOptionInt(std::string key,int val);
+ void setOptionInt(std::string key,int val);
+ void registerOptionUint(std::string tab,std::string desc,std::string key,unsigned min,unsigned max,unsigned defaultval);
+ unsigned getOptionUint(std::string key);
+ void setOptionUint(std::string key,unsigned val);
+ void registerOptionBool(std::string tab,std::string desc,std::string key,bool defaultval);
+ bool getOptionBool(std::string key);
+ void setOptionBool(std::string key,bool val);
+ void registerOptionDouble(std::string tab,std::string desc,std::string key,double min,double max,double defaultval);
+ double getOptionDouble(std::string key);
+ void setOptionDouble(std::string key,double val);
+ void registerOptionString(std::string tab,std::string desc,std::string key,std::string defaultval);
+ std::string getOptionString(std::string key);
+ void setOptionString(std::string key,std::string val);
signals:
void dialogClosing();
@@ -56,8 +68,8 @@ class qmpSettingsWindow:public QDialog
Ui::qmpSettingsWindow *ui;
void settingsUpdate();
std::map<std::string,qmpCustomOption> customOptions;
- std::map<std::string,QFormLayout*> customOptPages;
- void updateCustomeOptions();
+ std::map<std::string,QGridLayout*> customOptPages;
+ void updateCustomOptions();
static QSettings *settings;
static QComboBox* outwidget;
public:
diff --git a/visualization/qmpvisualization.cpp b/visualization/qmpvisualization.cpp
index 30d2437..60b1fbb 100644
--- a/visualization/qmpvisualization.cpp
+++ b/visualization/qmpvisualization.cpp
@@ -8,7 +8,9 @@
int viewdist=100;
int notestretch=100;//length of quarter note
int minnotelength=100;
-const int noteappearance=1;
+int noteappearance=1;
+int wwidth=800,wheight=600,wsupersample=1;
+int fov=60;
DWORD iccolors[]={0XFFFF0000,0XFFFF8000,0XFFFFBF00,0XFFFFFF00,
0XFFBFFF00,0XFF80FF00,0XFF00FF00,0XFF00FFBF,
0XFF00FFFF,0XFF333333,0XFF00BFFF,0XFF007FFF,
@@ -44,8 +46,16 @@ void CHandlerCallBack::callBack(void*,void*)
}
void qmpVisualization::showThread()
{
+ wwidth=api->getOptionInt("Visualization/wwidth");
+ wheight=api->getOptionInt("Visualization/wheight");
+ wsupersample=api->getOptionInt("Visualization/supersampling");
+ fov=api->getOptionInt("Visualization/fov");
+ noteappearance=api->getOptionBool("Visualization/3dnotes");
+ viewdist=api->getOptionInt("Visualization/viewdist");
+ notestretch=api->getOptionInt("Visualization/notestretch");
+ minnotelength=api->getOptionInt("Visualization/minnotelen");
sm=smGetInterface(SMELT_APILEVEL);
- sm->smVidMode(800,600,true);
+ sm->smVidMode(wwidth,wheight,true);
sm->smUpdateFunc(h);sm->smQuitFunc(closeh);
sm->smWinTitle("QMidiPlayer Visualization");
sm->smSetFPS(FPS_VSYNC);
@@ -53,16 +63,15 @@ void qmpVisualization::showThread()
sm->smInit();shouldclose=false;
sm->smTextureOpt(TPOT_POT,TFLT_LINEAR);
chequer=sm->smTextureLoad("chequerboard.png");
- tdscn=sm->smTargetCreate(800,600);
+ if(!chequer)
+ chequer=sm->smTextureLoad("/usr/share/qmidiplayer/img/chequerboard.png");
+ tdscn=sm->smTargetCreate(wwidth*wsupersample,wheight*wsupersample);
if(!font.loadTTF("/usr/share/fonts/truetype/freefont/FreeMono.ttf",16))
printf("W: Font load failed.\n");
if(!font2.loadTTF("/usr/share/fonts/truetype/wqy/wqy-microhei.ttc",16))
printf("W: Font load failed.\n");
pos[0]=-0;pos[1]=70;pos[2]=20;
rot[0]=0;rot[1]=90;rot[2]=90;ctk=0;
- viewdist=api->getOptionInt("Visualization/viewdist");
- notestretch=api->getOptionInt("Visualization/notestretch");
- minnotelength=api->getOptionInt("Visualization/minnotelen");
sm->smMainLoop();
}
void qmpVisualization::show()
@@ -103,7 +112,7 @@ bool qmpVisualization::update()
q.v[0].y=q.v[1].y=-60;q.v[2].y=q.v[3].y=60;
q.v[0].tx=q.v[3].tx=0;q.v[1].tx=q.v[2].tx=15;
q.v[0].ty=q.v[1].ty=0;q.v[2].ty=q.v[3].ty=15;
- sm->smRenderBegin3D(60,tdscn);
+ sm->smRenderBegin3D(fov,tdscn);
sm->sm3DCamera6f2v(pos,rot);
sm->smClrscr(0xFF666666);
sm->smRenderQuad(&q);
@@ -161,23 +170,23 @@ bool qmpVisualization::update()
sm->smClrscr(0xFF000000);
q.v[0].tx=q.v[3].tx=0;q.v[1].tx=q.v[2].tx=1;
q.v[0].ty=q.v[1].ty=0;q.v[2].ty=q.v[3].ty=1;
- q.v[0].x=q.v[1].x=0;q.v[2].x=q.v[3].x=800;
- q.v[0].y=q.v[3].y=0;q.v[1].y=q.v[2].y=600;
+ q.v[0].x=q.v[1].x=0;q.v[2].x=q.v[3].x=wwidth;
+ q.v[0].y=q.v[3].y=0;q.v[1].y=q.v[2].y=wheight;
sm->smRenderQuad(&q);
wchar_t ws[1024];memset(ws,0,sizeof(ws));
mbstowcs(ws,api->getTitle().c_str(),1024);
font2.updateString(L"Title: %ls",ws);
- font2.render(1,536,0xFFFFFFFF,ALIGN_LEFT);
- font2.render(0,535,0xFF000000,ALIGN_LEFT);
+ font2.render(1,wheight-64,0xFFFFFFFF,ALIGN_LEFT);
+ font2.render(0,wheight-65,0xFF000000,ALIGN_LEFT);
font.updateString(L"Tempo: %.2f",api->getRealTempo());
- font.render(1,556,0xFFFFFFFF,ALIGN_LEFT);
- font.render(0,555,0xFF000000,ALIGN_LEFT);
+ font.render(1,wheight-44,0xFFFFFFFF,ALIGN_LEFT);
+ font.render(0,wheight-45,0xFF000000,ALIGN_LEFT);
font.updateString(L"Current tick: %d",ctk);
- font.render(1,576,0xFFFFFFFF,ALIGN_LEFT);
- font.render(0,575,0xFF000000,ALIGN_LEFT);
+ font.render(1,wheight-24,0xFFFFFFFF,ALIGN_LEFT);
+ font.render(0,wheight-25,0xFF000000,ALIGN_LEFT);
font.updateString(L"FPS: %.2f",sm->smGetFPS());
- font.render(1,596,0xFFFFFFFF,ALIGN_LEFT);
- font.render(0,595,0xFF000000,ALIGN_LEFT);
+ font.render(1,wheight-4,0xFFFFFFFF,ALIGN_LEFT);
+ font.render(0,wheight-5,0xFF000000,ALIGN_LEFT);
sm->smRenderEnd();
return shouldclose;
}
@@ -247,9 +256,19 @@ void qmpVisualization::init()
hvif=api->registerVisualizationIntf(vi);
herif=api->registerEventReaderIntf(cb,NULL);
hehif=api->registerEventHandlerIntf(hcb,NULL);
+ api->registerOptionBool("Visualization","3D Notes","Visualization/3dnotes",true);
+ api->registerOptionInt("Visualization","Window Width","Visualization/wwidth",320,3200,800);
+ api->registerOptionInt("Visualization","Window Height","Visualization/wheight",320,3200,600);
+ api->registerOptionInt("Visualization","Supersampling","Visualization/supersampling",1,4,1);
+ api->registerOptionInt("Visualization","FOV","Visualization/fov",30,180,60);
api->registerOptionInt("Visualization","View distance","Visualization/viewdist",20,1000,100);
api->registerOptionInt("Visualization","Note stretch","Visualization/notestretch",20,500,100);
api->registerOptionInt("Visualization","Minimum note length","Visualization/minnotelen",20,500,100);
+ wwidth=api->getOptionInt("Visualization/wwidth");
+ wheight=api->getOptionInt("Visualization/wheight");
+ wsupersample=api->getOptionInt("Visualization/supersampling");
+ fov=api->getOptionInt("Visualization/fov");
+ noteappearance=api->getOptionBool("Visualization/3dnotes");
viewdist=api->getOptionInt("Visualization/viewdist");
notestretch=api->getOptionInt("Visualization/notestretch");
minnotelength=api->getOptionInt("Visualization/minnotelen");
@@ -266,7 +285,7 @@ void qmpVisualization::deinit()
const char* qmpVisualization::pluginGetName()
{return "QMidiPlayer Default Visualization Plugin";}
const char* qmpVisualization::pluginGetVersion()
-{return "0.7.8";}
+{return "0.8.0";}
void qmpVisualization::pushNoteOn(uint32_t tc,uint32_t ch,uint32_t key,uint32_t vel)
{
diff --git a/visualization/qmpvisualization.hpp b/visualization/qmpvisualization.hpp
index 787b218..f37bddb 100644
--- a/visualization/qmpvisualization.hpp
+++ b/visualization/qmpvisualization.hpp
@@ -61,7 +61,6 @@ class qmpVisualization:public qmpPluginIntf
~qmpVisualization();
void pushNoteOn(uint32_t tc,uint32_t ch,uint32_t key,uint32_t vel);
void pushNoteOff(uint32_t tc,uint32_t ch,uint32_t key);
- void pushPitchBend(uint32_t tc,uint32_t ch,uint32_t key);
bool update();
void start();
void stop();
diff --git a/visualization/visualization.pro b/visualization/visualization.pro
index 10048bd..f27a0e1 100644
--- a/visualization/visualization.pro
+++ b/visualization/visualization.pro
@@ -19,8 +19,11 @@ HEADERS += qmpvisualization.hpp
unix {
target.path = /usr/lib/qmidiplayer
- INSTALLS += target
+ DATADIR = $$PREFIX/share
+ INSTALLS += target res
QMAKE_CXXFLAGS += -pthread -fPIC
+ res.path = $$DATADIR/qmidiplayer/img
+ res.files += ../img/chequerboard.png
}
#well...
INCLUDEPATH += /home/chrisoft/devel/BulletLabRemixIII/include/ /usr/include/freetype2