Use getter instead of property to grab volume levels

This commit is contained in:
Travis Nickles 2017-05-08 03:07:58 -07:00
parent 907fed2f1d
commit c3fcfbfddf
2 changed files with 12 additions and 2 deletions

View File

@ -25,6 +25,16 @@ namespace DS4Windows.DS4Library
} }
} }
public uint getVolume()
{
float pfLevel = 0;
if (endpointVolume != null)
endpointVolume.GetMasterVolumeLevelScalar(out pfLevel);
return Convert.ToUInt32(pfLevel * 100);
}
public DS4Audio(DataFlow audioFlags = DataFlow.Render) public DS4Audio(DataFlow audioFlags = DataFlow.Render)
{ {
var audioEnumerator = new MMDeviceEnumeratorComObject() as IMMDeviceEnumerator; var audioEnumerator = new MMDeviceEnumeratorComObject() as IMMDeviceEnumerator;

View File

@ -803,8 +803,8 @@ namespace DS4Windows
outputReportBuffer[8] = LightBarColor.blue; //blue outputReportBuffer[8] = LightBarColor.blue; //blue
outputReportBuffer[9] = ledFlashOn; //flash on duration outputReportBuffer[9] = ledFlashOn; //flash on duration
outputReportBuffer[10] = ledFlashOff; //flash off duration outputReportBuffer[10] = ledFlashOff; //flash off duration
outputReportBuffer[19] = outputReportBuffer[20] = Convert.ToByte(audio.Volume); outputReportBuffer[19] = outputReportBuffer[20] = Convert.ToByte(audio.getVolume());
outputReportBuffer[21] = Convert.ToByte(micAudio.Volume); outputReportBuffer[21] = Convert.ToByte(micAudio.getVolume());
} }
bool quitOutputThread = false; bool quitOutputThread = false;