internal VoiceSocket(DiscordConfig config, AudioServiceConfig audioConfig, JsonSerializer serializer, Logger logger) : base(config, serializer, logger) { _audioConfig = audioConfig; _decoders = new ConcurrentDictionary<uint, OpusDecoder>(); _targetAudioBufferLength = _audioConfig.BufferLength / 20; //20 ms frames _encodingBuffer = new byte[MaxOpusSize]; _ssrcMapping = new ConcurrentDictionary<uint, ulong>(); _encoder = new OpusEncoder(48000, _audioConfig.Channels, 20, _audioConfig.Bitrate, OpusApplication.MusicOrMixed); _sendBuffer = new VoiceBuffer((int)Math.Ceiling(_audioConfig.BufferLength / (double)_encoder.FrameLength), _encoder.FrameSize); }
public VoiceWebSocket(DiscordWSClient client) : base(client) { _rand = new Random(); _decoders = new ConcurrentDictionary<uint, OpusDecoder>(); _targetAudioBufferLength = client.Config.VoiceBufferLength / 20; //20 ms frames _encodingBuffer = new byte[MaxOpusSize]; _ssrcMapping = new ConcurrentDictionary<uint, string>(); _encoder = new OpusEncoder(48000, 1, 20, Opus.Application.Audio); _sendBuffer = new VoiceBuffer((int)Math.Ceiling(client.Config.VoiceBufferLength / (double)_encoder.FrameLength), _encoder.FrameSize); }
internal VoiceWebSocket(DiscordClient client, AudioClient audioClient, Logger logger) : base(client, logger) { _audioClient = audioClient; _config = client.Audio().Config; _decoders = new ConcurrentDictionary<uint, OpusDecoder>(); _targetAudioBufferLength = _config.BufferLength / 20; //20 ms frames _encodingBuffer = new byte[MaxOpusSize]; _ssrcMapping = new ConcurrentDictionary<uint, ulong>(); _encoder = new OpusEncoder(48000, _config.Channels, 20, _config.Bitrate, OpusApplication.MusicOrMixed); _sendBuffer = new VoiceBuffer((int)Math.Ceiling(_config.BufferLength / (double)_encoder.FrameLength), _encoder.FrameSize); }