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

WasapiLoopBack, no data after stop and start

Jul 7 at 10:04 AM
I'm trying to get all sound with WasapiLoopbackCapture. It works fine. If no sound, comes no data. If I start for example youtube video, I become data. Until I stop and start video again. After second start event is triggered, but there comes no data (e.BytesRecorded is always 0). Here is the code:

IWaveIn audioSource = null;

MMDeviceEnumerator devices = new MMDeviceEnumerator();
MMDevice device = devices.GetDefaultAudioEndpoint(DataFlow.Render, Role.Multimedia);
audioSource = new WasapiLoopbackCapture(device);
audioSource.DataAvailable += AudioSource_DataAvailable;
audioSource.RecordingStopped += AudioSource_RecordingStopped;

ConvertAndWrite(e.Buffer, e.BytesRecorded);

Thank you,