Hope this will be helpful.
To programmatically disable or enable audio hardware acceleration in Windows 11, you can modify the relevant registry settings using PowerShell scripts. Windows does not provide a direct API for toggling audio hardware acceleration, but this can be accomplished by editing the registry. Specifically, you need to adjust settings under the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class key. For example, to disable audio hardware acceleration, you would set the DisableHWAcceleration DWORD value to 1. Conversely, to enable it, you set this value to 0. Here's how you can do this with PowerShell: To disable hardware acceleration, use the script Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Class\{4d36e96c-e325-11ce-bfc1-08002be10318}\0000" -Name "DisableHWAcceleration" -Value 1 followed by Restart-Service -Name "Audiosrv" to restart the Windows Audio service. To enable hardware acceleration, change the value to 0 with Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Class\{4d36e96c-e325-11ce-bfc1-08002be10318}\0000" -Name "DisableHWAcceleration" -Value 0 and again restart the audio service. Always back up the registry before making changes to avoid potential issues.