我是NAudio
库的新手,并且开发了音频类型的文件,我想知道如何从Mixer的每个通道获取音频输入,如何使用USB Audio Interface连接到PC(支持ASIO),因此此Mixer支持8通道的音频输入。
所以我只是想知道应该使用哪个库类,并且在这种情况下是否有任何源代码示例或最佳实践(我正在使用C#进行开发)
谢谢
最佳答案
尝试使用以下代码:
using System;
using System.Windows.Forms;
using NAudio.Wave;
namespace NaudioAsioTest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
InitialiseAsioControls();
}
private void InitialiseAsioControls()
{
// Just fill the comboBox AsioDriver with available driver names
var asioDriverNames = AsioOut.GetDriverNames();
foreach (string driverName in asioDriverNames)
{
comboBoxAsioDriver.Items.Add(driverName);
}
//comboBoxAsioDriver.SelectedIndex = 0;
}
public string SelectedDeviceName { get { return (string)comboBoxAsioDriver.SelectedItem; } }
private void OnButtonControlPanelClick(object sender, EventArgs args)
{
try
{
using (var asio = new AsioOut(SelectedDeviceName))
{
asio.ShowControlPanel();
}
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
}
private void comboBoxAsioDriver_SelectedIndexChanged(object sender, EventArgs e)
{
try
{
using (var asio = new AsioOut(SelectedDeviceName))
{
//asio.ShowControlPanel();
int nrOfChannelOUTDevices = asio.DriverOutputChannelCount;
int nrOfChannelINDevices = asio.DriverInputChannelCount;
listBoxInputs.Items.Clear();
listBoxOutputs.Items.Clear();
for (int i = 0; i < nrOfChannelOUTDevices; i++)
{
string name = asio.AsioInputChannelName(i);
listBoxInputs.Items.Add(name);
}
for (int i = 0; i < nrOfChannelINDevices; i++)
{
string name = asio.AsioOutputChannelName(i);
listBoxOutputs.Items.Add(name);
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
}
结果如下:
关于c# - 从调音台NAudio C#获取音频输入 channel ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/39789869/