NAudio 选择扬声器/耳机(Realtek 高保真音频)
Posted
技术标签:
【中文标题】NAudio 选择扬声器/耳机(Realtek 高保真音频)【英文标题】:NAudio select Speaker/Headphone (Realtek High Definition Audio) 【发布时间】:2019-12-12 12:43:28 【问题描述】:是否可以选择扬声器/耳机(瑞昱高清音频)
var enumerator = new MMDeviceEnumerator();
foreach (var wasapi in enumerator.EnumerateAudioEndPoints(DataFlow.All, DeviceState.All))
wasapi.DeviceFriendlyName wasapi.State
MessageBox.Show($" wasapi.FriendlyName");
if (wasapi.FriendlyName.Contains("speaker"))
device = ????????????????
问候
【问题讨论】:
【参考方案1】:回答
public Form1()
InitializeComponent();
MMDeviceEnumerator enumerator = new MMDeviceEnumerator();
var devices = enumerator.EnumerateAudioEndPoints(DataFlow.All, DeviceState.Active);
//comboBox1.Items.AddRange(devices.ToArray()); //required
foreach (var dev in devices)
comboBox1.Items.Add(dev);
comboBox1.Text = "Speaker/Headphone (Realtek High Definition Audio)"; //reauired
【讨论】:
以上是关于NAudio 选择扬声器/耳机(Realtek 高保真音频)的主要内容,如果未能解决你的问题,请参考以下文章