mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-21 03:16:54 +02:00
a22a9d9348
* audio: play DualSense haptics from vibration audio ports Games drive the DualSense's actuators through a vibration audio port, one channel per actuator. These ports had no device, so their samples were dropped. Over USB the DualSense is a 4-channel audio device whose back channels feed the actuators; play the port's samples there through SDL. The device is looked up while the port plays, so the controller can be connected at any time. The queue keeps about the latency of the regular audio path, with the playback rate nudged by up to 3% when the port is fed off real time. While haptic audio plays, hold a DualSense's rumble at zero: SDL disables audio haptics whenever rumble is non-zero. Add pad_haptics tests for the sample conversion, device-name matching and rate correction. * Simplify DualSense audio haptics and restore idle rumble --------- Co-authored-by: nmzik <Nmzik@mail.ru>
21 lines
686 B
C++
21 lines
686 B
C++
#ifndef EMULATOR_INCLUDE_EMULATOR_DUALSENSE_HAPTICS_H_
|
|
#define EMULATOR_INCLUDE_EMULATOR_DUALSENSE_HAPTICS_H_
|
|
|
|
#include <cstdint>
|
|
|
|
namespace Libs::Controller::DualSenseHaptics {
|
|
|
|
struct Stream;
|
|
|
|
Stream* Open(uint32_t freq);
|
|
void Close(Stream* stream);
|
|
void Queue(Stream* stream, int controller, const void* data, uint32_t frames, uint32_t channels,
|
|
bool is_float, const int* volume);
|
|
// Returns false for other gamepad types, which retain the normal rumble path.
|
|
bool SetVibration(int controller, uint8_t large_motor, uint8_t small_motor);
|
|
void Shutdown();
|
|
|
|
} // namespace Libs::Controller::DualSenseHaptics
|
|
|
|
#endif // EMULATOR_INCLUDE_EMULATOR_DUALSENSE_HAPTICS_H_
|