// Token: 0x06000166 RID: 358 RVA: 0x00004924 File Offset: 0x00002B24 public void Encode(ReadOnlySpan <byte> pcm, ref Span <byte> target) { if (pcm.Length != target.Length) { throw new ArgumentException("PCM and Opus buffer lengths need to be equal.", "target"); } int sampleDuration = this.AudioFormat.CalculateSampleDuration(pcm.Length); int frameSize = this.AudioFormat.CalculateFrameSize(sampleDuration); int num = this.AudioFormat.CalculateSampleSize(sampleDuration); if (pcm.Length != num) { throw new ArgumentException("Invalid PCM sample size.", "target"); } Interop.OpusEncode(this.Encoder, pcm, frameSize, ref target); }
public void Encode(ReadOnlySpan <byte> pcm, ref Span <byte> target) { if (pcm.Length != target.Length) { throw new ArgumentException("PCM and Opus buffer lengths need to be equal.", nameof(target)); } var duration = AudioFormat.CalculateSampleDuration(pcm.Length); var frameSize = AudioFormat.CalculateFrameSize(duration); var sampleSize = AudioFormat.CalculateSampleSize(duration); if (pcm.Length != sampleSize) { throw new ArgumentException("Invalid PCM sample size.", nameof(target)); } Interop.OpusEncode(Encoder, pcm, frameSize, ref target); }