Пример #1
0
 public static DiscordClient UsingAudio(this DiscordClient client, Action<AudioServiceConfig> configFunc = null)
 {
     var config = new AudioServiceConfig();
     configFunc(config);
     client.Services.Add(new AudioService(config));
     return client;
 }
Пример #2
0
 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);
 }
Пример #3
0
 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);
 }
Пример #4
0
 public static DiscordClient UsingAudio(this DiscordClient client, AudioServiceConfig config = null)
 {
     client.Services.Add(new AudioService(config));
     return client;
 }
Пример #5
0
 public static DiscordClient UsingAudio(this DiscordClient client, AudioServiceConfig config = null)
 {
     client.AddService(new AudioService(config));
     return(client);
 }
Пример #6
0
 public AudioService(AudioServiceConfig config)
 {
     Config     = config;
     _asyncLock = new AsyncLock();
 }
Пример #7
0
 public AudioService(AudioServiceConfig config)
 {
     Config = config;
 }
Пример #8
0
        public AudioService(AudioServiceConfig config)
        {
            Config = config;
            _asyncLock = new AsyncLock();

        }
Пример #9
0
		public AudioService(AudioServiceConfig config)
		{
			Config = config;
		}