diff options
author | Chris Xiong <chirs241097@gmail.com> | 2016-05-06 23:43:01 +0800 |
---|---|---|
committer | Chris Xiong <chirs241097@gmail.com> | 2016-05-06 23:43:01 +0800 |
commit | 909cfe195ae2f6058a03875123f1e80f2a3fa0fa (patch) | |
tree | 9a6fcc0fa6390b8f503881999e4f08a8cd650c49 | |
parent | 8da0f5c82fb91c2731cd2e90a875fe92c6557407 (diff) | |
download | QMidiPlayer-909cfe195ae2f6058a03875123f1e80f2a3fa0fa.tar.xz |
Use new SMELT rendering API for notes drawing.
Deinitialize classes in a correct order to avoid crashes.
Add background image option.
Add FPS-related options.
Use QLineEdit instead of QPlainTextEdit for strings.
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | include/qmpcorepublic.hpp | 1 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmidiplayer-desktop.pro | 4 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmphelpwindow.hpp | 2 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmpmainwindow.cpp | 5 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmpplugin.cpp | 15 | ||||
-rw-r--r-- | qmidiplayer-desktop/qmpsettingswindow.cpp | 12 | ||||
-rw-r--r-- | visualization/qmpvirtualpiano3d.cpp | 8 | ||||
-rw-r--r-- | visualization/qmpvisualization.cpp | 121 | ||||
-rw-r--r-- | visualization/qmpvisualization.hpp | 3 | ||||
-rw-r--r-- | visualization/visualization.pro | 12 |
11 files changed, 103 insertions, 87 deletions
@@ -1,3 +1,10 @@ +2016-05-06 0.8.1 alpha +Use new SMELT rendering API for notes drawing. +Deinitialize classes in a correct order to avoid crashes. +Add background image option. +Add FPS-related options. +Use QLineEdit instead of QPlainTextEdit for strings. + 2016-05-05 0.8.1 pre Use the new SMELT rendering API. diff --git a/include/qmpcorepublic.hpp b/include/qmpcorepublic.hpp index b872041..0d040f9 100644 --- a/include/qmpcorepublic.hpp +++ b/include/qmpcorepublic.hpp @@ -51,6 +51,7 @@ extern "C"{ class qmpPluginAPI { public: + virtual ~qmpPluginAPI(); virtual uint32_t getDivision(); virtual uint32_t getRawTempo(); virtual double getRealTempo(); diff --git a/qmidiplayer-desktop/qmidiplayer-desktop.pro b/qmidiplayer-desktop/qmidiplayer-desktop.pro index e3d6492..01ad0cc 100644 --- a/qmidiplayer-desktop/qmidiplayer-desktop.pro +++ b/qmidiplayer-desktop/qmidiplayer-desktop.pro @@ -68,6 +68,10 @@ unix{ message(Building in packaging mode...) DEFINES += QMP_BUILD_UNIX_PACKAGE } + QMAKE_CXXFLAGS_RELEASE -= -O2 + QMAKE_CXXFLAGS_RELEASE += -O3 + QMAKE_LFLAGS_RELEASE -= -O1 + QMAKE_LFLAGS_RELEASE += -O3 BINDIR = $$PREFIX/bin target.path = $$BINDIR DATADIR = $$PREFIX/share diff --git a/qmidiplayer-desktop/qmphelpwindow.hpp b/qmidiplayer-desktop/qmphelpwindow.hpp index 053a738..6b1d719 100644 --- a/qmidiplayer-desktop/qmphelpwindow.hpp +++ b/qmidiplayer-desktop/qmphelpwindow.hpp @@ -2,7 +2,7 @@ #define QMPHELPWINDOW_H #include <QDialog> -#define APP_VERSION "0.8.0" +#define APP_VERSION "0.8.1" namespace Ui { class qmpHelpWindow; diff --git a/qmidiplayer-desktop/qmpmainwindow.cpp b/qmidiplayer-desktop/qmpmainwindow.cpp index d25cadd..3842757 100644 --- a/qmidiplayer-desktop/qmpmainwindow.cpp +++ b/qmidiplayer-desktop/qmpmainwindow.cpp @@ -61,9 +61,8 @@ qmpMainWindow::qmpMainWindow(QWidget *parent) : qmpMainWindow::~qmpMainWindow() { - if(player)delete player; - if(timer)delete timer; - delete pmgr;delete ui; + delete pmgr;if(player)delete player; + if(timer)delete timer;delete ui; } void qmpMainWindow::init() diff --git a/qmidiplayer-desktop/qmpplugin.cpp b/qmidiplayer-desktop/qmpplugin.cpp index f014902..b05ca0c 100644 --- a/qmidiplayer-desktop/qmpplugin.cpp +++ b/qmidiplayer-desktop/qmpplugin.cpp @@ -9,7 +9,7 @@ #include "qmpplugin.hpp" #include "qmpmainwindow.hpp" #include "qmpsettingswindow.hpp" -qmpPluginAPI pluginAPI; +qmpPluginAPI* pluginAPI; qmpMainWindow* qmw; qmpSettingsWindow* qsw; #ifdef _WIN32 @@ -48,7 +48,7 @@ void qmpPluginManager::scanPlugins() void* hndi=dlsym(hso,"qmpPluginGetInterface"); if(!hndi)continue; qmpPluginEntry e=(qmpPluginEntry)hndi; - qmpPluginIntf* intf=e(&pluginAPI); + qmpPluginIntf* intf=e(pluginAPI); plugins.push_back(qmpPlugin(std::string(intf->pluginGetName()),std::string(intf->pluginGetVersion()),std::string(cpluginpaths[i]),intf)); } } @@ -57,11 +57,16 @@ qmpPluginManager::qmpPluginManager() { qmw=qmpMainWindow::getInstance(); qsw=qmw->getSettingsWindow(); + pluginAPI=new qmpPluginAPI(); } qmpPluginManager::~qmpPluginManager() { - for(unsigned i=0;i<plugins.size();++i)delete plugins[i].interface; - qmw=NULL;qsw=NULL; + for(unsigned i=0;i<plugins.size();++i) + { + if(plugins[i].enabled)plugins[i].interface->deinit(); + delete plugins[i].interface; + } + qmw=NULL;qsw=NULL;delete pluginAPI; } std::vector<qmpPlugin> *qmpPluginManager::getPlugins() { @@ -82,6 +87,8 @@ void qmpPluginManager::deinitPlugins() plugins[i].interface->deinit(); } +qmpPluginAPI::~qmpPluginAPI(){} + uint32_t qmpPluginAPI::getDivision() {return qmw&&qmw->getPlayer()?qmw->getPlayer()->getDivision():0;} uint32_t qmpPluginAPI::getRawTempo() diff --git a/qmidiplayer-desktop/qmpsettingswindow.cpp b/qmidiplayer-desktop/qmpsettingswindow.cpp index ad9ac14..45f84c3 100644 --- a/qmidiplayer-desktop/qmpsettingswindow.cpp +++ b/qmidiplayer-desktop/qmpsettingswindow.cpp @@ -1,4 +1,4 @@ -#include <QPlainTextEdit> +#include <QLineEdit> #include <QFileDialog> #include <QDir> #include "qmpsettingswindow.hpp" @@ -347,8 +347,8 @@ void qmpSettingsWindow::updateCustomOptions() } case 4: { - QPlainTextEdit* te=(QPlainTextEdit*)i->second.widget; - settings->setValue(QString(i->first.c_str()),te->toPlainText()); + QLineEdit* te=(QLineEdit*)i->second.widget; + settings->setValue(QString(i->first.c_str()),te->text()); } } } @@ -536,7 +536,7 @@ void qmpSettingsWindow::registerOptionString(std::string tab,std::string desc,st ui->tabWidget->addTab(w,QString(tab.c_str())); customOptPages[tab]=page; } - QPlainTextEdit* te=new QPlainTextEdit(page->parentWidget()); + QLineEdit* te=new QLineEdit(page->parentWidget()); QLabel* lb=new QLabel(desc.c_str(),page->parentWidget()); customOptions[key].widget=te; te->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed); @@ -544,7 +544,7 @@ void qmpSettingsWindow::registerOptionString(std::string tab,std::string desc,st int row=page->rowCount(); page->addWidget(lb,row,0); page->addWidget(te,row,1); - te->setPlainText(defaultval.c_str()); + te->setText(settings->value(QString(key.c_str()),defaultval.c_str()).toString()); } } std::string qmpSettingsWindow::getOptionString(std::string key) @@ -554,5 +554,5 @@ std::string qmpSettingsWindow::getOptionString(std::string key) 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()); + ((QLineEdit*)customOptions[key].widget)->setText(val.c_str()); } diff --git a/visualization/qmpvirtualpiano3d.cpp b/visualization/qmpvirtualpiano3d.cpp index dca9086..bd40524 100644 --- a/visualization/qmpvirtualpiano3d.cpp +++ b/visualization/qmpvirtualpiano3d.cpp @@ -205,10 +205,10 @@ void qmpVirtualPiano3D::buildKeys() makeVertex( BK_WIDTH/2,0,BK_HEIGHT+BK_BOTTOM,0xFF000000,0,0), makeVertex( BK_WIDTH/2,BK_PRELEN,BK_HEIGHT+BK_BOTTOM,0xFF000000,0,0), makeVertex(-BK_WIDTH/2,BK_PRELEN,BK_HEIGHT+BK_BOTTOM,0xFF000000,0,0), - makeVertex(-BK_WIDTH/2,WK_PRELEN*0.95,BK_DBOTTOM+BK_BOTTOM,0xFF000000,0,0), - makeVertex( BK_WIDTH/2,WK_PRELEN*0.95,BK_DBOTTOM+BK_BOTTOM,0xFF000000,0,0), - makeVertex( BK_WIDTH/2,WK_PRELEN*0.95,BK_BOTTOM,0xFF000000,0,0), - makeVertex(-BK_WIDTH/2,WK_PRELEN*0.95,BK_BOTTOM,0xFF000000,0,0), + makeVertex(-BK_WIDTH/2,WK_PRELEN*0.995,BK_DBOTTOM+BK_BOTTOM,0xFF000000,0,0), + makeVertex( BK_WIDTH/2,WK_PRELEN*0.995,BK_DBOTTOM+BK_BOTTOM,0xFF000000,0,0), + makeVertex( BK_WIDTH/2,WK_PRELEN*0.995,BK_BOTTOM,0xFF000000,0,0), + makeVertex(-BK_WIDTH/2,WK_PRELEN*0.995,BK_BOTTOM,0xFF000000,0,0), makeVertex(-BK_WIDTH/2,0,BK_BOTTOM,0xFF000000,0,0), makeVertex( BK_WIDTH/2,0,BK_BOTTOM,0xFF000000,0,0)); bk->addIndices(48, diff --git a/visualization/qmpvisualization.cpp b/visualization/qmpvisualization.cpp index f271507..80fd07b 100644 --- a/visualization/qmpvisualization.cpp +++ b/visualization/qmpvisualization.cpp @@ -8,9 +8,9 @@ int viewdist=100; int notestretch=100;//length of quarter note int minnotelength=100; -int noteappearance=1; -int wwidth=800,wheight=600,wsupersample=1; -int fov=60; +int noteappearance=1,showpiano=1; +int wwidth=800,wheight=600,wsupersample=1,wmultisample=1; +int fov=60,vsync=1,tfps=60; DWORD iccolors[]={0XFFFF0000,0XFFFF8000,0XFFFFBF00,0XFFFFFF00, 0XFFBFFF00,0XFF80FF00,0XFF00FF00,0XFF00FFBF, 0XFF00FFFF,0XFF333333,0XFF00BFFF,0XFF007FFF, @@ -49,8 +49,12 @@ void qmpVisualization::showThread() wwidth=api->getOptionInt("Visualization/wwidth"); wheight=api->getOptionInt("Visualization/wheight"); wsupersample=api->getOptionInt("Visualization/supersampling"); + wmultisample=api->getOptionInt("Visualization/multisampling"); fov=api->getOptionInt("Visualization/fov"); noteappearance=api->getOptionBool("Visualization/3dnotes"); + showpiano=api->getOptionBool("Visualization/showpiano"); + vsync=api->getOptionBool("Visualization/vsync"); + tfps=api->getOptionInt("Visualization/tfps"); viewdist=api->getOptionInt("Visualization/viewdist"); notestretch=api->getOptionInt("Visualization/notestretch"); minnotelength=api->getOptionInt("Visualization/minnotelen"); @@ -58,16 +62,17 @@ void qmpVisualization::showThread() sm->smVidMode(wwidth,wheight,true); sm->smUpdateFunc(h);sm->smQuitFunc(closeh); sm->smWinTitle("QMidiPlayer Visualization"); - sm->smSetFPS(FPS_VSYNC); + sm->smSetFPS(vsync?FPS_VSYNC:tfps); sm->smNoSuspend(true); sm->smInit();shouldclose=false; sm->smTextureOpt(TPOT_POT,TFLT_LINEAR); - chequer=sm->smTextureLoad("chequerboard.png"); - for(int i=0;i<16;++i)p3d[i]=new qmpVirtualPiano3D(); - memset(traveld,0,sizeof(traveld)); - if(!chequer) + chequer=sm->smTextureLoad("chequerboard.png");if(!chequer) chequer=sm->smTextureLoad("/usr/share/qmidiplayer/img/chequerboard.png"); - tdscn=sm->smTargetCreate(wwidth*wsupersample,wheight*wsupersample); + bgtex=sm->smTextureLoad(api->getOptionString("Visualization/background").c_str()); + if(showpiano)for(int i=0;i<16;++i)p3d[i]=new qmpVirtualPiano3D(); + memset(traveld,0,sizeof(traveld)); + if(noteappearance==1)nebuf=new smEntity3DBuffer();else nebuf=NULL; + tdscn=sm->smTargetCreate(wwidth*wsupersample,wheight*wsupersample,wmultisample); 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)) @@ -84,7 +89,9 @@ void qmpVisualization::close() { shouldclose=true; rendererTh->join(); - for(int i=0;i<16;++i)delete p3d[i]; + + if(showpiano)for(int i=0;i<16;++i)delete p3d[i]; + if(noteappearance==1)delete nebuf; sm->smFinale(); font.releaseTTF(); font2.releaseTTF(); @@ -109,7 +116,7 @@ bool qmpVisualization::update() { smQuad q; for(int i=0;i<4;++i) - {q.v[i].col=0xFF999999;q.v[i].z=-5;} + {q.v[i].col=0xFF999999;q.v[i].z=showpiano?-5:0;} q.tex=chequer;q.blend=BLEND_ALPHABLEND; q.v[0].x=q.v[3].x=-120;q.v[1].x=q.v[2].x=120; q.v[0].y=q.v[1].y=-120;q.v[2].y=q.v[3].y=120; @@ -117,7 +124,7 @@ bool qmpVisualization::update() q.v[0].ty=q.v[1].ty=0;q.v[2].ty=q.v[3].ty=30; sm->smRenderBegin3D(fov,tdscn); sm->sm3DCamera6f2v(pos,rot); - sm->smClrscr(0xFF666666); + sm->smClrscr(0,1,1); sm->smRenderQuad(&q); if(sm->smGetKeyState(SMK_D))pos[0]+=cos(smMath::deg2rad(rot[2]-90)),pos[1]+=sin(smMath::deg2rad(rot[2]-90)); if(sm->smGetKeyState(SMK_A))pos[0]-=cos(smMath::deg2rad(rot[2]-90)),pos[1]-=sin(smMath::deg2rad(rot[2]-90)); @@ -156,16 +163,18 @@ bool qmpVisualization::update() if(fabs((double)pool[i]->tcs-ctk)*lpt<viewdist*2||fabs((double)pool[i]->tce-ctk)*lpt<viewdist*2) { if(api->getChannelMask(pool[i]->ch))continue; - smvec3d a(0.63*((double)pool[i]->key-64),64-pool[i]->ch*8.,((double)pool[i]->tce-ctk)*lpt); - smvec3d b(0.63*((double)pool[i]->key-64)+0.6,64-pool[i]->ch*8.+.4,((double)pool[i]->tcs-ctk)*lpt); + smvec3d a(0.63*((double)pool[i]->key-64)+.1,64-pool[i]->ch*8.,((double)pool[i]->tce-ctk)*lpt); + smvec3d b(0.63*((double)pool[i]->key-64)+.7,64-pool[i]->ch*8.+.4,((double)pool[i]->tcs-ctk)*lpt); bool isnoteon=pool[i]->tcs<=ctk&&pool[i]->tce>=ctk;if(isnoteon) - a.x=0.63*((double)pool[i]->key-64+api->getPitchBend(pool[i]->ch)), - b.x=0.63*((double)pool[i]->key-64+api->getPitchBend(pool[i]->ch))+0.6; + a.x=0.63*((double)pool[i]->key-64+api->getPitchBend(pool[i]->ch))+.1, + b.x=0.63*((double)pool[i]->key-64+api->getPitchBend(pool[i]->ch))+.7; notestatus[pool[i]->ch][pool[i]->key]|=isnoteon;a.x*=1.2;b.x*=1.2; if(((double)pool[i]->tce-pool[i]->tcs)*lpt<minnotelength/100.)a.z=((double)pool[i]->tcs-ctk)*lpt-minnotelength/100.; drawCube(a,b,SETA(isnoteon?accolors[pool[i]->ch]:iccolors[pool[i]->ch],int(pool[i]->vel*(isnoteon?2.0:1.6))),0); } } + if(noteappearance)nebuf->drawBatch(); + if(showpiano) for(int i=0;i<16;++i) { for(int j=0;j<128;++j) @@ -176,15 +185,24 @@ bool qmpVisualization::update() if(traveld[i][j]>0)traveld[i][j]-=2;else traveld[i][j]=0; p3d[i]->setKeyTravelDist(j,traveld[i][j]/10.); } - p3d[i]->render(smvec3d(api->getPitchBend(i),62-i*8,0)); + p3d[i]->render(smvec3d(0.63*api->getPitchBend(i),62-i*8,0)); } if(playing)ctk+=(int)(1e6/(api->getRawTempo()/api->getDivision())*sm->smGetDelta()); while(pool.size()&&((double)ctk-pool[elb]->tce)*lpt>viewdist*2)++elb; sm->smRenderEnd(); + sm->smRenderBegin2D(); + sm->smClrscr(0xFF666666);q.blend=BLEND_ALPHABLEND; for(int i=0;i<4;++i){q.v[i].col=0xFFFFFFFF;q.v[i].z=0;} + if(bgtex) + { + q.tex=bgtex; + q.v[0].x=q.v[3].x=0;q.v[1].x=q.v[2].x=wwidth; + q.v[0].y=q.v[1].y=0;q.v[2].y=q.v[3].y=wheight; + 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; + sm->smRenderQuad(&q); + } q.tex=sm->smTargetTexture(tdscn); - sm->smRenderBegin2D(); - 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=wwidth; @@ -214,42 +232,8 @@ void qmpVisualization::drawCube(smvec3d a,smvec3d b,DWORD col,SMTEX tex) q.tex=tex;for(int i=0;i<4;++i)q.v[i].col=col; if(noteappearance==1) { - //top - q.v[0].x=a.x;q.v[0].y=a.y;q.v[0].z=a.z; - q.v[1].x=b.x;q.v[1].y=a.y;q.v[1].z=a.z; - q.v[2].x=b.x;q.v[2].y=b.y;q.v[2].z=a.z; - q.v[3].x=a.x;q.v[3].y=b.y;q.v[3].z=a.z; - sm->smRenderQuad(&q); - //bottom - q.v[0].x=a.x;q.v[0].y=a.y;q.v[0].z=b.z; - q.v[1].x=b.x;q.v[1].y=a.y;q.v[1].z=b.z; - q.v[2].x=b.x;q.v[2].y=b.y;q.v[2].z=b.z; - q.v[3].x=a.x;q.v[3].y=b.y;q.v[3].z=b.z; - sm->smRenderQuad(&q); - //left - q.v[0].x=a.x;q.v[0].y=b.y;q.v[0].z=a.z; - q.v[1].x=a.x;q.v[1].y=b.y;q.v[1].z=b.z; - q.v[2].x=a.x;q.v[2].y=a.y;q.v[2].z=b.z; - q.v[3].x=a.x;q.v[3].y=a.y;q.v[3].z=a.z; - sm->smRenderQuad(&q); - //right - q.v[0].x=b.x;q.v[0].y=b.y;q.v[0].z=a.z; - q.v[1].x=b.x;q.v[1].y=b.y;q.v[1].z=b.z; - q.v[2].x=b.x;q.v[2].y=a.y;q.v[2].z=b.z; - q.v[3].x=b.x;q.v[3].y=a.y;q.v[3].z=a.z; - sm->smRenderQuad(&q); - //front - q.v[0].x=a.x;q.v[0].y=b.y;q.v[0].z=a.z; - q.v[1].x=b.x;q.v[1].y=b.y;q.v[1].z=a.z; - q.v[2].x=b.x;q.v[2].y=b.y;q.v[2].z=b.z; - q.v[3].x=a.x;q.v[3].y=b.y;q.v[3].z=b.z; - sm->smRenderQuad(&q); - //back - q.v[0].x=a.x;q.v[0].y=a.y;q.v[0].z=a.z; - q.v[1].x=b.x;q.v[1].y=a.y;q.v[1].z=a.z; - q.v[2].x=b.x;q.v[2].y=a.y;q.v[2].z=b.z; - q.v[3].x=a.x;q.v[3].y=a.y;q.v[3].z=b.z; - sm->smRenderQuad(&q); + smMatrix I;I.loadIdentity();smEntity3D c=smEntity3D::cube(a,b,col); + nebuf->addTransformedEntity(&c,I,smvec3d(0,0,0)); } else { @@ -273,19 +257,28 @@ 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); + api->registerOptionBool("Visualization-Appearance","Show Piano","Visualization/showpiano",true); + api->registerOptionBool("Visualization-Appearance","3D Notes","Visualization/3dnotes",true); + api->registerOptionBool("Visualization-Video","Enable VSync","Visualization/vsync",true); + api->registerOptionInt("Visualization-Video","Window Width","Visualization/wwidth",320,3200,800); + api->registerOptionInt("Visualization-Video","Window Height","Visualization/wheight",320,3200,600); + api->registerOptionInt("Visualization-Video","FPS","Visualization/tfps",5,1000,60); + api->registerOptionInt("Visualization-Video","Supersampling","Visualization/supersampling",1,16,0); + api->registerOptionInt("Visualization-Video","Multisampling","Visualization/multisampling",0,16,0); + api->registerOptionInt("Visualization-Video","FOV","Visualization/fov",30,180,60); + api->registerOptionInt("Visualization-Appearance","View distance","Visualization/viewdist",20,1000,100); + api->registerOptionInt("Visualization-Appearance","Note stretch","Visualization/notestretch",20,500,100); + api->registerOptionInt("Visualization-Appearance","Minimum note length","Visualization/minnotelen",20,500,100); + api->registerOptionString("Visualization-Appearance","Background Image","Visualization/background",""); wwidth=api->getOptionInt("Visualization/wwidth"); wheight=api->getOptionInt("Visualization/wheight"); wsupersample=api->getOptionInt("Visualization/supersampling"); + wmultisample=api->getOptionInt("Visualization/multisampling"); fov=api->getOptionInt("Visualization/fov"); noteappearance=api->getOptionBool("Visualization/3dnotes"); + showpiano=api->getOptionBool("Visualization/showpiano"); + vsync=api->getOptionBool("Visualization/vsync"); + tfps=api->getOptionInt("Visualization/tfps"); viewdist=api->getOptionInt("Visualization/viewdist"); notestretch=api->getOptionInt("Visualization/notestretch"); minnotelength=api->getOptionInt("Visualization/minnotelen"); @@ -302,7 +295,7 @@ void qmpVisualization::deinit() const char* qmpVisualization::pluginGetName() {return "QMidiPlayer Default Visualization Plugin";} const char* qmpVisualization::pluginGetVersion() -{return "0.8.0";} +{return "0.8.1";} 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 ecbfd7a..6cac638 100644 --- a/visualization/qmpvisualization.hpp +++ b/visualization/qmpvisualization.hpp @@ -48,9 +48,10 @@ class qmpVisualization:public qmpPluginIntf std::stack<uint32_t> pendingt[16][128],pendingv[16][128]; SMELT *sm; SMTRG tdscn; - SMTEX chequer; + SMTEX chequer,bgtex; smTTFont font,font2; qmpVirtualPiano3D* p3d[16]; + smEntity3DBuffer* nebuf; float pos[3],rot[3],lastx,lasty; uint32_t ctc,ctk,fintk,elb; double etps; diff --git a/visualization/visualization.pro b/visualization/visualization.pro index e4588c4..af454b4 100644 --- a/visualization/visualization.pro +++ b/visualization/visualization.pro @@ -14,18 +14,22 @@ TEMPLATE = lib DEFINES += VISUALIZATION_LIBRARY SOURCES += qmpvisualization.cpp \ - extrasmeltutils.cpp \ - qmpvirtualpiano3d.cpp + extrasmeltutils.cpp \ + qmpvirtualpiano3d.cpp HEADERS += qmpvisualization.hpp \ - extrasmeltutils.hpp \ - qmpvirtualpiano3d.hpp + extrasmeltutils.hpp \ + qmpvirtualpiano3d.hpp unix { target.path = /usr/lib/qmidiplayer DATADIR = $$PREFIX/share INSTALLS += target res QMAKE_CXXFLAGS += -pthread -fPIC + QMAKE_CXXFLAGS_RELEASE -= -O2 + QMAKE_CXXFLAGS_RELEASE += -O3 + QMAKE_LFLAGS_RELEASE -= -O1 + QMAKE_LFLAGS_RELEASE += -O3 res.path = $$DATADIR/qmidiplayer/img res.files += ../img/chequerboard.png } |