internal DiscordVoiceClient(DiscordClient pclient, DiscordVoiceChannel pchannel, DiscordVoiceCallback callback)
        {
            parent        = pclient;
            channel       = pchannel;
            startcallback = callback;
            users         = new Dictionary <DiscordUser, uint>();

            try
            {
                if (channel.ID != null)
                {
                    if (channel.bitrate > 0)
                    {
                        encoder = new OpusEncoder(48000, 1, 20, (channel.bitrate / 1000), OpusApplication.MusicOrMixed);
                    }

                    else
                    {
                        encoder = new OpusEncoder(48000, 1, 20, null, OpusApplication.MusicOrMixed);
                    }

                    encoder.SetForwardErrorCorrection(true);
                    decoder = new OpusDecoder(48000, 1, 20);
                }
            }

            catch (Exception e)
            {
                Debug.LogError(e.Message);
                Debug.LogError(e.StackTrace);
                Debug.LogError(e.Source);
            }
        }
Пример #2
0
 /// <summary> Edits this server. </summary>
 /// <param name="servername">The servername of this server.</param>
 /// <param name="region">The region of this server.</param>
 /// <param name="verificationLevel">The verification level of this server.</param>
 /// <param name="afkchannel">The afkchannel of this server.</param>
 /// <param name="timeout">The afk timeout of this server.</param>
 /// <param name="icon">The icon of this server.</param>
 /// <param name="splash">The splash of this server.</param>
 public void Edit(string servername, string region, int?verificationLevel, DiscordVoiceChannel afkchannel, int?timeout, Texture2D icon, Texture2D splash, DiscordServerCallback callback)
 {
     client.EditServer(ID, servername, null, region, verificationLevel, afkchannel == null ? null : afkchannel.ID, timeout, icon, splash, callback);
 }