mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-01 12:46:12 +00:00
xrt: Do not depend on util
This commit is contained in:
parent
037872e2b8
commit
38eac9dddc
|
@ -130,7 +130,7 @@ qwerty_set_output(struct xrt_device *xd, enum xrt_output_name name, union xrt_ou
|
|||
struct qwerty_device *qd = qwerty_device(xd);
|
||||
float frequency = value->vibration.frequency;
|
||||
float amplitude = value->vibration.amplitude;
|
||||
time_duration_ns duration = value->vibration.duration;
|
||||
time_duration_ns duration = value->vibration.duration_ns;
|
||||
if (amplitude || duration || frequency) {
|
||||
QWERTY_INFO(qd,
|
||||
"[%s] Haptic output: \n"
|
||||
|
|
|
@ -349,11 +349,11 @@ static int
|
|||
survive_controller_haptic_pulse(struct survive_device *survive, union xrt_output_value *value)
|
||||
{
|
||||
float duration_seconds;
|
||||
if (value->vibration.duration == XRT_MIN_HAPTIC_DURATION) {
|
||||
if (value->vibration.duration_ns == XRT_MIN_HAPTIC_DURATION) {
|
||||
SURVIVE_TRACE(survive, "Haptic pulse duration: using %f minimum", MIN_HAPTIC_DURATION);
|
||||
duration_seconds = MIN_HAPTIC_DURATION;
|
||||
} else {
|
||||
duration_seconds = time_ns_to_s(value->vibration.duration);
|
||||
duration_seconds = time_ns_to_s(value->vibration.duration_ns);
|
||||
}
|
||||
|
||||
float frequency = value->vibration.frequency;
|
||||
|
@ -366,7 +366,7 @@ survive_controller_haptic_pulse(struct survive_device *survive, union xrt_output
|
|||
float amplitude = value->vibration.amplitude;
|
||||
|
||||
SURVIVE_TRACE(survive, "Got Haptic pulse amp %f, %fHz, %" PRId64 "ns", value->vibration.amplitude,
|
||||
value->vibration.frequency, value->vibration.duration);
|
||||
value->vibration.frequency, value->vibration.duration_ns);
|
||||
SURVIVE_TRACE(survive, "Doing Haptic pulse amp %f, %fHz, %fs", amplitude, frequency, duration_seconds);
|
||||
|
||||
return survive_simple_object_haptic((struct SurviveSimpleObject *)survive->survive_obj, frequency, amplitude,
|
||||
|
|
|
@ -421,11 +421,11 @@ static int
|
|||
vive_controller_haptic_pulse(struct vive_controller_device *d, union xrt_output_value *value)
|
||||
{
|
||||
float duration_seconds;
|
||||
if (value->vibration.duration == XRT_MIN_HAPTIC_DURATION) {
|
||||
if (value->vibration.duration_ns == XRT_MIN_HAPTIC_DURATION) {
|
||||
VIVE_TRACE(d, "Haptic pulse duration: using %f minimum", MIN_HAPTIC_DURATION);
|
||||
duration_seconds = MIN_HAPTIC_DURATION;
|
||||
} else {
|
||||
duration_seconds = time_ns_to_s(value->vibration.duration);
|
||||
duration_seconds = time_ns_to_s(value->vibration.duration_ns);
|
||||
}
|
||||
|
||||
VIVE_TRACE(d, "Haptic pulse amp %f, %fHz, %fs", value->vibration.amplitude, value->vibration.frequency,
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "xrt/xrt_compiler.h"
|
||||
#include "util/u_time.h"
|
||||
|
||||
#include "xrt/xrt_results.h"
|
||||
|
||||
|
@ -1052,7 +1051,7 @@ union xrt_output_value {
|
|||
{
|
||||
float frequency;
|
||||
float amplitude;
|
||||
time_duration_ns duration;
|
||||
int64_t duration_ns;
|
||||
} vibration;
|
||||
};
|
||||
|
||||
|
|
|
@ -1774,7 +1774,7 @@ set_action_output_vibration(struct oxr_session *sess,
|
|||
union xrt_output_value value = {0};
|
||||
value.vibration.frequency = data->frequency;
|
||||
value.vibration.amplitude = data->amplitude;
|
||||
value.vibration.duration = data->duration;
|
||||
value.vibration.duration_ns = data->duration;
|
||||
|
||||
for (uint32_t i = 0; i < cache->output_count; i++) {
|
||||
struct oxr_action_output *output = &cache->outputs[i];
|
||||
|
|
|
@ -1237,9 +1237,9 @@ CServerDriver_Monado::HandleHapticEvent(vr::VREvent_t *event)
|
|||
union xrt_output_value out;
|
||||
out.vibration.amplitude = amp;
|
||||
if (duration > 0.00001) {
|
||||
out.vibration.duration = (time_duration_ns)(duration * 1000.f * 1000.f * 1000.f);
|
||||
out.vibration.duration_ns = (time_duration_ns)(duration * 1000.f * 1000.f * 1000.f);
|
||||
} else {
|
||||
out.vibration.duration = XRT_MIN_HAPTIC_DURATION;
|
||||
out.vibration.duration_ns = XRT_MIN_HAPTIC_DURATION;
|
||||
}
|
||||
out.vibration.frequency = freq;
|
||||
|
||||
|
|
Loading…
Reference in a new issue