Use different volume scale for mic volume

Not exact but it is fairly close
This commit is contained in:
Travis Nickles 2020-03-22 16:58:04 -05:00
parent cb2b27e868
commit 81d2d1899b
2 changed files with 9 additions and 2 deletions

View File

@ -26,13 +26,19 @@ namespace DS4Windows.DS4Library
return vol; return vol;
} }
private DataFlow instAudioFlags = DataFlow.Render;
public void RefreshVolume() public void RefreshVolume()
{ {
float pfLevel = 0; float pfLevel = 0;
if (endpointVolume != null) if (endpointVolume != null)
endpointVolume.GetMasterVolumeLevelScalar(out pfLevel); endpointVolume.GetMasterVolumeLevelScalar(out pfLevel);
if (instAudioFlags == DataFlow.Render)
vol = Convert.ToUInt32((75 - 20) * (--pfLevel * pfLevel * pfLevel + 1) + 20); vol = Convert.ToUInt32((75 - 20) * (--pfLevel * pfLevel * pfLevel + 1) + 20);
else if (instAudioFlags == DataFlow.Capture)
vol = Convert.ToUInt32((60 - 0) * pfLevel + 0);
} }
public void OnNotify(IntPtr pNotify) public void OnNotify(IntPtr pNotify)
@ -60,6 +66,7 @@ namespace DS4Windows.DS4Library
{ {
object interfacePointer; object interfacePointer;
Marshal.ThrowExceptionForHR(audioDevice.Activate(ref IID_IAudioEndpointVolume, ClsCtx.ALL, IntPtr.Zero, out interfacePointer)); Marshal.ThrowExceptionForHR(audioDevice.Activate(ref IID_IAudioEndpointVolume, ClsCtx.ALL, IntPtr.Zero, out interfacePointer));
instAudioFlags = audioFlags;
endpointVolume = interfacePointer as IAudioEndpointVolume; endpointVolume = interfacePointer as IAudioEndpointVolume;
endpointVolume.RegisterControlChangeNotify(this); endpointVolume.RegisterControlChangeNotify(this);
} }

View File

@ -4,7 +4,7 @@
* Add cross dead zone (per axis) for sticks * Add cross dead zone (per axis) for sticks
* Abstract output slots * Abstract output slots
* Abstract KB+M codes to allow different event systems (Vmulti) * Abstract KB+M codes to allow different event systems (Vmulti)
* Add volume scale to mic volume. Mic volume too loud otherwise * ~~Add volume scale to mic volume. Mic volume too loud otherwise~~
* Check Toggle action label in old WinForms build * Check Toggle action label in old WinForms build
* Look into adding JSON package * Look into adding JSON package
* Check if unhandled exception logging for threads is needed * Check if unhandled exception logging for threads is needed