Use audio display name if available
This commit is contained in:
parent
4ca0ad021f
commit
6aaa32cf92
@ -68,8 +68,15 @@ public class AudioHelper
|
|||||||
{
|
{
|
||||||
bestProcessMatch = audioProcess;
|
bestProcessMatch = audioProcess;
|
||||||
currentIndex = index;
|
currentIndex = index;
|
||||||
|
|
||||||
|
if(string.IsNullOrEmpty(results.DisplayName))
|
||||||
|
{
|
||||||
|
session.GetDisplayName(out var displayName);
|
||||||
|
results.DisplayName = displayName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//some apps like discord have multiple volume processes.
|
//some apps like discord have multiple volume processes.
|
||||||
//and some apps will be on multiple devices
|
//and some apps will be on multiple devices
|
||||||
//so we add all sessions so we can keep them in sync
|
//so we add all sessions so we can keep them in sync
|
||||||
|
@ -26,18 +26,22 @@ public class NameAndIconHelper
|
|||||||
var appx = AppxPackage.FromProcess(process);
|
var appx = AppxPackage.FromProcess(process);
|
||||||
if (appx == null)
|
if (appx == null)
|
||||||
{
|
{
|
||||||
//usingg process.MainModule.FileVersionInfo sometimes throws permission exceptions
|
//using process.MainModule.FileVersionInfo sometimes throws permission exceptions
|
||||||
//we get the file version info with a limited query flag to avoid that
|
//we get the file version info with a limited query flag to avoid that
|
||||||
var fileVersionInfo = GetFileVersionInfo(process);
|
var fileVersionInfo = GetFileVersionInfo(process);
|
||||||
|
|
||||||
results.DisplayName = process.MainWindowTitle;
|
//if the display name is already set, then it came from the display name of the audio session
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(results.DisplayName))
|
if (string.IsNullOrEmpty(results.DisplayName))
|
||||||
{
|
{
|
||||||
results.DisplayName = fileVersionInfo?.FileDescription;
|
results.DisplayName = process.MainWindowTitle;
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(results.DisplayName))
|
if (string.IsNullOrEmpty(results.DisplayName))
|
||||||
{
|
{
|
||||||
results.DisplayName = process.ProcessName;
|
results.DisplayName = fileVersionInfo?.FileDescription;
|
||||||
|
if (string.IsNullOrEmpty(results.DisplayName))
|
||||||
|
{
|
||||||
|
results.DisplayName = process.ProcessName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user