var voiceSocket = new VoiceWebSocket(Client.Config, _config, logger);
var voiceClient = new DiscordAudioClient(this, id, logger, gatewaySocket, voiceSocket);
var voiceClient = new DiscordAudioClient((AudioService)(this), (int)id, (Logger)logger, (Net.WebSockets.GatewaySocket)gatewaySocket, (VoiceWebSocket)voiceSocket);
public static extern int EncoderCtl(IntPtr st, Ctl request, int value);
public enum Ctl : int
{
SetBitrateRequest = 4002,
GetBitrateRequest = 4003,
SetInbandFECRequest = 4012,
GetInbandFECRequest = 4013
}
/// <summary>Supported coding modes.</summary>
public enum Application : int
{
/// <summary>
/// Gives best quality at a given bitrate for voice signals. It enhances the input signal by high-pass filtering and emphasizing formants and harmonics.
/// Optionally it includes in-band forward error correction to protect against packet loss. Use this mode for typical VoIP applications.
/// Because of the enhancement, even at high bitrates the output may sound different from the input.
/// </summary>
Voip = 2048,
/// <summary>
/// Gives best quality at a given bitrate for most non-voice signals like music.
/// Use this mode for music and mixed (music/voice) content, broadcast, and applications requiring less than 15 ms of coding delay.
/// </summary>
Audio = 2049,
/// <summary> Low-delay mode that disables the speech-optimized mode in exchange for slightly reduced delay. </summary>
Restricted_LowLatency = 2051
}
public enum Error : int
{
/// <summary> No error. </summary>
OK = 0,
/// <summary> One or more invalid/out of range arguments. </summary>
BadArg = -1,
/// <summary> The mode struct passed is invalid. </summary>
BufferToSmall = -2,
/// <summary> An internal error was detected. </summary>
InternalError = -3,
/// <summary> The compressed data passed is corrupted. </summary>
/// Gives best quality at a given bitrate for voice signals. It enhances the input signal by high-pass filtering and emphasizing formants and harmonics.
/// Optionally it includes in-band forward error correction to protect against packet loss. Use this mode for typical VoIP applications.
/// Because of the enhancement, even at high bitrates the output may sound different from the input.
/// </summary>
Voip = 2048,
/// <summary>
/// Gives best quality at a given bitrate for most non-voice signals like music.
/// Use this mode for music and mixed (music/voice) content, broadcast, and applications requiring less than 15 ms of coding delay.
/// </summary>
Audio = 2049,
/// <summary> Low-delay mode that disables the speech-optimized mode in exchange for slightly reduced delay. </summary>
Restricted_LowLatency = 2051
}
internal enum OpusError : int
{
/// <summary> No error. </summary>
OK = 0,
/// <summary> One or more invalid/out of range arguments. </summary>
BadArg = -1,
/// <summary> The mode struct passed is invalid. </summary>
BufferToSmall = -2,
/// <summary> An internal error was detected. </summary>
InternalError = -3,
/// <summary> The compressed data passed is corrupted. </summary>
@@ -9,165 +9,165 @@ using System.Collections.Generic;
namespace Discord.API
{
public enum GatewayOpCodes : byte
{
/// <summary> Client <-- Server - Used to send most events. </summary>
Dispatch = 0,
/// <summary> Client <-> Server - Used to keep the connection alive and measure latency. </summary>
Heartbeat = 1,
/// <summary> Client --> Server - Used to associate a connection with a token and specify configuration. </summary>
Identify = 2,
/// <summary> Client --> Server - Used to update client's status and current game id. </summary>
StatusUpdate = 3,
/// <summary> Client --> Server - Used to join a particular voice channel. </summary>
VoiceStateUpdate = 4,
/// <summary> Client --> Server - Used to ensure the server's voice server is alive. Only send this if voice connection fails or suddenly drops. </summary>
VoiceServerPing = 5,
/// <summary> Client --> Server - Used to resume a connection after a redirect occurs. </summary>
Resume = 6,
/// <summary> Client <-- Server - Used to notify a client that they must reconnect to another gateway. </summary>
Redirect = 7,
/// <summary> Client --> Server - Used to request all members that were withheld by large_threshold </summary>
RequestGuildMembers = 8
}
public enum GatewayOpCodes : byte
{
/// <summary> Client <-- Server - Used to send most events. </summary>
Dispatch = 0,
/// <summary> Client <-> Server - Used to keep the connection alive and measure latency. </summary>
Heartbeat = 1,
/// <summary> Client --> Server - Used to associate a connection with a token and specify configuration. </summary>
Identify = 2,
/// <summary> Client --> Server - Used to update client's status and current game id. </summary>
StatusUpdate = 3,
/// <summary> Client --> Server - Used to join a particular voice channel. </summary>
VoiceStateUpdate = 4,
/// <summary> Client --> Server - Used to ensure the server's voice server is alive. Only send this if voice connection fails or suddenly drops. </summary>
VoiceServerPing = 5,
/// <summary> Client --> Server - Used to resume a connection after a redirect occurs. </summary>
Resume = 6,
/// <summary> Client <-- Server - Used to notify a client that they must reconnect to another gateway. </summary>
Redirect = 7,
/// <summary> Client --> Server - Used to request all members that were withheld by large_threshold </summary>
RequestGuildMembers = 8
}
//Common
public class WebSocketMessage
{
public WebSocketMessage() { }
public WebSocketMessage(int op) { Operation = op; }
//Common
public class WebSocketMessage
{
public WebSocketMessage() { }
public WebSocketMessage(int op) { Operation = op; }
/// <summary> Blocking call that will not return until client has been stopped. This is mainly intended for use in console applications. </summary>
public void Run()
{
_disconnectedEvent.WaitOne();
}
private void CheckReady()
{
switch (_state)
{
case (int)DiscordClientState.Disconnecting:
throw new InvalidOperationException("The client is disconnecting.");
case (int)DiscordClientState.Disconnected:
throw new InvalidOperationException("The client is not connected to Discord");
case (int)DiscordClientState.Connecting:
throw new InvalidOperationException("The client is connecting.");
}
}
public void GetCacheStats(out int serverCount, out int channelCount, out int userCount, out int uniqueUserCount, out int messageCount, out int roleCount)
{
serverCount = _servers.Count;
channelCount = _channels.Count;
userCount = _users.Count;
uniqueUserCount = _globalUsers.Count;
messageCount = _messages.Count;
roleCount = _roles.Count;
}
}
public void GetCacheStats(out int serverCount, out int channelCount, out int userCount, out int uniqueUserCount, out int messageCount, out int roleCount)
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.