Discord Social SDK
|
Class that manages an active voice session in a Lobby.
Public Member Functions | |
Call (Call &&other) noexcept | |
Move constructor for Call. | |
Call & | operator= (Call &&other) noexcept |
Move assignment operator for Call. | |
operator bool () const | |
Returns true if the instance contains a valid object. | |
Call (const Call &other) | |
Copy constructor for Call. | |
Call & | operator= (const Call &other) |
Copy assignment operator for Call. | |
discordpp::AudioModeType | GetAudioMode () |
Returns whether the call is configured to use voice auto detection or push to talk for the current user. | |
uint64_t | GetChannelId () const |
Returns the ID of the lobby with which this call is associated. | |
uint64_t | GetGuildId () const |
Returns the ID of the lobby with which this call is associated. | |
bool | GetLocalMute (uint64_t userId) |
Returns whether the current user has locally muted the given userId for themselves. | |
std::vector< uint64_t > | GetParticipants () const |
Returns a list of all of the user IDs of the participants in the call. | |
float | GetParticipantVolume (uint64_t userId) |
Returns the locally set playout volume of the given userId. | |
bool | GetPTTActive () |
Returns whether push to talk is currently active, meaning the user is currently pressing their configured push to talk key. | |
uint32_t | GetPTTReleaseDelay () |
Returns the time that PTT is active after the user releases the PTT key and SetPTTActive(false) is called. | |
bool | GetSelfDeaf () |
Returns whether the current user is deafened. | |
bool | GetSelfMute () |
Returns whether the current user's microphone is muted. | |
discordpp::Call::Status | GetStatus () const |
Returns the current call status. | |
discordpp::VADThresholdSettings | GetVADThreshold () const |
Returns the current configuration for void auto detection thresholds. See the description of the VADThreshold struct for specifics. | |
std::optional< discordpp::VoiceStateHandle > | GetVoiceStateHandle (uint64_t userId) const |
Returns a reference to the VoiceStateHandle for the user ID of the given call participant. | |
void | SetAudioMode (discordpp::AudioModeType audioMode) |
Sets whether to use voice auto detection or push to talk for the current user on this call. | |
void | SetLocalMute (uint64_t userId, bool mute) |
Locally mutes the given userId, so that the current user cannot hear them anymore. | |
void | SetOnVoiceStateChangedCallback (discordpp::Call::OnVoiceStateChanged cb) |
Sets a callback function to generally be invoked whenever a field on a VoiceStateHandle object for a user would have changed. | |
void | SetParticipantChangedCallback (discordpp::Call::OnParticipantChanged cb) |
Sets a callback function to be invoked whenever some joins or leaves a voice call. | |
void | SetParticipantVolume (uint64_t userId, float volume) |
Locally changes the playout volume of the given userId. | |
void | SetPTTActive (bool active) |
When push to talk is enabled, this should be called whenever the user pushes or releases their configured push to talk key. This key must be configured in the game, the SDK does not handle keybinds itself. | |
void | SetPTTReleaseDelay (uint32_t releaseDelayMs) |
If set, extends the time that PTT is active after the user releases the PTT key and SetPTTActive(false) is called. | |
void | SetSelfDeaf (bool deaf) |
Mutes all audio from the currently active call for the current user. They will not be able to hear any other participants, and no other participants will be able to hear the current user either. | |
void | SetSelfMute (bool mute) |
Mutes the current user's microphone so that no other participant in their active calls can hear them. | |
void | SetSpeakingStatusChangedCallback (discordpp::Call::OnSpeakingStatusChanged cb) |
Sets a callback function to be invoked whenever a user starts or stops speaking and is passed in the userId and whether they are currently speaking. | |
void | SetStatusChangedCallback (discordpp::Call::OnStatusChanged cb) |
Sets a callback function to be invoked when the call status changes, such as when it fully connects or starts reconnecting. | |
void | SetVADThreshold (bool automatic, float threshold) |
Customizes the void auto detection thresholds for picking up activity from a user's mic. | |
Public Types | |
enum class | Error { None = 0 , SignalingConnectionFailed = 1 , SignalingUnexpectedClose = 2 , VoiceConnectionFailed = 3 , JoinTimeout = 4 , Forbidden = 5 } |
Enum that represents any network errors with the Call. More... | |
enum class | Status { Disconnected = 0 , Joining = 1 , Connecting = 2 , SignalingConnected = 3 , Connected = 4 , Reconnecting = 5 , Disconnecting = 6 } |
Enum that respresents the state of the Call's network connection. More... | |
using | OnVoiceStateChanged = std::function<void(uint64_t userId)> |
Callback function for Call::SetOnVoiceStateChangedCallback. | |
using | OnParticipantChanged = std::function<void(uint64_t userId, bool added)> |
Callback function for Call::SetParticipantChangedCallback. | |
using | OnSpeakingStatusChanged = std::function<void(uint64_t userId, bool isPlayingSound)> |
Callback function for Call::SetSpeakingStatusChangedCallback. | |
using | OnStatusChanged |
Callback function for Call::SetStatusChangedCallback. | |
Static Public Member Functions | |
static std::string | ErrorToString (discordpp::Call::Error type) |
Converts the Error enum to a string. | |
static std::string | StatusToString (discordpp::Call::Status type) |
Converts the Status enum to a string. | |
Static Public Attributes | |
static const Call | nullobj |
Uninitialized instance of Call. | |
using discordpp::Call::OnParticipantChanged = std::function<void(uint64_t userId, bool added)> |
Callback function for Call::SetParticipantChangedCallback.
using discordpp::Call::OnSpeakingStatusChanged = std::function<void(uint64_t userId, bool isPlayingSound)> |
Callback function for Call::SetSpeakingStatusChangedCallback.
Callback function for Call::SetStatusChangedCallback.
using discordpp::Call::OnVoiceStateChanged = std::function<void(uint64_t userId)> |
Callback function for Call::SetOnVoiceStateChangedCallback.
|
strong |
Enum that represents any network errors with the Call.
|
strong |
Enum that respresents the state of the Call's network connection.
|
static |
Converts the Error enum to a string.
discordpp::AudioModeType discordpp::Call::GetAudioMode | ( | ) |
Returns whether the call is configured to use voice auto detection or push to talk for the current user.
uint64_t discordpp::Call::GetChannelId | ( | ) | const |
Returns the ID of the lobby with which this call is associated.
uint64_t discordpp::Call::GetGuildId | ( | ) | const |
Returns the ID of the lobby with which this call is associated.
bool discordpp::Call::GetLocalMute | ( | uint64_t | userId | ) |
Returns whether the current user has locally muted the given userId for themselves.
std::vector< uint64_t > discordpp::Call::GetParticipants | ( | ) | const |
Returns a list of all of the user IDs of the participants in the call.
float discordpp::Call::GetParticipantVolume | ( | uint64_t | userId | ) |
Returns the locally set playout volume of the given userId.
Does not affect the volume of this user for any other connected clients. The range of volume is [0, 200], where 100 indicate default audio volume of the playback device.
bool discordpp::Call::GetPTTActive | ( | ) |
Returns whether push to talk is currently active, meaning the user is currently pressing their configured push to talk key.
uint32_t discordpp::Call::GetPTTReleaseDelay | ( | ) |
Returns the time that PTT is active after the user releases the PTT key and SetPTTActive(false) is called.
bool discordpp::Call::GetSelfDeaf | ( | ) |
Returns whether the current user is deafened.
bool discordpp::Call::GetSelfMute | ( | ) |
Returns whether the current user's microphone is muted.
discordpp::Call::Status discordpp::Call::GetStatus | ( | ) | const |
Returns the current call status.
A call is not ready to be used until the status changes to "Connected".
discordpp::VADThresholdSettings discordpp::Call::GetVADThreshold | ( | ) | const |
Returns the current configuration for void auto detection thresholds. See the description of the VADThreshold struct for specifics.
std::optional< discordpp::VoiceStateHandle > discordpp::Call::GetVoiceStateHandle | ( | uint64_t | userId | ) | const |
Returns a reference to the VoiceStateHandle for the user ID of the given call participant.
The VoiceStateHandle allows other users to know if the target user has muted or deafened themselves.
|
inline |
Returns true if the instance contains a valid object.
void discordpp::Call::SetAudioMode | ( | discordpp::AudioModeType | audioMode | ) |
Sets whether to use voice auto detection or push to talk for the current user on this call.
If using push to talk you should call SetPTTActive() whenever the user presses their confused push to talk key.
void discordpp::Call::SetLocalMute | ( | uint64_t | userId, |
bool | mute ) |
Locally mutes the given userId, so that the current user cannot hear them anymore.
Does not affect whether the given user is muted for any other connected clients.
void discordpp::Call::SetOnVoiceStateChangedCallback | ( | discordpp::Call::OnVoiceStateChanged | cb | ) |
Sets a callback function to generally be invoked whenever a field on a VoiceStateHandle object for a user would have changed.
For example when a user mutes themselves, all other connected clients will invoke the VoiceStateChanged callback, because the "self mute" field will be true now. The callback is generally not invoked when users join or leave channels.
void discordpp::Call::SetParticipantChangedCallback | ( | discordpp::Call::OnParticipantChanged | cb | ) |
Sets a callback function to be invoked whenever some joins or leaves a voice call.
void discordpp::Call::SetParticipantVolume | ( | uint64_t | userId, |
float | volume ) |
Locally changes the playout volume of the given userId.
Does not affect the volume of this user for any other connected clients. The range of volume is [0, 200], where 100 indicate default audio volume of the playback device.
void discordpp::Call::SetPTTActive | ( | bool | active | ) |
When push to talk is enabled, this should be called whenever the user pushes or releases their configured push to talk key. This key must be configured in the game, the SDK does not handle keybinds itself.
void discordpp::Call::SetPTTReleaseDelay | ( | uint32_t | releaseDelayMs | ) |
If set, extends the time that PTT is active after the user releases the PTT key and SetPTTActive(false) is called.
Defaults to no release delay, but we recommend setting to 20ms, which is what Discord uses.
void discordpp::Call::SetSelfDeaf | ( | bool | deaf | ) |
Mutes all audio from the currently active call for the current user. They will not be able to hear any other participants, and no other participants will be able to hear the current user either.
void discordpp::Call::SetSelfMute | ( | bool | mute | ) |
Mutes the current user's microphone so that no other participant in their active calls can hear them.
void discordpp::Call::SetSpeakingStatusChangedCallback | ( | discordpp::Call::OnSpeakingStatusChanged | cb | ) |
Sets a callback function to be invoked whenever a user starts or stops speaking and is passed in the userId and whether they are currently speaking.
It can be invoked in other cases as well, such as if the priority speaker changes or if the user plays a soundboard sound.
void discordpp::Call::SetStatusChangedCallback | ( | discordpp::Call::OnStatusChanged | cb | ) |
Sets a callback function to be invoked when the call status changes, such as when it fully connects or starts reconnecting.
void discordpp::Call::SetVADThreshold | ( | bool | automatic, |
float | threshold ) |
Customizes the void auto detection thresholds for picking up activity from a user's mic.
|
static |
Converts the Status enum to a string.