aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Berger <j.david.berger@gmail.com>2018-03-08 16:19:05 -0700
committerJustin Berger <j.david.berger@gmail.com>2018-03-08 16:19:05 -0700
commit82dc5c4452e2a58667c337e967200cb7760c16cd (patch)
tree839e1d7de3c7e54dd8e91d4135b20c6e6e392c0a
parent58de3587d9e4d620daa57268cc74092120b7caac (diff)
downloadlibsurvive-82dc5c4452e2a58667c337e967200cb7760c16cd.tar.gz
libsurvive-82dc5c4452e2a58667c337e967200cb7760c16cd.tar.bz2
Added time factor to playback
-rwxr-xr-xsrc/survive_playback.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/survive_playback.c b/src/survive_playback.c
index 426a2b9..d8c6fba 100755
--- a/src/survive_playback.c
+++ b/src/survive_playback.c
@@ -1,13 +1,3 @@
-//Unofficial driver for the official Valve/HTC Vive hardware.
-//
-//Based off of https://github.com/collabora/OSVR-Vive-Libre
-// Originally Copyright 2016 Philipp Zabel
-// Originally Copyright 2016 Lubosz Sarnecki <lubosz.sarnecki@collabora.co.uk>
-// Originally Copyright (C) 2013 Fredrik Hultin
-// Originally Copyright (C) 2013 Jakob Bornecrantz
-//
-//But, re-written as best as I can to get it put under an open souce license instead of a forced-source license.
-//If there are portions of the code too similar to the original, I would like to know so they can be re-written.
//All MIT/x11 Licensed Code in this file may be relicensed freely under the GPL or LGPL licenses.
#include <survive.h>
@@ -26,6 +16,7 @@ struct SurvivePlaybackData {
FILE* playback_file;
int lineno;
+ FLT time_factor;
uint64_t next_time_us;
};
typedef struct SurvivePlaybackData SurvivePlaybackData;
@@ -128,7 +119,7 @@ static int playback_poll( struct SurviveContext * ctx, void * _driver ) {
line = 0;
}
- if(driver->next_time_us > timestamp_in_us())
+ if(driver->next_time_us * driver->time_factor > timestamp_in_us())
return 0;
driver->next_time_us = 0;
@@ -204,12 +195,14 @@ int DriverRegPlayback( SurviveContext * ctx )
"PlaybackDir", "");
if(strlen(playback_dir) == 0) {
- return 0;
-}
+ return 0;
+ }
SurvivePlaybackData * sp = calloc( 1, sizeof( SurvivePlaybackData ) );
sp->ctx = ctx;
sp->playback_dir = playback_dir;
+ sp->time_factor = config_read_float(ctx->global_config_values, "PlaybackFactor", 1.);
+
printf("%s\n", playback_dir);
char playback_file[100];