client: remember the last haptics amplitude to not skip stop commands
The self-assignment in the haptics handler left the stored amplitude at its initial value of 0, so the "skip redundant calls" guard was true for every amplitude-0 packet and haptic_stop() was never called. Rumbles could not be cancelled early and kept playing for their whole duration. Store the newly applied amplitude so the guard only skips stops when nothing was playing.
This commit is contained in:
@@ -79,7 +79,7 @@ void scenes::stream::operator()(to_headset::haptics && haptics)
|
||||
{
|
||||
XrAction action = it->second.action;
|
||||
float old = it->second.amplitude;
|
||||
it->second.amplitude = old;
|
||||
it->second.amplitude = haptics.amplitude;
|
||||
// Some runtimes may be slow to process actions
|
||||
// Skip it if not necessary
|
||||
if (old == 0 and haptics.amplitude == 0)
|
||||
|
||||
Reference in New Issue
Block a user