/// <summary> /// Callback for the loopback recorder, new audio data is captured. /// </summary> /// <param name="dataToSendIn">the audio data in wav format</param> /// <param name="formatIn">the wav format that's used</param> public void OnRecordingDataAvailable(byte[] dataToSendIn, WaveFormat formatIn) { if (!StreamFormatSelected.Equals(SupportedStreamFormat.Wav)) { if (Mp3Stream == null) { Mp3Stream = new Mp3Stream(formatIn, StreamFormatSelected); } Mp3Stream.Encode(dataToSendIn.ToArray()); dataToSendIn = Mp3Stream.Read(); } if (dataToSendIn.Length > 0) { devices?.OnRecordingDataAvailable(dataToSendIn, formatIn, reduceLagThreshold, StreamFormatSelected); } }