Added time factor to playback
-//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;
@@ -210,6 +201,8 @@ int DriverRegPlayback( SurviveContext * ctx )
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];
