Wujek_Dualsense_API 1.0.4

There is a newer version of this package available.
See the version list below for details.
dotnet add package Wujek_Dualsense_API --version 1.0.4
NuGet\Install-Package Wujek_Dualsense_API -Version 1.0.4
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Wujek_Dualsense_API" Version="1.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Wujek_Dualsense_API --version 1.0.4
#r "nuget: Wujek_Dualsense_API, 1.0.4"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Wujek_Dualsense_API as a Cake Addin
#addin nuget:?package=Wujek_Dualsense_API&version=1.0.4

// Install Wujek_Dualsense_API as a Cake Tool
#tool nuget:?package=Wujek_Dualsense_API&version=1.0.4

Wujek Dualsense API

Wujek Dualsense API is a .NET library designed to interface with the PlayStation DualSense controller, providing functionalities to control its various features such as haptic feedback, LEDs, triggers, and more.

https://www.nuget.org/packages/Wujek_Dualsense_API

Features

  • Initialize and manage DualSense controllers via USB or Bluetooth
  • Control haptic feedback and rumble
  • Set lightbar colors and player LEDs
  • Adjust microphone and speaker volumes
  • Access button states and sensor data (gyroscope, accelerometer)
  • Play audio haptics from WAV files

Getting Started

Installation

Add the library to your project by including the Wujek_Dualsense_API namespace:

using Wujek_Dualsense_API;

Usage

To start using the DualSense controller, create an instance of the Dualsense class, specifying the controller number (e.g., 0 for the first controller):

Dualsense dualsense = new Dualsense(0);

Examples

dualsense.Start(); // Start listening
dualsense.SetLightbar(0, 0, 255); // R G B
dualsense.SetPlayerLED(LED.PlayerLED.PLAYER_1); // The white LEDs below the touchpad
dualsense.SetMicrophoneLED(LED.MicrophoneLED.OFF); // Microphone LED
dualsense.SetMicrophoneVolume(100); // Microphone Volume
dualsense.SetSpeakerVolume(100); // Speaker Volume
dualsense.SetLeftTrigger(TriggerType.TriggerModes.Pulse_AB, 93, 84, 0, 255, 255, 0, 0); // Example adaptive trigger
dualsense.SetRightTrigger(TriggerType.TriggerModes.Pulse_B, 14, 255, 0, 14, 255, 0, 0); // Example adaptive trigger
dualsense.SetVibrationType(Vibrations.VibrationType.Standard_Rumble); // Use standard rumble (Controller audio won't work with this option)
dualsense.SetStandardRumble(100, 255); // Start vibrations

Console.ReadLine();

dualsense.Dispose() // Disconnects from the controller and resets any applied settings

Haptic Feedback example

To play correctly, the WAV file must be a Stereo 48KHz Linear PCM 32Bit sound

dualsense.Start(); // Start listening
dualsense.SetVibrationType(Vibrations.VibrationType.Haptic_Feedback); // Use haptic feedback and audio
dualsense.PlayHaptics("player_collar_beep_end_0.wav", 1.0f, 1.0f, 1.0f, true); // (WAV file location, speaker volume, left acustor volume, right acustor volume, cancel previous sounds)

Console.ReadLine();

dualsense.Dispose() // Disconnects from the controller and resets any applied settings
Product Compatible and additional computed target framework versions.
.NET net8.0-windows10.0.22621 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.6 42 6/22/2024
1.0.5 46 6/20/2024
1.0.4 76 6/15/2024
1.0.3 77 6/15/2024
1.0.2 72 6/14/2024
1.0.1 72 6/14/2024
1.0.0 72 6/14/2024