如何转移系统麦克风音频流连接的设备的麦克风的音频流 [英] How transfer system mic audio stream to attached device mic audio stream

查看:395
本文介绍了如何转移系统麦克风音频流连接的设备的麦克风的音频流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图附加用于具有对麦克风和扬声器的PNP声音控制器远程调用的USB设备。现在,我有两个扬声器和两次MIC输入输出,如下面的图像 href=\"http://i.stack.imgur.com/uXhA4.png\"> 。现在我的动机是从系统麦克风传输音频流,USB麦克风和USB扬声器系统扬声器。

I am trying to attach USB device used for tele calling which have pnp sound controller for mic and speaker. Now i have two speaker and two mic for input output as shown in image below.. Now my motive is to transfer audio stream from system mic to usb mic and from usb speaker to system speaker.

我试图来解决虚拟电缆软件,但这个这个问题我需要依赖于第三方。有什么可以能够达到使用C#的可能的解决方案。

I tried to solve this issue with virtual cable software but with this i need to depend on third party. What can be the possible solution that can attained using c#.

我没有关于这方面的知识,所以不知道如何下手。谷歌搜索后,我发现

I don't have knowledge about this, so don't know how to start. After googling i found


  1. CS核心

  2. N音频

  1. CS Core
  2. N Audio

能否帮助我,我不知道如何

Can help me i don't know how.

 public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }

    private void button1_Click(object sender, EventArgs e)
    {
        List<NAudio.Wave.WaveInCapabilities> sources = new List<NAudio.Wave.WaveInCapabilities>();

        for (int i = 0; i < NAudio.Wave.WaveIn.DeviceCount; i++)
        {
            sources.Add(NAudio.Wave.WaveIn.GetCapabilities(i));
        }

        sourceList.Items.Clear();

        foreach (var source in sources)
        {
            ListViewItem item = new ListViewItem(source.ProductName);
            item.SubItems.Add(new ListViewItem.ListViewSubItem(item, source.Channels.ToString()));
            sourceList.Items.Add(item);
        }
    }

    NAudio.Wave.WaveIn sourceStream,sourceStream1 = null;
    NAudio.Wave.DirectSoundOut waveOut = null;

    private void button2_Click(object sender, EventArgs e)
    {
        if (sourceList.SelectedItems.Count == 0) return;

        int deviceNumber = sourceList.SelectedItems[0].Index;

        sourceStream = new NAudio.Wave.WaveIn();
        sourceStream.DeviceNumber = 0;
        sourceStream.WaveFormat = new NAudio.Wave.WaveFormat(44100, NAudio.Wave.WaveIn.GetCapabilities(deviceNumber).Channels);



        NAudio.Wave.WaveInProvider waveIn = new NAudio.Wave.WaveInProvider(sourceStream1);
        sourceStream.
        waveOut = new NAudio.Wave.DirectSoundOut();
        waveOut.Init(waveIn);

        sourceStream1.StartRecording();
        waveOut.Play();
    }

    private void button3_Click(object sender, EventArgs e)
    {
        if (waveOut != null)
        {
            waveOut.Stop();
            waveOut.Dispose();
            waveOut = null;
        }
        if (sourceStream != null)
        {
            sourceStream.StopRecording();
            sourceStream.Dispose();
            sourceStream = null;
        }
    }

    private void button4_Click(object sender, EventArgs e)
    {
        button3_Click(sender, e);
        this.Close();
    }
}



使用此代码我可以给麦克风音频扬声器,但我如何能实现使用该我的任务。

Using this code i can send mic audio to speaker but how can i implement my task using this.

推荐答案

其实,有没有办法做到这一点,而无需编写任何自定义驱动程序。不能音频数据呈现到一个输入设备。输入设备是为了从读出的数据。输出设备(扬声器)是为了数据写入。

Actually there is no way to do this without writing any custom driver. You can not render audio data to a input device. Input devices are meant to read data from. Output devices (speakers) are meant to write data to.

有像虚拟音频线方案,使用自定义驱动程序绕过这些限制。

There are programs like virtual audio cable, which are using custom drivers to bypass these limitations.

这篇关于如何转移系统麦克风音频流连接的设备的麦克风的音频流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