Implements a discord voice connection. More...
#include "discordvoiceclient.h"
Public Types | |
enum | send_audio_type_t { satype_recorded_audio, satype_live_audio, satype_overlap_audio } |
The audio type to be sent. More... | |
Public Member Functions | |
discord_voice_client (dpp::cluster *_cluster, snowflake _channel_id, snowflake _server_id, const std::string &_token, const std::string &_session_id, const std::string &_host) | |
Constructor takes shard id, max shards and token. More... | |
virtual | ~discord_voice_client () |
Destroy the discord voice client object. More... | |
virtual void | close () |
Close websocket. More... | |
std::string | discover_ip () |
Discord external IP detection. More... | |
virtual void | error (uint32_t errorcode) |
Handle a websocket error. More... | |
uint64_t | get_bytes_in () |
Get total bytes received. More... | |
uint64_t | get_bytes_out () |
Get the bytes out objectGet total bytes sent. More... | |
std::string | get_cipher () |
Get SSL cipher name. More... | |
uint16_t | get_iteration_interval () |
Get the iteration interval time (in milliseconds). More... | |
const std::vector< std::string > | get_marker_metadata () |
Get the metadata string associated with each inserted marker. More... | |
dpp::utility::uptime | get_remaining () |
Get the time remaining to send the audio output buffer in hours:minutes:seconds. More... | |
float | get_secs_remaining () |
Get the number of seconds remaining of the audio output buffer. More... | |
uint64_t | get_timescale () |
Get the current timescale, this will default to 1000000 which means 1 millisecond. More... | |
uint32_t | get_tracks_remaining () |
Get the number of tracks remaining in the output buffer. More... | |
dpp::utility::uptime | get_uptime () |
Returns the connection time of the voice client. More... | |
virtual bool | handle_buffer (std::string &buffer) |
Processes incoming frames from the SSL socket input buffer. More... | |
virtual bool | handle_frame (const std::string &buffer) |
Handle JSON from the websocket. More... | |
discord_voice_client & | insert_marker (const std::string &metadata="") |
Insert a track marker into the audio output buffer. More... | |
bool | is_connected () |
Returns true if the voice client is connected to the websocket. More... | |
bool | is_paused () |
Returns true if the audio is paused. More... | |
bool | is_playing () |
Returns true if we are playing audio. More... | |
bool | is_ready () |
voice client is ready to stream audio. More... | |
virtual void | log (dpp::loglevel severity, const std::string &msg) const |
Log a message to whatever log the user is using. More... | |
virtual void | one_second_timer () |
Fires every second from the underlying socket I/O loop, used for sending heartbeats. More... | |
discord_voice_client & | pause_audio (bool pause) |
Pause sending of audio. More... | |
void | read_loop () |
Nonblocking I/O loop. More... | |
void | run () |
Start and monitor I/O loop. More... | |
discord_voice_client & | send_audio_opus (uint8_t *opus_packet, const size_t length) |
Send opus packets to the voice channel. More... | |
discord_voice_client & | send_audio_opus (uint8_t *opus_packet, const size_t length, uint64_t duration) |
Send opus packets to the voice channel. More... | |
discord_voice_client & | send_audio_raw (uint16_t *audio_data, const size_t length) |
Send raw audio to the voice channel. More... | |
void | send_close_packet () |
Send OP_CLOSE error code 1000 to the other side of the connection. More... | |
discord_voice_client & | send_silence (const uint64_t duration) |
Send silence to the voice channel. More... | |
discord_voice_client & | set_iteration_interval (uint16_t interval) |
Change the iteration interval time. More... | |
discord_voice_client & | set_send_audio_type (send_audio_type_t type) |
Sets the audio type that will be sent with send_audio_* methods. More... | |
discord_voice_client & | set_timescale (uint64_t new_timescale) |
Set the timescale in nanoseconds. More... | |
void | set_user_gain (snowflake user_id, float factor) |
Sets the gain for the specified user. More... | |
discord_voice_client & | skip_to_next_marker () |
Skip tp the next track marker, previously inserted by using the dpp::discord_voice_client::insert_marker function. More... | |
discord_voice_client & | speak () |
Mark the voice connection as 'speaking'. More... | |
discord_voice_client & | stop_audio () |
Immediately stop all audio. More... | |
virtual void | write (const std::string &data) |
Write to websocket. More... | |
Public Attributes | |
snowflake | channel_id |
Channel ID. More... | |
class dpp::cluster * | creator |
Owning cluster. More... | |
float | current_gain |
The gain value for the current voice iteration. More... | |
socket_callback_t | custom_readable_fd |
Attaching an additional file descriptor to this function will send notifications when there is data to read. More... | |
socket_notification_t | custom_readable_ready |
This event will be called when you can read from the custom fd. More... | |
socket_callback_t | custom_writeable_fd |
Attaching an additional file descriptor to this function will send notifications when you are able to write to the socket. More... | |
socket_notification_t | custom_writeable_ready |
This event will be called when you can write to a custom fd. More... | |
float | end_gain |
The gain value for the end of the current voice iteration. More... | |
uint32_t | heartbeat_interval |
Heartbeat interval for sending heartbeat keepalive. More... | |
float | increment |
The amount to increment each successive sample for, for the current voice iteration. More... | |
uint16_t | iteration_interval {500} |
The time (in milliseconds) between each interval when parsing audio. More... | |
bool | keepalive |
True if we are keeping the connection alive after it has finished. More... | |
time_t | last_heartbeat |
Last voice channel websocket heartbeat. More... | |
moving_averager | moving_average |
Moving averager. More... | |
enum dpp::discord_voice_client::send_audio_type_t | send_audio_type |
snowflake | server_id |
Server ID. More... | |
std::string | sessionid |
Discord voice session id. More... | |
bool | terminating |
True when the thread is shutting down. More... | |
std::thread::native_handle_type | thread_id |
Thread ID. More... | |
std::string | token |
Discord voice session token. More... | |
Static Public Attributes | |
static bool | sodium_initialised = false |
This needs to be static, we only initialise libsodium once per program start, so initialising it on first use in a voice connection is best. More... | |
Protected Member Functions | |
virtual void | connect () |
(Re)connect More... | |
ws_state | get_state () |
Get websocket state. More... | |
Protected Attributes | |
std::string | buffer |
Input buffer received from socket. More... | |
uint64_t | bytes_in |
Bytes in. More... | |
uint64_t | bytes_out |
Bytes out. More... | |
std::string | cipher |
SSL cipher in use. More... | |
std::string | hostname |
Hostname connected to. More... | |
time_t | last_tick |
For timers. More... | |
bool | make_new |
True if we are establishing a new connection, false if otherwise. More... | |
bool | nonblocking |
True if in nonblocking mode. More... | |
std::string | obuffer |
Output buffer for sending to socket. More... | |
bool | plaintext |
True for a plain text connection. More... | |
dpp::socket | sfd |
Raw file descriptor of connection. More... | |
openssl_connection * | ssl |
Openssl opaque contexts. More... | |
Implements a discord voice connection.
Each discord_voice_client connects to one voice channel and derives from a websocket client.
The audio type to be sent.
If the audio is recorded, the sending of audio packets is throttled. Otherwise, if the audio is live, the sending is not throttled.
Discord voice engine is expecting audio data as if they were from some audio device, e.g. microphone, where the data become available as they get captured from the audio device.
In case of recorded audio, unlike from a device, the audio data are usually instantly available in large chunks. Throttling is needed to simulate audio data coming from an audio device. In case of live audio, the throttling is by nature, so no extra throttling is needed.
Using live audio mode for recorded audio can cause Discord to skip audio data because Discord does not expect to receive, say, 3 minutes' worth of audio data in 1 second.
There are some inaccuracies in the throttling method used by the recorded audio mode on some systems (mainly Windows) which causes gaps and stutters in the resulting audio stream. The overlap audio mode provides a different implementation that fixes the issue. This method is slightly more CPU intensive, and should only be used if you encounter issues with recorded audio on your system.
Use discord_voice_client::set_send_audio_type to change this value as it ensures thread safety.
Enumerator | |
---|---|
satype_recorded_audio | |
satype_live_audio | |
satype_overlap_audio |
dpp::discord_voice_client::discord_voice_client | ( | dpp::cluster * | _cluster, |
snowflake | _channel_id, | ||
snowflake | _server_id, | ||
const std::string & | _token, | ||
const std::string & | _session_id, | ||
const std::string & | _host | ||
) |
Constructor takes shard id, max shards and token.
_cluster | The cluster which owns this voice connection, for related logging, REST requests etc |
_channel_id | The channel id to identify the voice connection as |
_server_id | The server id (guild id) to identify the voice connection as |
_token | The voice session token to use for identifying to the websocket |
_session_id | The voice session id to identify with |
_host | The voice server hostname to connect to (hostname:port format) |
dpp::voice_exception | Sodium or Opus failed to initialise, or D++ is not compiled with voice support |
References dpp::websocket_client::connect(), dpp::err_no_voice_support, dpp::err_opus, dpp::err_sodium, dpp::opus_channel_count, dpp::opus_sample_rate_hz, and sodium_initialised.
|
virtual |
Destroy the discord voice client object.
|
virtualinherited |
Close websocket.
Reimplemented from dpp::ssl_client.
Referenced by dpp::discord_client::handle_frame().
|
protectedvirtualinherited |
(Re)connect
Reimplemented from dpp::ssl_client.
Referenced by dpp::discord_client::discord_client(), discord_voice_client(), and discover_ip().
std::string dpp::discord_voice_client::discover_ip | ( | ) |
Discord external IP detection.
References dpp::close_socket(), dpp::websocket_client::connect(), dpp::ll_warning, log(), and SOCKET_ERROR.
Referenced by handle_frame().
|
virtual |
Handle a websocket error.
errorcode | The error returned from the websocket |
Reimplemented from dpp::websocket_client.
References channel_id, dpp::ll_error, dpp::ll_warning, log(), stop_audio(), and terminating.
|
inherited |
|
inherited |
Get the bytes out objectGet total bytes sent.
References dpp::ssl_client::bytes_out.
|
inherited |
uint16_t dpp::discord_voice_client::get_iteration_interval | ( | ) |
Get the iteration interval time (in milliseconds).
References iteration_interval.
const std::vector< std::string > dpp::discord_voice_client::get_marker_metadata | ( | ) |
Get the metadata string associated with each inserted marker.
dpp::utility::uptime dpp::discord_voice_client::get_remaining | ( | ) |
Get the time remaining to send the audio output buffer in hours:minutes:seconds.
References get_secs_remaining().
float dpp::discord_voice_client::get_secs_remaining | ( | ) |
Get the number of seconds remaining of the audio output buffer.
References dpp::unicode_emoji::lock.
Referenced by get_remaining().
|
protectedinherited |
Get websocket state.
References dpp::WS_MASKBIT.
Referenced by dpp::discord_client::is_connected(), is_connected(), and one_second_timer().
uint64_t dpp::discord_voice_client::get_timescale | ( | ) |
Get the current timescale, this will default to 1000000 which means 1 millisecond.
uint32_t dpp::discord_voice_client::get_tracks_remaining | ( | ) |
Get the number of tracks remaining in the output buffer.
This is calculated by the number of track markers plus one.
References dpp::unicode_emoji::lock.
dpp::utility::uptime dpp::discord_voice_client::get_uptime | ( | ) |
Returns the connection time of the voice client.
|
virtualinherited |
Processes incoming frames from the SSL socket input buffer.
buffer | The buffer contents. Can modify this value removing the head elements when processed. |
Reimplemented from dpp::ssl_client.
References dpp::CONNECTED.
|
virtual |
Handle JSON from the websocket.
buffer | The entire buffer content from the websocket client |
dpp::exception | If there was an error processing the frame, or connection to UDP socket failed |
Reimplemented from dpp::websocket_client.
References channel_id, creator, dpp::ssl_client::custom_readable_fd, dpp::ssl_client::custom_readable_ready, dpp::ssl_client::custom_writeable_fd, dpp::ssl_client::custom_writeable_ready, discover_ip(), dpp::err_bind_failure, dpp::err_nonblocking_failure, dpp::external_ip, heartbeat_interval, dpp::managed::id, dpp::ll_debug, dpp::ll_error, dpp::ll_trace, log(), dpp::unicode_emoji::m, dpp::cluster::me, dpp::cluster::on_voice_client_disconnect, dpp::cluster::on_voice_client_speaking, dpp::cluster::on_voice_ready, send_silence(), server_id, sessionid, dpp::set_nonblocking(), dpp::snowflake_not_null(), dpp::voice_client_speaking_t::ssrc, token, dpp::voice_client_speaking_t::user_id, dpp::voice_client_disconnect_t::user_id, dpp::voice_ready_t::voice_channel_id, dpp::voice_ready_t::voice_client, dpp::voice_client_speaking_t::voice_client, dpp::voice_client_disconnect_t::voice_client, and dpp::websocket_client::write().
discord_voice_client & dpp::discord_voice_client::insert_marker | ( | const std::string & | metadata = "" | ) |
Insert a track marker into the audio output buffer.
A track marker is an arbitrary flag in the buffer contents that indicates the end of some block of audio of significance to the sender. This may be a song from a streaming site, or some voice audio/speech, a sound effect, or whatever you choose. You can later skip to the next marker using the dpp::discord_voice_client::skip_to_next_marker function.
metadata | Arbitrary information related to this track |
References AUDIO_TRACK_MARKER, dpp::unicode_emoji::lock, and dpp::unicode_emoji::tm.
bool dpp::discord_voice_client::is_connected | ( | ) |
Returns true if the voice client is connected to the websocket.
References dpp::CONNECTED, and dpp::websocket_client::get_state().
bool dpp::discord_voice_client::is_paused | ( | ) |
Returns true if the audio is paused.
You can unpause with dpp::discord_voice_client::pause_audio.
bool dpp::discord_voice_client::is_playing | ( | ) |
Returns true if we are playing audio.
References dpp::unicode_emoji::lock.
bool dpp::discord_voice_client::is_ready | ( | ) |
voice client is ready to stream audio.
The voice client is considered ready if it has a secret key.
|
virtual |
Log a message to whatever log the user is using.
The logged message is passed up the chain to the on_log event in user code which can then do whatever it wants to do with it.
severity | The log level from dpp::loglevel |
msg | The log message to output |
Reimplemented from dpp::ssl_client.
References creator, and dpp::cluster::log().
Referenced by discover_ip(), error(), and handle_frame().
|
virtual |
Fires every second from the underlying socket I/O loop, used for sending heartbeats.
dpp::exception | if the socket needs to disconnect |
Reimplemented from dpp::websocket_client.
References dpp::CONNECTED, dpp::err_voice_terminating, dpp::websocket_client::get_state(), heartbeat_interval, last_heartbeat, terminating, dpp::websocket_client::write(), and dpp::unicode_emoji::x.
discord_voice_client & dpp::discord_voice_client::pause_audio | ( | bool | pause | ) |
Pause sending of audio.
pause | True to pause, false to resume |
|
inherited |
Nonblocking I/O loop.
std::exception | Any std::exception (or derivative) thrown from read_loop() causes reconnection of the shard |
References dpp::ssl_client::buffer, dpp::ssl_client::bytes_in, dpp::ssl_client::bytes_out, dpp::ssl_client::custom_readable_fd, dpp::ssl_client::custom_readable_ready, dpp::ssl_client::custom_writeable_fd, dpp::ssl_client::custom_writeable_ready, DPP_BUFSIZE, dpp::err_invalid_socket, dpp::err_nonblocking_failure, dpp::err_socket_error, dpp::ssl_client::handle_buffer(), INVALID_SOCKET, dpp::ssl_client::last_tick, dpp::ll_warning, dpp::ssl_client::log(), dpp::ssl_client::nonblocking, dpp::ssl_client::obuffer, dpp::ssl_client::one_second_timer(), dpp::ssl_client::plaintext, dpp::set_nonblocking(), dpp::ssl_client::sfd, dpp::openssl_connection::ssl, and dpp::ssl_client::ssl.
void dpp::discord_voice_client::run | ( | ) |
Start and monitor I/O loop.
References dpp::unicode_emoji::thread, and thread_id.
Referenced by dpp::voiceconn::connect().
discord_voice_client & dpp::discord_voice_client::send_audio_opus | ( | uint8_t * | opus_packet, |
const size_t | length | ||
) |
Send opus packets to the voice channel.
Some containers such as .ogg may contain OPUS encoded data already. In this case, we don't need to encode the frames using opus here. We can bypass the codec, only applying libsodium to the stream.
Duration is calculated internally
opus_packet | Opus packets. Discord expects opus frames to be encoded at 48000Hz |
length | The length of the audio data. |
dpp::voice_exception | If data length is invalid or voice support not compiled into D++ |
References dpp::err_no_voice_support, dpp::opus_sample_rate_hz, and send_audio_opus().
discord_voice_client & dpp::discord_voice_client::send_audio_opus | ( | uint8_t * | opus_packet, |
const size_t | length, | ||
uint64_t | duration | ||
) |
Send opus packets to the voice channel.
Some containers such as .ogg may contain OPUS encoded data already. In this case, we don't need to encode the frames using opus here. We can bypass the codec, only applying libsodium to the stream.
opus_packet | Opus packets. Discord expects opus frames to be encoded at 48000Hz |
length | The length of the audio data. |
duration | Generally duration is 2.5, 5, 10, 20, 40 or 60 if the timescale is 1000000 (1ms) |
dpp::voice_exception | If data length is invalid or voice support not compiled into D++ |
References dpp::err_no_voice_support, and speak().
Referenced by send_audio_opus(), send_audio_raw(), and send_silence().
discord_voice_client & dpp::discord_voice_client::send_audio_raw | ( | uint16_t * | audio_data, |
const size_t | length | ||
) |
Send raw audio to the voice channel.
You should send an audio packet of send_audio_raw_max_length
(11520) bytes. Note that this function can be costly as it has to opus encode the PCM audio on the fly, and also encrypt it with libsodium.
audio_data | Raw PCM audio data. Channels are interleaved, with each channel's amplitude being a 16 bit value. |
length | The length of the audio data. The length should be a multiple of 4 (2x 16 bit stereo channels) with a maximum length of send_audio_raw_max_length , which is a complete opus frame at highest quality. |
Generally when you're streaming and you know there will be more packet to come you should always provide packet data with length of send_audio_raw_max_length
. Silence packet will be appended if length is less than send_audio_raw_max_length
as discord expects to receive such specific packet size. This can cause gaps in your stream resulting in distorted audio if you have more packet to send later on.
dpp::voice_exception | If data length is invalid or voice support not compiled into D++ |
References dpp::err_invalid_voice_packet_length, dpp::err_no_voice_support, send_audio_opus(), and dpp::send_audio_raw_max_length.
|
inherited |
Send OP_CLOSE error code 1000 to the other side of the connection.
This indicates graceful close.
References dpp::ssl_client::close(), and dpp::HTTP_HEADERS.
discord_voice_client & dpp::discord_voice_client::send_silence | ( | const uint64_t | duration | ) |
Send silence to the voice channel.
duration | How long to send silence for. With the standard timescale this is in milliseconds. Allowed values are 2.5, 5, 10, 20, 40 or 60 milliseconds. |
dpp::voice_exception | if voice support is not compiled into D++ |
References send_audio_opus().
Referenced by handle_frame().
discord_voice_client & dpp::discord_voice_client::set_iteration_interval | ( | uint16_t | interval | ) |
Change the iteration interval time.
interval | The time (in milliseconds) between each interval when parsing audio. |
References iteration_interval.
discord_voice_client & dpp::discord_voice_client::set_send_audio_type | ( | send_audio_type_t | type | ) |
Sets the audio type that will be sent with send_audio_* methods.
References dpp::unicode_emoji::lock, and send_audio_type.
discord_voice_client & dpp::discord_voice_client::set_timescale | ( | uint64_t | new_timescale | ) |
Set the timescale in nanoseconds.
new_timescale | Timescale to set. This defaults to 1000000, which means 1 millisecond. |
dpp::voice_exception | If data length is invalid or voice support not compiled into D++ |
void dpp::discord_voice_client::set_user_gain | ( | snowflake | user_id, |
float | factor | ||
) |
Sets the gain for the specified user.
Similar to the User Volume slider, controls the listening volume per user. Uses native Opus gain control, so clients don't have to perform extra audio processing.
The gain setting will affect the both individual and combined voice audio.
The gain value can also be set even before the user connects to the voice channel.
user_id | The ID of the user where the gain is to be controlled. |
factor | Nonnegative factor to scale the amplitude by, where 1.f reverts to the default volume. |
discord_voice_client & dpp::discord_voice_client::skip_to_next_marker | ( | ) |
Skip tp the next track marker, previously inserted by using the dpp::discord_voice_client::insert_marker function.
If there are no markers in the output buffer, then this skips to the end of the buffer and is equivalent to the dpp::discord_voice_client::stop_audio function.
References dpp::unicode_emoji::lock, and dpp::unicode_emoji::v.
discord_voice_client & dpp::discord_voice_client::speak | ( | ) |
Mark the voice connection as 'speaking'.
This sends a JSON message to the voice websocket which tells discord that the user is speaking. The library automatically calls this for you whenever you send audio.
Referenced by send_audio_opus().
discord_voice_client & dpp::discord_voice_client::stop_audio | ( | ) |
Immediately stop all audio.
Clears the packet queue.
References dpp::unicode_emoji::lock.
Referenced by error().
|
virtualinherited |
Write to websocket.
Encapsulates data in frames if the status is CONNECTED.
data | The data to send. |
Reimplemented from dpp::ssl_client.
Referenced by dpp::discord_client::handle_frame(), handle_frame(), dpp::discord_client::one_second_timer(), one_second_timer(), and dpp::websocket_client::websocket_client().
|
protectedinherited |
Input buffer received from socket.
Referenced by dpp::ssl_client::close(), dpp::discord_client::handle_frame(), and dpp::ssl_client::read_loop().
|
protectedinherited |
Bytes in.
Referenced by dpp::ssl_client::get_bytes_in(), and dpp::ssl_client::read_loop().
|
protectedinherited |
Bytes out.
Referenced by dpp::ssl_client::get_bytes_out(), and dpp::ssl_client::read_loop().
snowflake dpp::discord_voice_client::channel_id |
Channel ID.
Referenced by error(), and handle_frame().
|
protectedinherited |
SSL cipher in use.
Referenced by dpp::ssl_client::connect(), and dpp::ssl_client::get_cipher().
class dpp::cluster* dpp::discord_voice_client::creator |
Owning cluster.
Referenced by handle_frame(), and log().
float dpp::discord_voice_client::current_gain |
The gain value for the current voice iteration.
|
inherited |
Attaching an additional file descriptor to this function will send notifications when there is data to read.
NOTE: Only hook this if you NEED it as it can increase CPU usage of the thread! Returning -1 means that you don't want to be notified.
Referenced by handle_frame(), and dpp::ssl_client::read_loop().
|
inherited |
This event will be called when you can read from the custom fd.
Referenced by handle_frame(), and dpp::ssl_client::read_loop().
|
inherited |
Attaching an additional file descriptor to this function will send notifications when you are able to write to the socket.
NOTE: Only hook this if you NEED it as it can increase CPU usage of the thread! You should toggle this to -1 when you do not have anything to write otherwise it'll keep triggering repeatedly (it is level triggered).
Referenced by handle_frame(), and dpp::ssl_client::read_loop().
|
inherited |
This event will be called when you can write to a custom fd.
Referenced by handle_frame(), and dpp::ssl_client::read_loop().
float dpp::discord_voice_client::end_gain |
The gain value for the end of the current voice iteration.
uint32_t dpp::discord_voice_client::heartbeat_interval |
Heartbeat interval for sending heartbeat keepalive.
Referenced by handle_frame(), and one_second_timer().
|
protectedinherited |
Hostname connected to.
Referenced by dpp::ssl_client::close(), dpp::ssl_client::connect(), and dpp::ssl_client::ssl_client().
float dpp::discord_voice_client::increment |
The amount to increment each successive sample for, for the current voice iteration.
uint16_t dpp::discord_voice_client::iteration_interval {500} |
The time (in milliseconds) between each interval when parsing audio.
Referenced by get_iteration_interval(), and set_iteration_interval().
|
inherited |
True if we are keeping the connection alive after it has finished.
Referenced by dpp::ssl_client::close(), and dpp::ssl_client::ssl_client().
time_t dpp::discord_voice_client::last_heartbeat |
Last voice channel websocket heartbeat.
Referenced by one_second_timer().
|
protectedinherited |
For timers.
Referenced by dpp::ssl_client::read_loop().
|
protectedinherited |
True if we are establishing a new connection, false if otherwise.
Referenced by dpp::ssl_client::connect(), and dpp::ssl_client::ssl_client().
moving_averager dpp::discord_voice_client::moving_average |
Moving averager.
|
protectedinherited |
True if in nonblocking mode.
The socket switches to nonblocking mode once ReadLoop is called.
Referenced by dpp::ssl_client::connect(), dpp::ssl_client::read_loop(), and dpp::ssl_client::write().
|
protectedinherited |
Output buffer for sending to socket.
Referenced by dpp::ssl_client::close(), dpp::ssl_client::read_loop(), and dpp::ssl_client::write().
|
protectedinherited |
True for a plain text connection.
Referenced by dpp::ssl_client::close(), dpp::ssl_client::connect(), dpp::ssl_client::read_loop(), dpp::ssl_client::ssl_client(), and dpp::ssl_client::write().
enum dpp::discord_voice_client::send_audio_type_t dpp::discord_voice_client::send_audio_type |
Referenced by set_send_audio_type().
snowflake dpp::discord_voice_client::server_id |
Server ID.
Referenced by handle_frame().
std::string dpp::discord_voice_client::sessionid |
Discord voice session id.
Referenced by handle_frame().
|
protectedinherited |
Raw file descriptor of connection.
Referenced by dpp::ssl_client::close(), dpp::ssl_client::connect(), dpp::discord_client::one_second_timer(), dpp::ssl_client::read_loop(), dpp::ssl_client::ssl_client(), and dpp::ssl_client::write().
|
static |
This needs to be static, we only initialise libsodium once per program start, so initialising it on first use in a voice connection is best.
Referenced by discord_voice_client().
|
protectedinherited |
Openssl opaque contexts.
Referenced by dpp::ssl_client::close(), dpp::ssl_client::connect(), dpp::ssl_client::read_loop(), dpp::ssl_client::ssl_client(), and dpp::ssl_client::write().
bool dpp::discord_voice_client::terminating |
True when the thread is shutting down.
Referenced by error(), and one_second_timer().
std::thread::native_handle_type dpp::discord_voice_client::thread_id |
Thread ID.
Referenced by run().
std::string dpp::discord_voice_client::token |
Discord voice session token.
Referenced by handle_frame().