private void OnToxAvAudioFrameReceived(object sender, ToxAvEventArgs.AudioFrameEventArgs e) { short[] audioData = e.Frame.Data; int sampleRate = e.Frame.SamplingRate; int channels = e.Frame.Channels; if (audioData == null) { return; } if (this.callInfo == null || !this.callInfo.CanReceiveAudio) { return; } // in case the friend suddenly changed audio config, account for it here if (sampleRate != this.callInfo.PlaybackDevice.PlaybackFormat.SampleRate || channels != this.callInfo.PlaybackDevice.PlaybackFormat.Channels) { this.callInfo.PlaybackDevice.SetPlaybackSettings(sampleRate, channels); } // send the frame to the audio engine this.callInfo.PlaybackDevice.PlayAudioFrame(audioData, sampleRate, channels); }
private void AudioFrameReceivedHandler(object sender, ToxAvEventArgs.AudioFrameEventArgs e) { if (e.FriendNumber != _friendNumber) { return; } _receiveBuffer.Post(e.Frame.Data); }
private void AudioFrameReceivedHandler(object sender, ToxAvEventArgs.AudioFrameEventArgs e) { AudioFrameReceived?.Invoke(this, e); }