Class VoiceManager
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionGets the current voice input mode of the user.int
getLocalVolume
(long userId) Gets the local volume adjustment for the user with the given ID.boolean
isLocalMute
(long userId) Checks if a user with a given ID is locally muted by the current user.boolean
Gets whether the current user has deafened themselves.boolean
Gets whether the current user has muted themselves.void
setInputMode
(VoiceInputMode inputMode) Sets a new voice input mode for the current user.void
setInputMode
(VoiceInputMode inputMode, Consumer<Result> callback) Sets a new voice input mode for the current user.void
setLocalMute
(long userId, boolean mute) Locally mutes or unmutes the user with the given ID.void
setLocalVolume
(long userId, int volume) Adjust the volume for a given user id locally.void
setSelfDeaf
(boolean selfDeaf) Deafens or undeafens the current user (self deaf).void
setSelfMute
(boolean selfMute) Mutes or unmutes the current user (self mute).
-
Method Details
-
getInputMode
Gets the current voice input mode of the user.This method only returns a copy of the input mode. Modifying it will not affect the current voice input mode unless you use
setInputMode(VoiceInputMode, Consumer)
.- Returns:
- The current
VoiceInputMode
- Throws:
GameSDKException
- for aResult
that is notResult.OK
- See Also:
-
setInputMode
Sets a new voice input mode for the current user.Discord checks the validity of the
VoiceInputMode.getShortcut()
and e.g. removes illegal keys (no error is thrown). However, the plausibility is not checked, allowing shortcuts to contain the same key multiple times and to be composed of as many keys as you can fit into the string (max length is 255 bytes).- Parameters:
inputMode
- The new voice input modecallback
- Callback to process the returnedResult
- See Also:
-
setInputMode
Sets a new voice input mode for the current user.The
Core.DEFAULT_CALLBACK
is used to handle the returnedResult
.- Parameters:
inputMode
- The new voice input mode- See Also:
-
isSelfMute
public boolean isSelfMute()Gets whether the current user has muted themselves.- Returns:
true
if the current user is currently muted- Throws:
GameSDKException
- for aResult
that is notResult.OK
- See Also:
-
setSelfMute
public void setSelfMute(boolean selfMute) Mutes or unmutes the current user (self mute).- Parameters:
selfMute
-true
to mute,false
to unmute- Throws:
GameSDKException
- for aResult
that is notResult.OK
- See Also:
-
isSelfDeaf
public boolean isSelfDeaf()Gets whether the current user has deafened themselves.- Returns:
true
if the current user is currently deafened- Throws:
GameSDKException
- for aResult
that is notResult.OK
- See Also:
-
setSelfDeaf
public void setSelfDeaf(boolean selfDeaf) Deafens or undeafens the current user (self deaf).- Parameters:
selfDeaf
-true
to deafen,false
to undeafen- Throws:
GameSDKException
- for aResult
that is notResult.OK
- See Also:
-
isLocalMute
public boolean isLocalMute(long userId) Checks if a user with a given ID is locally muted by the current user.- Parameters:
userId
- ID of the user to check- Returns:
true
if the user is locally muted- Throws:
GameSDKException
- for aResult
that is notResult.OK
- See Also:
-
setLocalMute
public void setLocalMute(long userId, boolean mute) Locally mutes or unmutes the user with the given ID.- Parameters:
userId
- ID of the user to (un)mutemute
-true
to mute the user,false
to unmute the user- Throws:
GameSDKException
- for aResult
that is notResult.OK
- See Also:
-
getLocalVolume
public int getLocalVolume(long userId) Gets the local volume adjustment for the user with the given ID.A volume of
100
is default. A volume lower than that means that the volume for the given user is reduced (a volume of0
means no sound at all). If the volume is higher than the default, it is boosted (up to200
which is the maximal boost).- Parameters:
userId
- ID of the user to get the volume adjustment for- Returns:
- The volume adjustment in percent, an integer in percent between 0 and 200
- Throws:
GameSDKException
- for aResult
that is notResult.OK
- See Also:
-
setLocalVolume
public void setLocalVolume(long userId, int volume) Adjust the volume for a given user id locally.A volume of
100
is default. A volume lower than that means that the volume for the given user is reduced (a volume of0
means no sound at all). If the volume is higher than the default, it is boosted (up to200
which is the maximal boost).- Parameters:
userId
- ID of the user to adjust the volume forvolume
- New volume adjustment in percent, an integer from 0 to 200- Throws:
GameSDKException
- for aResult
that is notResult.OK
- See Also:
-