From df1ec44f1ca7f97d58421cdeecea3b64cc265def Mon Sep 17 00:00:00 2001 From: Travis Nickles Date: Wed, 16 Jan 2019 04:08:51 -0600 Subject: [PATCH] Fixed volume updating when sending timeout output reports --- DS4Windows/DS4Library/DS4Device.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/DS4Windows/DS4Library/DS4Device.cs b/DS4Windows/DS4Library/DS4Device.cs index c306481..952bf53 100644 --- a/DS4Windows/DS4Library/DS4Device.cs +++ b/DS4Windows/DS4Library/DS4Device.cs @@ -1117,6 +1117,7 @@ namespace DS4Windows lock (outReportBuffer) { bool output = outputPendCount > 0, change = force; + bool haptime = output || standbySw.ElapsedMilliseconds >= 4000L; if (usingBT) { @@ -1137,6 +1138,8 @@ namespace DS4Windows for (int i = 0, arlen = BT_OUTPUT_CHANGE_LENGTH; !change && i < arlen; i++) change = byteR[i] != byteB[i]; } + + haptime = haptime || change; } else { @@ -1157,7 +1160,8 @@ namespace DS4Windows change = byteR[i] != byteB[i]; } - if (change && audio != null) + haptime = haptime || change; + if (haptime && audio != null) { // Headphone volume levels outReportBuffer[19] = outReportBuffer[20] = @@ -1169,8 +1173,7 @@ namespace DS4Windows if (synchronous) { - output = output || standbySw.ElapsedMilliseconds >= 4000L; - if (output || change) + if (output || haptime) { if (change) { @@ -1218,8 +1221,7 @@ namespace DS4Windows //for (int i = 0, arlen = outputReport.Length; !change && i < arlen; i++) // change = outputReport[i] != outReportBuffer[i]; - output = output || standbySw.ElapsedMilliseconds >= 4000L; - if (output || change) + if (output || haptime) { if (change) {