Fix output report so microphone does not get muted.

Related to issue #20.
This commit is contained in:
Travis Nickles 2017-05-08 03:06:06 -07:00
parent af2eb5805d
commit 907fed2f1d
2 changed files with 4 additions and 2 deletions

View File

@ -25,11 +25,11 @@ namespace DS4Windows.DS4Library
}
}
public DS4Audio()
public DS4Audio(DataFlow audioFlags = DataFlow.Render)
{
var audioEnumerator = new MMDeviceEnumeratorComObject() as IMMDeviceEnumerator;
IMMDeviceCollection audioDevices;
audioEnumerator.EnumAudioEndpoints(DataFlow.Render, DeviceState.Active, out audioDevices);
audioEnumerator.EnumAudioEndpoints(audioFlags, DeviceState.Active, out audioDevices);
int numAudioDevices;
Marshal.ThrowExceptionForHR(audioDevices.GetCount(out numAudioDevices));

View File

@ -150,6 +150,7 @@ namespace DS4Windows
private Thread ds4Input, ds4Output;
private int battery;
private DS4Audio audio = new DS4Audio();
private DS4Audio micAudio = new DS4Audio(DS4Library.CoreAudio.DataFlow.Render);
public DateTime lastActive = DateTime.UtcNow;
public DateTime firstActive = DateTime.UtcNow;
private bool charging;
@ -803,6 +804,7 @@ namespace DS4Windows
outputReportBuffer[9] = ledFlashOn; //flash on duration
outputReportBuffer[10] = ledFlashOff; //flash off duration
outputReportBuffer[19] = outputReportBuffer[20] = Convert.ToByte(audio.Volume);
outputReportBuffer[21] = Convert.ToByte(micAudio.Volume);
}
bool quitOutputThread = false;