using NAudio.CoreAudioApi;
MMDevice? LineIn = null;
var enumerator = new MMDeviceEnumerator();
foreach (var endpoint in enumerator.EnumerateAudioEndPoints(DataFlow.Capture, DeviceState.Active))
{
if (endpoint.FriendlyName == "Line In (High Definition Audio Device)")
{
LineIn = endpoint;
break;
}
}
if (LineIn != null)
{
if (LineIn.AudioEndpointVolume.MasterVolumeLevel == 0.0f)
{
LineIn.AudioEndpointVolume.MasterVolumeLevel = LineIn.AudioEndpointVolume.VolumeRange.MaxDecibels;
}
else
{
LineIn.AudioEndpointVolume.MasterVolumeLevel = 0.0f;
}
}
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
^!m::Run "C:\...\Visual Studio 2022\Projects\AudioListenToggle\bin\Release\net6.0\AudioListenToggle.exe"
And I have put it in my start up folder
If you don't know where that is, type "run" into windows and then "shell:startup"