Exemplo n.º 1
0
        private Task Stage2(VoiceSessionDescriptionPayload voiceSessionDescription)
        {
            SelectedEncryptionMode = Sodium.SupportedModes[voiceSessionDescription.Mode.ToLowerInvariant()];
            Discord.DebugLogger.LogMessage(LogLevel.Debug, "VoiceNext", $"Discord updated encryption mode: {SelectedEncryptionMode}", DateTime.Now);

            // start keepalive
            KeepaliveTokenSource = new CancellationTokenSource();
            KeepaliveTask        = KeepaliveAsync();

            // send 3 packets of silence to get things going
            var nullpcm = new byte[AudioFormat.CalculateSampleSize(20)];

            for (var i = 0; i < 3; i++)
            {
                var nullopus    = new byte[nullpcm.Length];
                var nullopusmem = nullopus.AsMemory();
                PreparePacket(nullpcm, ref nullopusmem);
                EnqueuePacket(new VoicePacket(nullopusmem, 20));
            }

            IsInitialized = true;
            ReadyWait.SetResult(true);

            return(Task.Delay(0));
        }
Exemplo n.º 2
0
 private Task Stage2()
 {
     IsInitialized = true;
     ReadyWait.SetResult(true);
     return(Task.Delay(0));
 }