//获取系统麦克风音量 //private int GetCurrentSpeakerVolume() //{ // int volume = 0; // var enumerator = new MMDeviceEnumerator(); // //获取音频输出设备 // IEnumerable<MMDevice> speakDevices = enumerator.EnumerateAudioEndPoints(DataFlow.Render, DeviceState.Active).ToArray(); // if (speakDevices.Count() > 0) // { // MMDevice mMDevice = speakDevices.ToList()[0]; // volume = Convert.ToInt16(mMDevice.AudioEndpointVolume.MasterVolumeLevelScalar * 100); // } // return volume; //} //设置当前系统麦克风音量 volume 取值 0-100 //private void GetCurrentSpeakerVolume(int volume) //{ //var enumerator = new MMDeviceEnumerator(); //IEnumerable<MMDevice> speakDevices = enumerator.EnumerateAudioEndPoints(DataFlow.Render, DeviceState.Active).ToArray(); //if (speakDevices.Count() > 0) //{ // MMDevice mMDevice = speakDevices.ToList()[0]; // mMDevice.AudioEndpointVolume.MasterVolumeLevelScalar = volume / 100.0f; //} //} //获取当前系统扬声器音量 //private int GetCurrentSpeakerVolume() //{ // int volume = 0; // var enumerator = new MMDeviceEnumerator(); // //获取音频输出设备 // IEnumerable<MMDevice> speakDevices = enumerator.EnumerateAudioEndPoints(DataFlow.Render, DeviceState.Active).ToArray(); // if (speakDevices.Count() > 0) // { // MMDevice mMDevice = speakDevices.ToList()[0]; // volume = Convert.ToInt16(mMDevice.AudioEndpointVolume.MasterVolumeLevelScalar * 100); // } // return volume; //}