mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-11-26 19:14:20 +01:00
Trim USB output report generation. Only grab audio volume when output report data changes.
Possibly related to issue #261
This commit is contained in:
parent
ee9049f8d2
commit
bfdb81edd0
@ -1115,6 +1115,8 @@ namespace DS4Windows
|
|||||||
|
|
||||||
lock (outReportBuffer)
|
lock (outReportBuffer)
|
||||||
{
|
{
|
||||||
|
bool output = outputPendCount > 0, change = false;
|
||||||
|
|
||||||
if (usingBT)
|
if (usingBT)
|
||||||
{
|
{
|
||||||
outReportBuffer[0] = 0x11;
|
outReportBuffer[0] = 0x11;
|
||||||
@ -1128,6 +1130,12 @@ namespace DS4Windows
|
|||||||
outReportBuffer[10] = ligtBarColor.blue; // blue
|
outReportBuffer[10] = ligtBarColor.blue; // blue
|
||||||
outReportBuffer[11] = ledFlashOn; // flash on duration
|
outReportBuffer[11] = ledFlashOn; // flash on duration
|
||||||
outReportBuffer[12] = ledFlashOff; // flash off duration
|
outReportBuffer[12] = ledFlashOff; // flash off duration
|
||||||
|
|
||||||
|
fixed (byte* byteR = outputReport, byteB = outReportBuffer)
|
||||||
|
{
|
||||||
|
for (int i = 0, arlen = 13; !change && i < arlen; i++)
|
||||||
|
change = byteR[i] != byteB[i];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1141,7 +1149,14 @@ namespace DS4Windows
|
|||||||
outReportBuffer[8] = ligtBarColor.blue; // blue
|
outReportBuffer[8] = ligtBarColor.blue; // blue
|
||||||
outReportBuffer[9] = ledFlashOn; // flash on duration
|
outReportBuffer[9] = ledFlashOn; // flash on duration
|
||||||
outReportBuffer[10] = ledFlashOff; // flash off duration
|
outReportBuffer[10] = ledFlashOff; // flash off duration
|
||||||
if (audio != null)
|
|
||||||
|
fixed (byte* byteR = outputReport, byteB = outReportBuffer)
|
||||||
|
{
|
||||||
|
for (int i = 0, arlen = 11; !change && i < arlen; i++)
|
||||||
|
change = byteR[i] != byteB[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (change && audio != null)
|
||||||
{
|
{
|
||||||
// Headphone volume levels
|
// Headphone volume levels
|
||||||
outReportBuffer[19] = outReportBuffer[20] =
|
outReportBuffer[19] = outReportBuffer[20] =
|
||||||
@ -1156,6 +1171,8 @@ namespace DS4Windows
|
|||||||
outputRumble = false;
|
outputRumble = false;
|
||||||
outputPendCount = 3;
|
outputPendCount = 3;
|
||||||
|
|
||||||
|
if (change)
|
||||||
|
{
|
||||||
if (usingBT)
|
if (usingBT)
|
||||||
{
|
{
|
||||||
Monitor.Enter(outputReport);
|
Monitor.Enter(outputReport);
|
||||||
@ -1177,15 +1194,9 @@ namespace DS4Windows
|
|||||||
Monitor.Exit(outputReport);
|
Monitor.Exit(outputReport);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bool output = outputPendCount > 0, change = false;
|
|
||||||
fixed (byte* byteR = outputReport, byteB = outReportBuffer)
|
|
||||||
{
|
|
||||||
for (int i = 0, arlen = outputReport.Length; !change && i < arlen; i++)
|
|
||||||
change = byteR[i] != byteB[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
//for (int i = 0, arlen = outputReport.Length; !change && i < arlen; i++)
|
//for (int i = 0, arlen = outputReport.Length; !change && i < arlen; i++)
|
||||||
// change = outputReport[i] != outReportBuffer[i];
|
// change = outputReport[i] != outReportBuffer[i];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user