From 82dc5c4452e2a58667c337e967200cb7760c16cd Mon Sep 17 00:00:00 2001 From: Justin Berger Date: Thu, 8 Mar 2018 16:19:05 -0700 Subject: Added time factor to playback --- src/survive_playback.c | 19 ++++++------------- 1 file 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 -// 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 @@ -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]; -- cgit v1.2.3