コード例 #1
0
ファイル: CallManager.cs プロジェクト: tf2017/toxofone
        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);
        }
コード例 #2
0
        private void AudioFrameReceivedHandler(object sender, ToxAvEventArgs.AudioFrameEventArgs e)
        {
            if (e.FriendNumber != _friendNumber)
            {
                return;
            }

            _receiveBuffer.Post(e.Frame.Data);
        }
コード例 #3
0
ファイル: ToxAvModel.cs プロジェクト: ShaunHolt/OneTox
 private void AudioFrameReceivedHandler(object sender, ToxAvEventArgs.AudioFrameEventArgs e)
 {
     AudioFrameReceived?.Invoke(this, e);
 }