From 4674800f32acfe2c8ffd04215a51dea8b9380396 Mon Sep 17 00:00:00 2001
From: Chris Xiong <chirs241097@gmail.com>
Date: Fri, 27 May 2016 23:59:07 +0800
Subject: Compute coordinates of pitch-bent notes more precisely. Also load
 resources from system-wide folder.

---
 ChangeLog                               |  4 ++++
 doc/miscellaneous.html                  | 14 +++++++++++++-
 qmidiplayer-desktop/qmppresetselect.cpp |  2 ++
 visualization/qmpvisualization.cpp      | 26 ++++++++++++++++++--------
 4 files changed, 37 insertions(+), 9 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index bd1d4f9..5c7849f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2016-05-27 0.8.1 alpha
+Compute coordinates of pitch-bent notes more precisely.
+Also load resources from system-wide folder.
+
 2016-05-26 0.8.1 alpha
 Keyboard for 2D visualization.
 
diff --git a/doc/miscellaneous.html b/doc/miscellaneous.html
index d628b2c..ff496fa 100644
--- a/doc/miscellaneous.html
+++ b/doc/miscellaneous.html
@@ -63,6 +63,18 @@
 		Please use the <a href="https://github.com/chirs241097/QMidiPlayer/issues">
 		github issue tracker</a>. Don't forget to check if the bug has already been
 		fixed in a newer version!
+		</p>
+		<h4>3. On which platform(s) do you develop this project?</h4>
+		<p>
+		Major platforms used:
+        <ul>
+            <li>Debian GNU/Linux unstable(sid) amd64 on a Lenovo ideapad Y570 (i7-2960XM, 16GB RAM, HD3000/GT555M)</li>
+            <li>Arch Linux amd64 on a Lenovo ThinkPad X1 yoga 1st Gen. (i7-6600U, 16GB RAM, HD520)</li>
+        </ul>
+        Platforms for building the Windows version:
+        <ul>
+            <li>Windows 10 Pro on the ThinkPad X1 yoga mentioned above.</li>
+        </ul>
 		</p>
 		<h3 id="contact">Contact the author</h3>
 		<p>
@@ -71,4 +83,4 @@
 		</p>
 	</div>
 </body>
-</html>
\ No newline at end of file
+</html>
diff --git a/qmidiplayer-desktop/qmppresetselect.cpp b/qmidiplayer-desktop/qmppresetselect.cpp
index 2edb522..4c9148c 100644
--- a/qmidiplayer-desktop/qmppresetselect.cpp
+++ b/qmidiplayer-desktop/qmppresetselect.cpp
@@ -8,6 +8,8 @@ qmpPresetSelector::qmpPresetSelector(QWidget *parent) :
 	ui(new Ui::qmpPresetSelector)
 {
 	ui->setupUi(this);
+	int w=size().width(),h=size().height();w=w*(logicalDpiX()/96.);h=h*(logicalDpiY()/96.);
+	setMaximumWidth(w);setMaximumHeight(h);setMinimumWidth(w);setMinimumHeight(h);
 }
 
 qmpPresetSelector::~qmpPresetSelector()
diff --git a/visualization/qmpvisualization.cpp b/visualization/qmpvisualization.cpp
index 9e4abe8..c166543 100644
--- a/visualization/qmpvisualization.cpp
+++ b/visualization/qmpvisualization.cpp
@@ -9,11 +9,11 @@ int viewdist=100;
 int notestretch=100;//length of quarter note
 int minnotelength=100;
 int noteappearance=1,showpiano=1,stairpiano=1,savevp=1,showlabel=1;
-int wwidth=800,wheight=600,wsupersample=1,wmultisample=1,showparticle=1;
+int wwidth=800,wheight=600,wsupersample=1,wmultisample=0,showparticle=1;
 int horizontal=1,flat=0;
 int fov=60,vsync=1,tfps=60;
 DWORD chkrtint=0xFF999999;
