2022-12-03 17:49:23 +01:00
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Configuration;
|
|
|
|
|
|
|
|
|
|
namespace SteamController.ProfilesSettings
|
|
|
|
|
{
|
2023-09-24 16:17:49 +02:00
|
|
|
[Category("3. Haptic")]
|
2023-02-10 11:05:23 +01:00
|
|
|
internal sealed class HapticSettings : CommonHelpers.BaseSettings
|
2022-12-03 17:49:23 +01:00
|
|
|
{
|
|
|
|
|
public const sbyte MinIntensity = -2;
|
|
|
|
|
public const sbyte MaxIntensity = 10;
|
|
|
|
|
|
2023-02-10 11:05:23 +01:00
|
|
|
public static HapticSettings X360 = new HapticSettings("X360HapticSettings");
|
|
|
|
|
public static HapticSettings DS4 = new HapticSettings("DS4HapticSettings");
|
2022-12-03 17:49:23 +01:00
|
|
|
|
2023-02-10 11:05:23 +01:00
|
|
|
public HapticSettings(string name) : base(name)
|
2022-12-03 17:49:23 +01:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2023-02-10 11:05:23 +01:00
|
|
|
public static bool GetHapticIntensity(byte? input, sbyte maxIntensity, out sbyte output)
|
|
|
|
|
{
|
|
|
|
|
output = default;
|
|
|
|
|
if (input is null || input.Value == 0)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
int value = MinIntensity + (maxIntensity - MinIntensity) * input.Value / 255;
|
|
|
|
|
output = (sbyte)value;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-05 18:35:25 +01:00
|
|
|
public Devices.SteamController.HapticStyle HapticStyle
|
|
|
|
|
{
|
2022-12-08 10:24:40 +01:00
|
|
|
get { return Get<Devices.SteamController.HapticStyle>("HapticStyle", Devices.SteamController.HapticStyle.Weak); }
|
|
|
|
|
set { Set("HapticStyle", value); }
|
2022-12-05 18:35:25 +01:00
|
|
|
}
|
|
|
|
|
|
2022-12-03 17:49:23 +01:00
|
|
|
[Description("Haptic intensity between -2dB and 10dB")]
|
|
|
|
|
public sbyte LeftIntensity
|
|
|
|
|
{
|
2022-12-08 10:24:40 +01:00
|
|
|
get { return Get<sbyte>("LeftIntensity", 2); }
|
|
|
|
|
set { Set("LeftIntensity", Math.Clamp(value, MinIntensity, MaxIntensity)); }
|
2022-12-03 17:49:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Description("Haptic intensity between -2dB and 10dB")]
|
|
|
|
|
public sbyte RightIntensity
|
|
|
|
|
{
|
2022-12-08 10:24:40 +01:00
|
|
|
get { return Get<sbyte>("RightIntensity", 2); }
|
|
|
|
|
set { Set("RightIntensity", Math.Clamp(value, MinIntensity, MaxIntensity)); }
|
2022-12-03 17:49:23 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|