aboutsummaryrefslogtreecommitdiff
path: root/visualization
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2020-02-15 09:45:38 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2020-02-15 09:45:38 +0800
commit03d0aa4f39f72d27fed75020d2a3e80413ae029a (patch)
tree4da998bf1df1a2c1463858d13e372d6fb0bbbff4 /visualization
parentbaa48d526c96a55c7c8caeb8fc5e379ef8afed10 (diff)
downloadQMidiPlayer-03d0aa4f39f72d27fed75020d2a3e80413ae029a.tar.xz
No more version numbers scattered through the files.
Added a debug screen for the visualization, which can be toggled by pressing B. Added version information for binaries for Windows.
Diffstat (limited to 'visualization')
-rw-r--r--visualization/CMakeLists.txt4
m---------visualization/SMELT0
-rw-r--r--visualization/qmpvisualization.cpp30
-rw-r--r--visualization/qmpvisualization.hpp2
-rw-r--r--visualization/visualization.rc16
5 files changed, 49 insertions, 3 deletions
diff --git a/visualization/CMakeLists.txt b/visualization/CMakeLists.txt
index 426f50c..bc7d568 100644
--- a/visualization/CMakeLists.txt
+++ b/visualization/CMakeLists.txt
@@ -7,6 +7,10 @@ set(visualization_SOURCES
qmpvisualization.cpp
)
+if(WIN32)
+ list(APPEND visualization_SOURCES visualization.rc)
+endif(WIN32)
+
set(BUILD_DUMB ON)
set(BUILD_EXAMPLE OFF)
add_subdirectory(SMELT)
diff --git a/visualization/SMELT b/visualization/SMELT
-Subproject 7398bdc3eb0f58cdfa9b588e1c6c8e5ef3797ac
+Subproject b47fce544c1c5ec98b326f69b56c916ba5be1c6
diff --git a/visualization/qmpvisualization.cpp b/visualization/qmpvisualization.cpp
index a3f9554..899597a 100644
--- a/visualization/qmpvisualization.cpp
+++ b/visualization/qmpvisualization.cpp
@@ -137,6 +137,7 @@ void qmpVisualization::showThread()
pos[0]=0;pos[1]=120;pos[2]=70;
rot[0]=0;rot[1]=75;rot[2]=90;
}
+ debug=false;
ctk=api->getCurrentTimeStamp();
if(savevp)
{
@@ -624,6 +625,8 @@ bool qmpVisualization::update()
api->playerSeek(api->getCurrentPlaybackPercentage()+(sm->smGetKeyState(SMK_SHIFT)?5:1));
if(sm->smGetKeyState(SMK_LEFT)==SMKST_HIT)
api->playerSeek(api->getCurrentPlaybackPercentage()-(sm->smGetKeyState(SMK_SHIFT)?5:1));
+ if(sm->smGetKeyState(SMK_B)==SMKST_HIT)
+ debug^=1;
if(playing)ctk+=1e6/api->getRawTempo()*api->getDivision()*sm->smGetDelta();
if(!flat)
updateVisualization3D();
@@ -658,7 +661,10 @@ bool qmpVisualization::update()
if(osdpos==4){sm->smRenderEnd();return shouldclose;}
int t,r;t=api->getKeySig();r=(int8_t)((t>>8)&0xFF)+7;t&=0xFF;
std::wstring ts(t?minors:majors);ts=ts.substr(2*r,2);
- int step=int(1.25*fontsize),xp=(osdpos&1)?wwidth-step-1:1,yp=osdpos<2?wheight-step*5-4:step+4,align=osdpos&1?ALIGN_RIGHT:ALIGN_LEFT;
+ int step=int(1.33*fontsize);
+ int xp=(osdpos&1)?wwidth-step-1:1;
+ int yp=osdpos<2?wheight-step*5-4:step+4;
+ int align=osdpos&1?ALIGN_RIGHT:ALIGN_LEFT;
font2.updateString(L"Title: %ls",api->getWTitle().c_str());
font2.render(xp,yp,0.5,0xFFFFFFFF,align);
font2.render(xp-1,yp-1,0.5,0xFF000000,align);
@@ -677,6 +683,26 @@ bool qmpVisualization::update()
font.updateString(L"FPS: %.2f",sm->smGetFPS());
font.render(xp,yp+=step,0.5,0xFFFFFFFF,align);
font.render(xp-1,yp-1,0.5,0xFF000000,align);
+ if(debug)
+ {
+ int dosdpos=(osdpos+1)%4;
+ xp=(dosdpos&1)?wwidth-step-1:1;
+ yp=dosdpos<2?wheight-step*5-4:step+4;
+ align=dosdpos&1?ALIGN_RIGHT:ALIGN_LEFT;
+ std::string tstr;
+ tstr=std::string(sm->smGetOSInfo());
+ font.updateString(L"OS: %ls",std::wstring({std::begin(tstr),std::end(tstr)}).c_str());
+ font.render(xp,yp,0.5,0xFFFFFFFF,align);
+ font.render(xp-1,yp-1,0.5,0xFF000000,align);
+ tstr=std::string(sm->smGetCPUModel());
+ font.updateString(L"CPU: %ls",std::wstring({std::begin(tstr),std::end(tstr)}).c_str());
+ font.render(xp,yp+=step,0.5,0xFFFFFFFF,align);
+ font.render(xp-1,yp-1,0.5,0xFF000000,align);
+ tstr=std::string(sm->smGetDispDriver());
+ font.updateString(L"Display: %ls",std::wstring({std::begin(tstr),std::end(tstr)}).c_str());
+ font.render(xp,yp+=3*step,0.5,0xFFFFFFFF,align);
+ font.render(xp-1,yp-1,0.5,0xFF000000,align);
+ }
sm->smRenderEnd();
return shouldclose;
}
@@ -845,7 +871,7 @@ void qmpVisualization::deinit()
const char* qmpVisualization::pluginGetName()
{return "QMidiPlayer Default Visualization Plugin";}
const char* qmpVisualization::pluginGetVersion()
-{return "0.8.7";}
+{return PLUGIN_VERSION;}
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 4aaeb0c..981ebe3 100644
--- a/visualization/qmpvisualization.hpp
+++ b/visualization/qmpvisualization.hpp
@@ -38,7 +38,7 @@ class qmpVisualization:public qmpPluginIntf,public qmpFuncBaseIntf
float pos[3],rot[3],lastx,lasty;
uint32_t ctc,ctk,elb;
double etps;
- bool shouldclose,playing;
+ bool shouldclose,playing,debug;
int herh,heh,hfrf;
int uihb,uihs,uihp,uihr;
std::vector<std::pair<uint32_t,uint32_t>>tspool;
diff --git a/visualization/visualization.rc b/visualization/visualization.rc
new file mode 100644
index 0000000..d5b47db
--- /dev/null
+++ b/visualization/visualization.rc
@@ -0,0 +1,16 @@
+1 VERSIONINFO
+FILEVERSION RC_VER_MAJOR,RC_VER_MINOR,RC_VER_PATCH,0
+PRODUCTVERSION RC_VER_MAJOR,RC_VER_MINOR,RC_VER_PATCH,0
+FILETYPE VFT_DLL
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904E4""
+ BEGIN
+ VALUE "FileDescription", "QMidiPlayer visualization plugin"
+ VALUE "FileVersion", APP_VERSION
+ VALUE "ProductName", "QMidiPlayer visualization plugin"
+ VALUE "ProductVersion", APP_VERSION
+ END
+ END
+END