/// <summary> /// Initializes a new instance of the <see cref="OpusCodec"/> class. /// </summary> /// <param name="sampleRate">The sample rate in Hertz (samples per second).</param> /// <param name="sampleBits">The sample bit depth.</param> /// <param name="sampleChannels">The sample channels (1 for mono, 2 for stereo).</param> /// <param name="frameSize">Size of the frame in samples.</param> public OpusCodec(int sampleRate = Constants.DEFAULT_AUDIO_SAMPLE_RATE, byte sampleBits = Constants.DEFAULT_AUDIO_SAMPLE_BITS, byte channels = Constants.DEFAULT_AUDIO_SAMPLE_CHANNELS, ushort frameSize = Constants.DEFAULT_AUDIO_FRAME_SIZE) { _sampleRate = sampleRate; _frameSize = frameSize; _decoder = new OpusDecoder(sampleRate, channels) { EnableForwardErrorCorrection = true }; _encoder = new OpusEncoder(sampleRate, channels) { EnableForwardErrorCorrection = true }; }