Quantcast
Channel: naudio Work Item Rss Feed
Viewing all articles
Browse latest Browse all 738

Edited Unassigned: WasapiLoopbackCapture - Dataavailable not working as intended. [16405]

$
0
0
Made a post in the forum about it.

Not exactly sure if it´s just me that have done something wrong, but i can´t see what the issue can be so.

When i use .Dataavailable and send it through UDP and play it on receive, it works perfectly. BUT, it stops playing after about 5 secs.

It´s always the same time, and Only when i use WasapiLoopBack. It´s like Dataavailable is looking at a buffer that´s 5 seconds, and just waiting for it to run out, even though it should be infinite as it´s a loopback and it´s recording.

How i concluded it´s not working correctly is that if i play it directly, like Asioout(Waloop);(you get it).
It will play just fine, so the "data" is there.

I have tried it both at 32bit (original float) and downsampling to 16 bit. Both at Stereo.

```
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 && MuteMic.Checked == false)
{
udpClient.Send(newArray16Bit, newArray16Bit.Length, otherPartyIP.Address.ToString(), 1500);
}

}
```

Thre shouldn´t be any problem and i don´t receive any errors. So i can´t understand what´s wrong, the only thing i can think of, is that it´s not working correctly.

Viewing all articles
Browse latest Browse all 738

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>