summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2013-09-15 04:05:18 +0200
committerStanislaw Halik <sthalik@misaki.pl>2013-09-15 04:05:18 +0200
commitd15a1c158d8c1ae589f18a0443defc5726190a40 (patch)
tree34f8b951f5a8560c78636541a123d89220db8ab7
parent28a6805bbc37590612836d32cc4321bd4bbd4c5d (diff)
Only use mm timers during tracking
-rw-r--r--facetracknoir/main.cpp4
-rw-r--r--facetracknoir/tracker.cpp15
2 files changed, 14 insertions, 5 deletions
diff --git a/facetracknoir/main.cpp b/facetracknoir/main.cpp
index d487de57..fbf28678 100644
--- a/facetracknoir/main.cpp
+++ b/facetracknoir/main.cpp
@@ -37,9 +37,7 @@
#endif
int main(int argc, char** argv)
{
-#if defined(_WIN32)
- (void) timeBeginPeriod(1);
-#elif defined(Q_WS_X11)
+#if defined(Q_WS_X11)
XInitThreads();
#endif
QApplication app(argc, argv);
diff --git a/facetracknoir/tracker.cpp b/facetracknoir/tracker.cpp
index 981be4b7..cff2e765 100644
--- a/facetracknoir/tracker.cpp
+++ b/facetracknoir/tracker.cpp
@@ -24,6 +24,10 @@
#include "tracker.h"
#include "facetracknoir.h"
+#if defined(_WIN32)
+# include <windows.h>
+#endif
+
/** constructor **/
Tracker::Tracker( FaceTrackNoIR *parent ) :
should_quit(false),
@@ -69,7 +73,11 @@ void Tracker::run() {
double newpose[6];
double last_post_filter[6];
- forever
+#if defined(_WIN32)
+ (void) timeBeginPeriod(1);
+#endif
+
+ for (;;)
{
if (should_quit)
break;
@@ -157,6 +165,9 @@ void Tracker::run() {
//for lower cpu load
msleep(8);
}
+#if defined(_WIN32)
+ (void) timeEndPeriod(1);
+#endif
for (int i = 0; i < 6; i++)
{
@@ -192,7 +203,7 @@ void Tracker::loadSettings() {
qDebug() << "Tracker::loadSettings says: Starting ";
QSettings settings("opentrack"); // Registry settings (in HK_USER)
- QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString();
+ QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString();
QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file)
iniFile.beginGroup("Tracking");