This project has moved. For the latest updates, please go here.

Wasapi record and playback?

Jul 16, 2013 at 10:43 PM
Can someone help me out on this:

I am trying to playback the microphone, just to learn something easy, but i can´t get it to work with Wasapi.
  NAudio.CoreAudioApi.WasapiCapture sourceStream = null;
        NAudio.Wave.WaveIn sourceStream1 = null;
        NAudio.Wave.WasapiOut 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.CoreAudioApi.WasapiCapture();
            //sourceStream1.DeviceNumber = deviceNumber;
            sourceStream.WaveFormat = new NAudio.Wave.WaveFormat(48000, 16, 1) ;

            NAudio.Wave.WaveInProvider waveIn = new NAudio.Wave.WaveInProvider(sourceStream);
            

            waveOut = new NAudio.Wave.WasapiOut(NAudio.CoreAudioApi.AudioClientShareMode.Shared, 100);
          // waveOut.Init(waveIn);
          
            sourceStream.StartRecording();
            waveOut.Play();
Jul 17, 2013 at 2:44 PM
Okay i noticed that i could use Directsound with low latency with
BufferMilliseconds, very neat!

But i still have a problem, but will create another topic as it´s not about Wasapi at all.