From b5c46b1fb36dbc398c6b059c18bf7555fefc1d50 Mon Sep 17 00:00:00 2001 From: Travis Nickles Date: Wed, 25 Mar 2020 18:05:52 -0500 Subject: [PATCH] Experiments with new headphone volume scale --- DS4Windows/DS4Library/DS4Audio.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/DS4Windows/DS4Library/DS4Audio.cs b/DS4Windows/DS4Library/DS4Audio.cs index f54e043..000e868 100644 --- a/DS4Windows/DS4Library/DS4Audio.cs +++ b/DS4Windows/DS4Library/DS4Audio.cs @@ -30,13 +30,21 @@ namespace DS4Windows.DS4Library public void RefreshVolume() { + const float HALFPI = (float)Math.PI / 2.0f; float pfLevel = 0; if (endpointVolume != null) endpointVolume.GetMasterVolumeLevelScalar(out pfLevel); if (instAudioFlags == DataFlow.Render) - vol = Convert.ToUInt32((75 - 20) * (--pfLevel * pfLevel * pfLevel + 1) + 20); + // Use QuadraticEaseOut curve for headphone volume level + //vol = pfLevel != 0.0 ? Convert.ToUInt32((80 - 30) * -(pfLevel * (pfLevel - 2.0)) + 30) : 0; + // Use SineEaseOut curve for headphone volume level + vol = pfLevel != 0.0 ? Convert.ToUInt32((80 - 30) * Math.Sin(pfLevel * HALFPI) + 30) : 0; + // Use CubicEaseOut curve for headphone volume level + //vol = pfLevel != 0.0 ? Convert.ToUInt32((80 - 30) * (--pfLevel * pfLevel * pfLevel + 1) + 30) : 0; + // Use Linear curve for headphone volume level + //vol = pfLevel != 0.0 ? Convert.ToUInt32((80 - 30) * pfLevel + 30) : 0; else if (instAudioFlags == DataFlow.Capture) vol = Convert.ToUInt32((60 - 0) * pfLevel + 0); }