-double fpoffsets[]={0,18,28,50,55,82,98,109,130,137,161,164,191};
+double fpoffsets[]={1,18,28,50,55,82,98,109,130,137,161,164,191};
 double froffsets[]={0,18,33,50,65,82,98,113,130,145,161,176,191};
 DWORD iccolors[]={0XFFFF0000,0XFFFF8000,0XFFFFBF00,0XFFFFFF00,
 				  0XFFBFFF00,0XFF80FF00,0XFF00FF00,0XFF00FFBF,
@@ -79,8 +79,10 @@ void qmpVisualization::showThread()
 	sm->smTextureOpt(TPOT_POT,TFLT_LINEAR);
 	chequer=sm->smTextureLoad("chequerboard.png");if(!chequer)
 	chequer=sm->smTextureLoad("/usr/share/qmidiplayer/img/chequerboard.png");
-	pianotex=sm->smTextureLoad("kb_128.png");
-	particletex=sm->smTextureLoad("particle.png");
+	pianotex=sm->smTextureLoad("kb_128.png");if(!pianotex)
+	pianotex=sm->smTextureLoad("/usr/share/qmidiplayer/img/kb_128.png");
+	particletex=sm->smTextureLoad("particle.png");if(!particletex)
+	particletex=sm->smTextureLoad("/usr/share/qmidiplayer/img/particle.png");
 	bgtex=sm->smTextureLoad(api->getOptionString("Visualization/background").c_str());
 	if(showparticle&&!horizontal)
 	{
@@ -363,8 +365,12 @@ bool qmpVisualization::update()
 					smvec2d a((froffsets[12]*(pool[i]->key/12)+froffsets[pool[i]->key%12])*wwidth/2048.,((double)pool[i]->tce-ctk)*lpt+wheight-nh);
 					smvec2d b(a.x+notew*0.9,((double)pool[i]->tcs-ctk)*lpt+wheight-nh);
 					bool isnoteon=pool[i]->tcs<=ctk&&pool[i]->tce>=ctk;if(isnoteon)
-					a.x+=notew*api->getPitchBend(pool[i]->ch),
-					b.x+=notew*api->getPitchBend(pool[i]->ch);
+					{
+						uint32_t newkey=pool[i]->key+(int)floor(api->getPitchBend(pool[i]->ch));
+						double fpb=api->getPitchBend(pool[i]->ch)-floor(api->getPitchBend(pool[i]->ch));
+						a.x=(froffsets[12]*(newkey/12)+froffsets[newkey%12])*wwidth/2048.+notew*fpb;
+						b.x=a.x+notew*0.9;
+					}
 					notestatus[pool[i]->ch][pool[i]->key]|=isnoteon;
 					if(((double)pool[i]->tcs-pool[i]->tce)*lpt<minnotelength*0.04)
 					a.y=((double)pool[i]->tcs-ctk)*lpt+wheight-nh-minnotelength*0.04;
@@ -449,8 +455,12 @@ bool qmpVisualization::update()
 					smvec2d a(((double)pool[i]->tce-ctk)*lpt+nh,(froffsets[12]*(pool[i]->key/12)+froffsets[pool[i]->key%12])*wheight/2048.);
 					smvec2d b(((double)pool[i]->tcs-ctk)*lpt+nh,a.y+notew*0.9);
 					bool isnoteon=pool[i]->tcs<=ctk&&pool[i]->tce>=ctk;if(isnoteon)
-					a.y+=notew*api->getPitchBend(pool[i]->ch),
-					b.y+=notew*api->getPitchBend(pool[i]->ch);
+					{
+						uint32_t newkey=pool[i]->key+(int)floor(api->getPitchBend(pool[i]->ch));
+						double fpb=api->getPitchBend(pool[i]->ch)-floor(api->getPitchBend(pool[i]->ch));
+						a.y=(froffsets[12]*(newkey/12)+froffsets[newkey%12])*wheight/2048.+notew*fpb;
+						b.y=a.y+notew*0.9;
+					}
 					a.y=wheight-a.y;b.y=wheight-b.y;
 					notestatus[pool[i]->ch][pool[i]->key]|=isnoteon;
 					if(((double)pool[i]->tce-pool[i]->tcs)*lpt<minnotelength*0.04)
-- 
cgit v1.2.3