xrt: Add duration to xrt_output_value

The Vive Controller driver benefits from knowing the duration because
the hardware supports vibrating for a specific duration.
This commit is contained in:
Christoph Haag 2020-04-20 00:13:37 +02:00 committed by Jakob Bornecrantz
parent 88ce6b5dcc
commit 2c818d5051
2 changed files with 3 additions and 0 deletions

View file

@ -10,6 +10,7 @@
#pragma once #pragma once
#include "xrt/xrt_compiler.h" #include "xrt/xrt_compiler.h"
#include "util/u_time.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -547,6 +548,7 @@ union xrt_output_value {
{ {
float frequency; float frequency;
float amplitude; float amplitude;
time_duration_ns duration;
} vibration; } vibration;
}; };

View file

@ -1189,6 +1189,7 @@ set_source_output_vibration(struct oxr_session *sess,
union xrt_output_value value = {0}; union xrt_output_value value = {0};
value.vibration.frequency = data->frequency; value.vibration.frequency = data->frequency;
value.vibration.amplitude = data->amplitude; value.vibration.amplitude = data->amplitude;
value.vibration.duration = data->duration;
for (uint32_t i = 0; i < cache->num_outputs; i++) { for (uint32_t i = 0; i < cache->num_outputs; i++) {
struct oxr_source_output *output = &cache->outputs[i]; struct oxr_source_output *output = &cache->outputs[i];