Skip to content

Commit

Permalink
fix(AudioSwitcher): Fix switching audio device on Windows 11 with "Al…
Browse files Browse the repository at this point in the history
…so foreground app"

Add missing methods for CSWinRT to be able to interact with the AudioPolicyClient

Fixes #802
  • Loading branch information
Belphemur committed Oct 25, 2021
1 parent bbc1cb9 commit ed6b92a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
Expand Up @@ -9,16 +9,20 @@ internal static class AudioPolicyConfigFactory

public static IAudioPolicyConfig Create()
{
if (Environment.OSVersion.Version.Major < 10)
return Com.Threading.ComThread.Invoke<IAudioPolicyConfig>(() =>
{
return new UnsupportedAudioPolicyConfig();
}
if (Environment.OSVersion.Version.Build >= OS_21H2_VERSION)
{
return new Post21H2AudioPolicyConfig();
}
if (Environment.OSVersion.Version.Major < 10)
{
return new UnsupportedAudioPolicyConfig();
}
if (Environment.OSVersion.Version.Build >= OS_21H2_VERSION)
{
return new Post21H2AudioPolicyConfig();
}
return new Pre21H2AudioPolicyConfig();
return new Pre21H2AudioPolicyConfig();
});
}
}
}
Expand Up @@ -10,6 +10,10 @@ namespace SoundSwitch.Audio.Manager.Interop.Interface.Policy.Extended
[ComImport]
public interface IAudioPolicyConfigFactoryVariant21H2Windows11
{
void GetIids(out int iidCount, out IntPtr iids);
void GetRuntimeClassName(out IntPtr className);
void GetTrustLevel(out WinRT.TrustLevel trustLevel);

int __incomplete__add_CtxVolumeChange();
int __incomplete__remove_CtxVolumeChanged();
int __incomplete__add_RingerVibrateStateChanged();
Expand Down

0 comments on commit ed6b92a

Please sign in to comment.