Class VoiceConnection
- Namespace
- DisCatSharp.Voice
- Assembly
- DisCatSharp.Voice.dll
Voice connection to a voice channel.
public sealed class VoiceConnection : IDisposable
- Inheritance
-
VoiceConnection
- Implements
- Inherited Members
Properties
- AudioFormat
Gets the audio format used by the Opus encoder.
- DaveProtocolVersion
Gets the currently negotiated DAVE protocol version, or 0 when DAVE is not negotiated.
- DaveState
Gets the last published public DAVE state for this connection.
- EnableDebugLogging
Gets or sets whether voice debug/trace logging is enabled for this connection only.
- IsDaveActive
Gets whether DAVE is currently active.
- IsDaveNegotiated
Gets whether DAVE is negotiated for this voice connection.
- IsE2eeUsableForReceive
Gets whether inbound audio can currently be decrypted and decoded.
- IsE2eeUsableForSend
Gets whether outbound audio can currently be sent without DAVE gating.
- IsPlaying
Gets whether this connection is still playing audio.
- TargetChannel
Gets the channel this voice client is connected to.
- UdpPing
Gets the UDP round-trip time in ms.
- WebSocketPing
Gets the websocket round-trip time in ms.
Methods
- BindExternalOpusSourceAsync(IExternalOpusSource, CancellationToken)
Binds an external Opus source to this voice connection. Frames from the source bypass the internal Opus encoder but go through RTP framing, DAVE E2EE, and AEAD transport encryption.
- Disconnect()
Disconnects and disposes this voice connection.
- Dispose()
Disconnects and disposes this voice connection.
- GetTransmitSink(int)
Gets a transmit stream for this connection, optionally specifying a packet size to use with the stream. If a stream is already configured, it will return the existing one.
- Pause()
Pauses playback.
- ResumeAsync()
Asynchronously resumes playback.
- SendSpeakingAsync(SpeakingFlags)
Sends a speaking status to the connected voice channel.
- SetDeafenedAsync(bool)
Updates the bot's self-deafen state without switching channels.
- SetMutedAsync(bool)
Updates the bot's self-mute state without switching channels.
- WaitForDaveActiveAsync(TimeSpan, CancellationToken)
Waits until DAVE transitions to Active or the timeout elapses.
- WaitForPlaybackFinishAsync()
Asynchronously waits for playback to be finished. Playback is finished when speaking = false is signaled.
Events
- DaveOpcodeObserved
Triggered whenever a DAVE opcode is sent or received.
- DaveStateChanged
Triggered whenever the public DAVE state changes for this voice connection.
- UserJoined
Triggered whenever a user joins voice in the connected guild.
- UserLeft
Triggered whenever a user leaves voice in the connected guild.
- UserSpeaking
Triggered whenever a user speaks in the connected voice channel.
- VoicePacketDropped
Triggered whenever an inbound voice packet is dropped.
- VoiceReceived
Triggered whenever voice data is received from the connected voice channel.
- VoiceSocketErrored
Triggered whenever voice WebSocket throws an exception.