1
我的主要目標是創建一個程序,該程序允許我使用「滾動鎖定」鍵在窗口下將麥克風靜音/取消靜音。這會給我一個很好的指示,因爲我的鍵盤上的滾動鎖定燈是否靜音。Win7:獲取麥克風靜音狀態
如何獲取有關麥克風狀態的信息 - 無論是否靜音? 任何我可以打電話來實現這個嗎?
謝謝
我的主要目標是創建一個程序,該程序允許我使用「滾動鎖定」鍵在窗口下將麥克風靜音/取消靜音。這會給我一個很好的指示,因爲我的鍵盤上的滾動鎖定燈是否靜音。Win7:獲取麥克風靜音狀態
如何獲取有關麥克風狀態的信息 - 無論是否靜音? 任何我可以打電話來實現這個嗎?
謝謝
使用CoreAudioApi。你可以找到DLL here。 使用此功能查找您的麥克風:麥克風設備發現
private List<MMDevice> gMicrophoneDevices = new List<MMDevice>();//global variable
private bool findMicrophones()
{
MMDeviceEnumerator DevEnum = new MMDeviceEnumerator();
MMDeviceCollection devices = DevEnum.EnumerateAudioEndPoints(EDataFlow.eCapture, EDeviceState.DEVICE_STATE_ACTIVE);
for (int i = 0; i < devices.Count; i++)
{
MMDevice deviceAt = devices[i];
if (deviceAt.FriendlyName.ToLower() == "microphone" || deviceAt.FriendlyName.ToLower() == "микрофон")//you can add more languages here
gMicrophoneDevices.Add(deviceAt);
}
if (gMicrophoneDevices.Count == 0)
return false;
else return true;
}
後,使用它來獲取它的靜音狀態:
gMicrophoneDevices[0].AudioEndpointVolume.Mute
如果其真正的,那麼你的第一個麥克風靜音。