This project has moved and is read-only. For the latest updates, please go here.

Wasapi Loopback Buffer?

Aug 3, 2013 at 5:47 PM
Edited Aug 3, 2013 at 6:03 PM
Is there a way to control the buffer?
Currently it seems to mess around at about 600ms.

Okay it seems it went better when i got it to 16 bit.

But i still have a problem. Waloop stops recording after around 5 seconds.
If i reset it, it will start again about 5 secs.

I have no idea why.
 void SendWaloop(object sender, NAudio.Wave.WaveInEventArgs e)
       {
           byte[] newArray16Bit = new byte[e.BytesRecorded / 2];
           short two;
           float value;
           for (int i = 0, j = 0; i < e.BytesRecorded; i += 4, j += 2)
           {
               value = (BitConverter.ToSingle(e.Buffer, i));
               two = (short)(value * short.MaxValue);

               newArray16Bit[j] = (byte)(two & 0xFF);
               newArray16Bit[j + 1] = (byte)((two >> 8) & 0xFF);
           }
           if (connect == true)
           {
               udpClient.Send(newArray16Bit, newArray16Bit.Length, otherPartyIP.Address.ToString(), 1500);

           }
          
       }

                    Waloop = new WasapiLoopbackCapture();
                    waveIn = new WaveInProvider(Waloop);
                    Waloop.StartRecording();

This are the Wasapi parts.