Go to the source code of this file.
Data Structures | |
| struct | tox_instance_t |
| struct | tox_web_request_config_t |
| struct | tox_config_t |
Macros | |
| #define | TOX_VERSION "1.9.0" |
Functions | |
| TOX_DEF_PREFIX TOX_ERROR | tox_global_init (void) |
| TOX_DEF_PREFIX TOX_ERROR | tox_init_default_web_config (tox_web_request_config_t *config) |
| TOX_DEF_PREFIX TOX_ERROR | tox_global_init_with_web_config (const tox_web_request_config_t *config) |
| TOX_DEF_PREFIX TOX_ERROR | tox_global_cleanup (void) |
| TOX_DEF_PREFIX const char * | tox_error_name (TOX_ERROR error) |
| TOX_DEF_PREFIX TOX_ERROR | tox_create_instance (tox_instance_t *tox_instance_ptr, const tox_config_t *tox_config_ptr) |
| TOX_DEF_PREFIX TOX_ERROR | tox_destroy_instance (tox_instance_t *tox_instance_ptr) |
| TOX_DEF_PREFIX TOX_ERROR | tox_set_session_name (tox_instance_t *tox_instance_ptr, const char *session_name_unique) |
| TOX_DEF_PREFIX TOX_ERROR | tox_join_session (tox_instance_t *tox_instance_ptr, const char *session_name_unique) |
| TOX_DEF_PREFIX TOX_ERROR | tox_leave_session (tox_instance_t *tox_instance_ptr) |
| TOX_DEF_PREFIX TOX_ERROR | tox_get_internal_player_uuid (tox_instance_t *tox_instance_ptr, const char **internal_player_uuid) |
| TOX_DEF_PREFIX TOX_ERROR | tox_set_player_alias (tox_instance_t *tox_instance_ptr, const char *player_alias) |
| TOX_DEF_PREFIX TOX_ERROR | tox_get_internal_session_uuid (tox_instance_t *tox_instance_ptr, const char **internal_session_uuid) |
| TOX_DEF_PREFIX TOX_ERROR | tox_set_session_alias (tox_instance_t *tox_instance_ptr, const char *session_alias) |
| TOX_DEF_PREFIX TOX_ERROR | tox_add_structured_player_data (tox_instance_t *tox_instance_ptr, TOX_PLAYER_DATA_TYPE data_type, const char *data) |
| TOX_DEF_PREFIX TOX_ERROR | tox_add_structured_session_data (tox_instance_t *tox_instance_ptr, TOX_SESSION_DATA_TYPE data_type, const char *language) |
| TOX_DEF_PREFIX TOX_ERROR | tox_add_session_data (tox_instance_t *tox_instance_ptr, const char *session_data) |
| TOX_DEF_PREFIX TOX_ERROR | tox_set_proximity_chat_player_can_hear (tox_instance_t *tox_instance_ptr, const char *const *players, unsigned int num_players) |
| TOX_DEF_PREFIX TOX_ERROR | tox_set_proximity_chat_can_hear_player (tox_instance_t *tox_instance_ptr, const char *const *players, unsigned int num_players) |
| TOX_DEF_PREFIX TOX_ERROR | tox_set_global_muted (tox_instance_t *tox_instance_ptr, int muted) |
| TOX_DEF_PREFIX TOX_ERROR | tox_set_player_muted (tox_instance_t *tox_instance_ptr, const char *player, int muted) |
| TOX_DEF_PREFIX TOX_ERROR | tox_set_players_muted_at_join (tox_instance_t *tox_instance_ptr, const char *const *players, unsigned int num_players) |
| TOX_DEF_PREFIX TOX_ERROR | tox_add_audio_float (tox_instance_t *tox_instance_ptr, const float *audio, unsigned int num_samples, unsigned int sample_rate, unsigned int num_channels) |
| TOX_DEF_PREFIX TOX_ERROR | tox_add_audio_short (tox_instance_t *tox_instance_ptr, const short *audio, unsigned int num_samples, unsigned int sample_rate, unsigned int num_channels) |
| TOX_DEF_PREFIX TOX_ERROR | tox_add_audio (tox_instance_t *tox_instance_ptr, const float *audio, unsigned int num_samples, unsigned int sample_rate) |
| TOX_DEF_PREFIX TOX_ERROR | tox_add_audio_nonrealtime_float (tox_instance_t *tox_instance_ptr, const float *audio, unsigned int num_samples, unsigned int sample_rate, unsigned int num_channels) |
| TOX_DEF_PREFIX TOX_ERROR | tox_add_audio_nonrealtime_short (tox_instance_t *tox_instance_ptr, const short *audio, unsigned int num_samples, unsigned int sample_rate, unsigned int num_channels) |
| TOX_DEF_PREFIX TOX_ERROR | tox_add_audio_nonrealtime (tox_instance_t *tox_instance_ptr, const float *audio, unsigned int num_samples, unsigned int sample_rate) |
| TOX_DEF_PREFIX TOX_ERROR | tox_set_single_tenant_prefix (tox_instance_t *tox_instance_ptr, const char *prefix) |
| TOX_DEF_PREFIX TOX_ERROR | tox_set_log_info_callback (void(*log_info_callback)(const char *)) |
| TOX_DEF_PREFIX TOX_ERROR | tox_set_log_error_callback (void(*log_error_callback)(const char *)) |
| TOX_DEF_PREFIX const char * | tox_get_version (void) |
| TOX_DEF_PREFIX TOX_ERROR | tox_set_instance_token (tox_instance_t *tox_instance_ptr, const char *token) |
| #define TOX_VERSION "1.9.0" |
The version of the tox library - this updates anytime Modulate ships a new libtox with bugfixes, performance improvements, API changes, etc.
ToxMod follows semantic versioning, therefore:
| enum TOX_TRIAGE_SETTING |
Option to select what level of on-device triage the ToxMod library uses.
The choice between triage configuration options is purely technical and will not affect your ToxMod usage or pricing. We’ve found that most of our customers prefer to stay as close to zero compute/memory as possible, and therefore choose the TOX_NONE configuration.
| enum TOX_ERROR |
Error value responses from ToxMod functions; use tox_error_name() to get related message on error.
| Enumerator | |
|---|---|
| TOX_NO_ERROR | Default return value for successful function calls. |
| TOX_UNKNOWN_ERROR | Returned in case of internal library errors, and should not be encountered during normal use of the SDK. |
| TOX_BAD_INSTANCE | returned if the tox_server_instance_t parameter was not initialized by tox_server_create_instance(), or has otherwise become corrupted. |
| TOX_BAD_CONFIG | Returned if a null tox_server_config_t is used |
| TOX_BAD_ACCOUNT_UUID | Returned if an account UUID is null |
| TOX_BAD_API_KEY | Returned if an operation was performed using a null API key |
| TOX_BAD_PLAYER_NAME | Returned if a null session name is passed |
| TOX_BAD_SESSION_NAME | Returned if a null session name is passed |
| TOX_BAD_AUDIO | Returned if null audio is passed |
| TOX_BAD_SAMPLE_RATE | Returned if the sample rate is outside of most typical ranges for audio, potentially indicating an error in setting parameter. Here, the check is for valid sample rates between (inclusive) 1,000 Hz and 96,000 Hz. |
| TOX_SAMPLES_SKIPPED | if the internal circular buffer couldn't hold all of the audio samples passed into this function call. This can happen if too many samples are added much faster than realtime - e.g. 50,000 samples added in one function call - since the internal circular buffer is drained by a separate thread several times per second, and only holds approx. 1 second of audio at a time. This return value indicates that there be a skip in the processed/uploaded audio. Large or frequent skips may degrade toxicity detection model performance, and cause difficulty for human moderators. |
| TOX_NO_SESSION_SET | Returned if tox_set_session_name() has not yet been called to set a session name |
| TOX_UPLOAD_METADATA_FAILED | Returned if the player or session name failed to upload (only applicable if tox_config_t.obscure_names is 0). |
| TOX_BAD_TENANT_PREFIX | Returned if the prefix argument is an empty string |
| TOX_BAD_PLAYER_ALIAS | Returned if the player alias is null or empty |
| TOX_BAD_SESSION_ALIAS | Returned if the session alias is null or empty |
| TOX_BAD_SESSION_DATA | Returned if data is null or does not match the structure required for the given data type (e.g. this will be returned if "en-us" is passed as a language preference instead of "en") |
| TOX_ALREADY_IN_SESSION | Returned if player is already in a session |
| TOX_NOT_IN_SESSION | Returned if an operation is performed where a player needs to be in a session but the player is not part of a session |
| TOX_BAD_SESSION_DATA_TYPE | Returned if the data type passed is not an item from TOX_PLAYER_DATA_TYPE |
| TOX_BAD_PLAYER_DATA_TYPE | Returned if the data type passed is not an item from TOX_SESSION_DATA_TYPE |
| TOX_BAD_PLAYER_DATA | Returned if data is null or does not match the structure required for the given data type (e.g. this will be returned if "en-us" is passed as a language preference instead of "en") |
| TOX_BAD_PLAYER_LIST | Returned if passed player list is null but num_players is greater than 0 |
| TOX_PROXIMITY_CHAT_DISABLED | Returned if a proximity chat function is called but tox_config_t.enable_proximity_chat is 0 |
| TOX_BAD_AUTH_MODE | Returned if an attempt is made to use both API key and token authentication features at the same time for the same instance |
| TOX_INCONSISTENT_PROXIMITY_CHAT_UPDATE | Returned if tox_proximity_chat_set_player_can_hear is called after tox_proximity_chat_can_hear_player, or vice versa. Only one of those functions can be used within a given session. |
| enum TOX_PLAYER_DATA_TYPE |
Types of player data that can be uploaded via tox_add_structured_player_data()
Types of session data that can be uploaded via tox_add_structured_session_data()
| TOX_DEF_PREFIX TOX_ERROR tox_global_init | ( | void | ) |
Global state initialization - run once on application startup, before any other tox functions
| TOX_DEF_PREFIX TOX_ERROR tox_init_default_web_config | ( | tox_web_request_config_t * | config | ) |
Initialize a tox_web_request_config_t to default values
| [out] | config | - config object to be initialized to default values |
Example:
| TOX_DEF_PREFIX TOX_ERROR tox_global_init_with_web_config | ( | const tox_web_request_config_t * | config | ) |
Equivalent to tox_global_init() but accepts web framework configuration options
| [in] | config | - Web configuration options |
| TOX_DEF_PREFIX TOX_ERROR tox_global_cleanup | ( | void | ) |
Global state cleanup - run once before application shutdown, after any other tox functions
| TOX_DEF_PREFIX const char * tox_error_name | ( | TOX_ERROR | error | ) |
Return the associated string for a ToxMod error - useful in log messages
| [in] | error | - the tox error for which to retrieve an error string |
| TOX_DEF_PREFIX TOX_ERROR tox_create_instance | ( | tox_instance_t * | tox_instance_ptr, |
| const tox_config_t * | tox_config_ptr ) |
Create a tox_instance to store internal state. Create once before adding audio. The tox_config_t object and its member data are all copied to internal storage, and do not need to be preserved after this function returns.
| [in] | tox_instance_ptr | Pointer to a fresh tox_instance_t |
| [in] | tox_config_ptr | Pointer to a tox_config_t |
Example:
| TOX_DEF_PREFIX TOX_ERROR tox_destroy_instance | ( | tox_instance_t * | tox_instance_ptr | ) |
Destroy a tox_instance to cleanup internal state. Call once before application shutdown
| [in] | tox_instance_ptr | Pointer to the tox_jnstance_t to be destroyed |
| TOX_DEF_PREFIX TOX_ERROR tox_set_session_name | ( | tox_instance_t * | tox_instance_ptr, |
| const char * | session_name_unique ) |
Update the chat room session name - use a unique name (per account_uuid) for a chat room where one or more players are chatting with each other. This would typically be derived from the unique specifier for a chat lobby or room that the player joins in the voice chat system. Used to show the context of a player's voice chat in relation to what other players are saying to/with them. Call this before running tox_add_audio(), and then any time the chat room changes (e.g. if the user joins a new game lobby which uses a new chatroom) The session name is copied to internal storage, and does not need to be preserved after this function returns.
| [in] | tox_instance_ptr | Pointer to the tox_instance_t of the player in question |
| [in] | session_name_unique | Unique name for the new session |
Example:
| TOX_DEF_PREFIX TOX_ERROR tox_join_session | ( | tox_instance_t * | tox_instance_ptr, |
| const char * | session_name_unique ) |
Join a session with the specified name - use a unique name (per account_uuid) for a chat room where one or more players are chatting with each other. This would typically be derived from the unique specifier for a chat lobby or room that the player joins in the voice chat system. Used to show the context of a player's voice chat in relation to what other players are saying to/with them. Call this before running tox_add_audio(), then call tox_leave_session to when the player leaves a session. If a player is switching sessions, first leave and then join again. (e.g. if the user joins a new game lobby which uses a new chatroom). ToxMod only supports a player being in one session at a time, so this function will return an error if the player is already in a session. The session name is copied to internal storage, and does not need to be preserved after this function returns.
| [in] | tox_instance_ptr | Pointer to the tox_instance_t of the player in question |
| [in] | session_name_unique | Unique name for the new session |
| TOX_DEF_PREFIX TOX_ERROR tox_leave_session | ( | tox_instance_t * | tox_instance_ptr | ) |
Leave the current session. If a player is switching sessions, first call this to leave and then call tox_join_session to join the new session. This function will not error if the player is not in a session, so it is always safe to call this before joining a session.
| [in] | tox_instance_ptr | Pointer to the tox_instance_t of the player in question |
| TOX_DEF_PREFIX TOX_ERROR tox_get_internal_player_uuid | ( | tox_instance_t * | tox_instance_ptr, |
| const char ** | internal_player_uuid ) |
Get the ToxMod-internal anonymous UUID associated with the provided player. Retrieving this and storing it in your own database allows you to consume messages from ToxMod (e.g. "a moderator banned <player_uuid>") and relate them back to your internal player database or players' usernames, without ToxMod storing any player usernames. If you don't require ToxMod to not store player usernames, you can avoid storing this relationship yourself by providing ToxMod a player alias which you can consume later - such as the player username or internal database ID - using tox_set_player_alias(), in which case the above messages will alos include the alias (e.g. "a moderator banned <player_uuid>, alias: <player_alias>"). The const char* set by tox_get_internal_player_uuid() points to a valid string allocated in in the internal tox_instance_t object, and remains valid until the tox_instance_t is destroyed in tox_destroy_instance(). If this call returns an error, the const char* returned in *internal_player_uuid is null, NOT a valid string.
| [in] | tox_instance_ptr | Pointer to the tox_instance_t of the player in question |
| [out] | internal_player_uuid | The toxmod internal UUID used to identify the player in question. This will remain valid until the corresponding tox_instance_t is destroyed. |
| TOX_DEF_PREFIX TOX_ERROR tox_set_player_alias | ( | tox_instance_t * | tox_instance_ptr, |
| const char * | player_alias ) |
Save an alias for the associated player within ToxMod's database, to be passed back to you upon moderation actions. This avoids you having to store the ToxMod anonymous id and do the association yourself, as moderation actions will produce messages that you consume with the information "a moderator banned <player_uuid>, alias: <player_alias> The player alias is copied to internal storage, and does not need to be preserved after this function returns. @param [in] tox_instance_ptr Pointer to the tox_instance_t of the player in question @param [in] player_alias alias for the player in question @return + ::TOX_NO_ERROR Function executed successfully + ::TOX_BAD_PLAYER_ALIAS If player_alias is null or empty + ::TOX_UPLOAD_METADATA_FAILED Returned on any error in uploading the player alias to the server, potentially due to issues connecting to the server, initializing cURL for the network request, or invalid credentials used to create the tox_instance_ptr Example: @icode tox_error = tox_set_player_alias(&tox_instance, "player1");
| TOX_DEF_PREFIX TOX_ERROR tox_get_internal_session_uuid | ( | tox_instance_t * | tox_instance_ptr, |
| const char ** | internal_session_uuid ) |
Get the ToxMod-internal anonymous UUID associated with the provided session. This works much like tox_get_internal_player_uuid(), except that it is associated with a session instead of a player. Retrieving and storing the session UUID in your own database allows you to associate the UUID included in moderation messages with your internal session database or sessions' names, without ToxMod storing any session names. Alternatively, you can avoid storing this relationship yourself by providing ToxMod a session alias (i.e. the session name itsef) which will be passed back to you in moderation messages.
| [in] | tox_instance_ptr | Pointer to the tox_instance_t of the player in question |
| [out] | internal_session_uuid | The toxmod internal UUID used to identify the player in question. This will remain valid until the corresponding tox_instance_t is destroyed or tox_leave_session() is called. If this function returns an error, internal_player_uuid will be null and should not be used |
Example:
| TOX_DEF_PREFIX TOX_ERROR tox_set_session_alias | ( | tox_instance_t * | tox_instance_ptr, |
| const char * | session_alias ) |
Save an alias for the associated session within ToxMod's database, to be passed back to you upon moderation actions. This allows you to associate a session name with the conversations shown in the web console rather than the internal UUID ToxMod uses to identify sessions. This function should be called after tox_set_session_name, in order to associate the session alias with the appropriate internal session uuid. The session alias is copied to internal storage, and does not need to be preserved after this function returns.
| [in] | tox_instance_ptr | reference to the tox_instance_t for the player in question |
| [in] | session_alias | alias for the session in question |
Example:
| TOX_DEF_PREFIX TOX_ERROR tox_add_structured_player_data | ( | tox_instance_t * | tox_instance_ptr, |
| TOX_PLAYER_DATA_TYPE | data_type, | ||
| const char * | data ) |
Send additional data about the current player to ToxMod. For a full list of possible data types, see the TOX_PLAYER_DATA_TYPE enum documentation. If the same type of data is sent multiple times, ToxMod will prefer the most recently received value.
| [in] | tox_instance_ptr | Reference to the tox_instance_t for the player in question |
| [in] | data_type | Option from TOX_PLAYER_DATA_TYPE |
| [in] | data | String of data - format will depend on data_type |
Example:
| TOX_DEF_PREFIX TOX_ERROR tox_add_structured_session_data | ( | tox_instance_t * | tox_instance_ptr, |
| TOX_SESSION_DATA_TYPE | data_type, | ||
| const char * | language ) |
Send additional data about the current session to ToxMod. For a full list of possible data types, see the TOX_SESSION_DATA_TYPE enum documentation. If the same type of data is sent multiple times or by multiple players in the same session, ToxMod will prefer the most recently received value.
| [in] | tox_instance_ptr | Pointer to the tox_instance_t corresponding to the player/session in question |
| [in] | data_type | Type of data being sent |
| [in] | language | Data being sent |
TOX_UPLOAD_METADATA_FAILED If there is a problem uploading information to the server
Example:
| TOX_DEF_PREFIX TOX_ERROR tox_add_session_data | ( | tox_instance_t * | tox_instance_ptr, |
| const char * | session_data ) |
Send additional session context/data/events to ToxMod for use in assisting moderation. Since each game has different structure and different relevant events that may contribute to player toxicity, the format for this session data is determined on a per-customer basis. Please reach out to your Modulate account representative for more information. The session data is copied to internal storage, and does not need to be preserved after this function returns.
| [in] | tox_instance_ptr | Pointer to the tox_instance_t corresponding to the player/session in question |
| [in] | session_data | Session data as a string. |
Example:
| TOX_DEF_PREFIX TOX_ERROR tox_set_proximity_chat_player_can_hear | ( | tox_instance_t * | tox_instance_ptr, |
| const char *const * | players, | ||
| unsigned int | num_players ) |
Set a list of players that this player can hear. This should be the full list of players that this player can hear at the time of the function call, and should be called each time that that list changes. For example, if another player leaves proximity chat range and this player can no longer hear them, call this function with the remaining list of players that this player can hear. Use either this function or tox_set_proximity_chat_can_hear_player() to specify proximity chat information, not both.
| [in] | tox_instance_ptr | Pointer to the tox_instance_t corresponding to the current player |
| [in] | players | An array of the player names of the players who are muted-at-join |
| [in] | num_players | Length of the players list |
Example:
| TOX_DEF_PREFIX TOX_ERROR tox_set_proximity_chat_can_hear_player | ( | tox_instance_t * | tox_instance_ptr, |
| const char *const * | players, | ||
| unsigned int | num_players ) |
Set a list of players that can hear this player. This should be the full list of players that can hear this player at the time of the function call, and should be called each time that that list changes. For example, if another player leaves proximity chat range and they can no longer hear this player, call this function with the remaining list of players that can hear this player. Use either this function or tox_set_proximity_chat_player_can_hear() to specify proximity chat information, not both.
| [in] | tox_instance_ptr | Pointer to the tox_instance_t corresponding to the current player |
| [in] | players | An array of the player names of the players who are muted-at-join |
| [in] | num_players | Length of the players list |
Example:
| TOX_DEF_PREFIX TOX_ERROR tox_set_global_muted | ( | tox_instance_t * | tox_instance_ptr, |
| int | muted ) |
Signal to ToxMod that the player associated with an instance has muted or unmuted voice chat entirely.
| [in] | tox_instance_ptr | Pointer to the tox_instance_t corresponding to the current player |
| [in] | muted | 0 signals that voice chat was unmuted, 1 signals that voice chat was muted. |
| TOX_DEF_PREFIX TOX_ERROR tox_set_player_muted | ( | tox_instance_t * | tox_instance_ptr, |
| const char * | player, | ||
| int | muted ) |
Signal to ToxMod that the player associated with an instance has muted or unmuted another player.
| [in] | tox_instance_ptr | Pointer to the tox_instance_t corresponding to the current player |
| [in] | player | The name of the player being muted/unmuted |
| [in] | muted | 0 signals that the player was unmuted, 1 signals that the player was muted. |
| TOX_DEF_PREFIX TOX_ERROR tox_set_players_muted_at_join | ( | tox_instance_t * | tox_instance_ptr, |
| const char *const * | players, | ||
| unsigned int | num_players ) |
Notify ToxMod that the player associated with an instance has a preexisting persistent mute set on one or more players in this session. ToxMod will treat this differently than a call to tox_set_player_muted(), which should be used for real-time muting actions.
This is intended to be called when the associated player joins a session, and again if a player who the associated player has muted joins the session later.
| [in] | tox_instance_ptr | Pointer to the tox_instance_t corresponding to the current player |
| [in] | players | An array of the player names of the players who are muted-at-join |
| [in] | num_players | Length of the players list |
| TOX_DEF_PREFIX TOX_ERROR tox_add_audio_float | ( | tox_instance_t * | tox_instance_ptr, |
| const float * | audio, | ||
| unsigned int | num_samples, | ||
| unsigned int | sample_rate, | ||
| unsigned int | num_channels ) |
Realtime-friendly hook to consume voice chat audio - call this with access to the voice chat stream.
| [in] | tox_instance_ptr | Pointer to the instance created in tox_create_instance() |
| [in] | audio | Pointer to num_samples 32-bit floating point linear PCM audio samples. Should be within the range [-1, 1] |
| [in] | num_samples | The number of audio samples pointed to by audio. This is irrespective of the number of channels in the audio, and is "the sample rate times the number of seconds of audio input". |
| [in] | sample_rate | The sample rate of the audio stream, in Hertz |
| [in] | num_channels | The number of interleaved channels in the input audio buffer |
| TOX_DEF_PREFIX TOX_ERROR tox_add_audio_short | ( | tox_instance_t * | tox_instance_ptr, |
| const short * | audio, | ||
| unsigned int | num_samples, | ||
| unsigned int | sample_rate, | ||
| unsigned int | num_channels ) |
An equivalent function to tox_add_audio_float(), but consuming audio data in 16-bit signed integer linear PCM format (i.e. shorts in the range [-2^15, 2^15-1]). This converts the short values to floats in [-1, 1] internally, and uses the same functionality as tox_add_audio_float().
| [in] | tox_instance_ptr | Pointer to the instance created in tox_create_instance() |
| [in] | audio | Pointer to num_samples 32-bit floating point linear PCM audio samples. Should be within the range [-1, 1] |
| [in] | num_samples | The number of audio samples pointed to by audio. This is irrespective of the number of channels in the audio, and is "the sample rate times the number of seconds of audio input". |
| [in] | sample_rate | The sample rate of the audio stream, in Hertz |
| [in] | num_channels | The number of interleaved channels in the input audio buffer |
| TOX_DEF_PREFIX TOX_ERROR tox_add_audio | ( | tox_instance_t * | tox_instance_ptr, |
| const float * | audio, | ||
| unsigned int | num_samples, | ||
| unsigned int | sample_rate ) |
| [in] | tox_instance_ptr | Pointer to the instance created in tox_create_instance() |
| [in] | audio | Pointer to num_samples 32-bit floating point linear PCM audio samples. Should be within the range [-1, 1] |
| [in] | num_samples | The number of audio samples pointed to by audio. This is irrespective of the number of channels in the audio, and is "the sample rate times the number of seconds of audio input". |
| [in] | sample_rate | The sample rate of the audio stream, in Hertz |
| TOX_DEF_PREFIX TOX_ERROR tox_add_audio_nonrealtime_float | ( | tox_instance_t * | tox_instance_ptr, |
| const float * | audio, | ||
| unsigned int | num_samples, | ||
| unsigned int | sample_rate, | ||
| unsigned int | num_channels ) |
Non-realtime-friendly hook to consume voice chat audio - call this with access to the voice chat stream.
| [in] | tox_instance_ptr | Pointer to the instance created in tox_create_instance() |
| [in] | audio | Pointer to num_samples 32-bit floating point linear PCM audio samples. Should be within the range [-1, 1] |
| [in] | num_samples | The number of audio samples pointed to by audio. This is irrespective of the number of channels in the audio, and is "the sample rate times the number of seconds of audio input". |
| [in] | sample_rate | The sample rate of the audio stream, in Hertz |
| [in] | num_channels | The number of interleaved channels in the input audio buffer |
| TOX_DEF_PREFIX TOX_ERROR tox_add_audio_nonrealtime_short | ( | tox_instance_t * | tox_instance_ptr, |
| const short * | audio, | ||
| unsigned int | num_samples, | ||
| unsigned int | sample_rate, | ||
| unsigned int | num_channels ) |
An equivalent function to tox_add_audio_nonrealtime_float(), but consuming audio data in 16-bit signed integer linear PCM format (i.e. shorts in the range [-2^15, 2^15-1]). This converts the short values to floats in [-1, 1] internally, and uses the same functionality as tox_add_audio_nonrealtime_float.
| [in] | tox_instance_ptr | Pointer to the instance created in tox_create_instance() |
| [in] | audio | Pointer to num_samples 32-bit floating point linear PCM audio samples. Should be within the range [-1, 1] |
| [in] | num_samples | The number of audio samples pointed to by audio. This is irrespective of the number of channels in the audio, and is "the sample rate times the number of seconds of audio input". |
| [in] | sample_rate | The sample rate of the audio stream, in Hertz |
| [in] | num_channels | The number of interleaved channels in the input audio buffer |
| TOX_DEF_PREFIX TOX_ERROR tox_add_audio_nonrealtime | ( | tox_instance_t * | tox_instance_ptr, |
| const float * | audio, | ||
| unsigned int | num_samples, | ||
| unsigned int | sample_rate ) |
| [in] | tox_instance_ptr | Pointer to the instance created in tox_create_instance() |
| [in] | audio | Pointer to num_samples 32-bit floating point linear PCM audio samples. Should be within the range [-1, 1] |
| [in] | num_samples | The number of audio samples pointed to by audio. This is irrespective of the number of channels in the audio, and is "the sample rate times the number of seconds of audio input". |
| [in] | sample_rate | The sample rate of the audio stream, in Hertz |
| TOX_DEF_PREFIX TOX_ERROR tox_set_single_tenant_prefix | ( | tox_instance_t * | tox_instance_ptr, |
| const char * | prefix ) |
| [in] | tox_instance_ptr | Pointer to the instance created in tox_create_instance() |
| [in] | prefix | Single tenant prefix string |
| TOX_DEF_PREFIX TOX_ERROR tox_set_log_info_callback | ( | void(* | log_info_callback )(const char *) | ) |
Set a user-defined callback to print/log info messages from tox If this is not called, ToxMod will print info messages to stdout
| TOX_DEF_PREFIX TOX_ERROR tox_set_log_error_callback | ( | void(* | log_error_callback )(const char *) | ) |
Set a user-defined callback to print/log error messages from tox If this is not called, ToxMod will print error messages to stderr
| TOX_DEF_PREFIX const char * tox_get_version | ( | void | ) |
Return the version string for the library that this is built with
Should match TOX_VERSION
| TOX_DEF_PREFIX TOX_ERROR tox_set_instance_token | ( | tox_instance_t * | tox_instance_ptr, |
| const char * | token ) |
Set or refresh the token a given instance uses to authenticate. The token provided should conform to the ToxMod JWT authentication spec provided in the web console.
| [in] | tox_instance_ptr | Pointer to the instance created in tox_create_instance() |
| [in] | token | JWT meeting the spec on the web console. If an empty string or null pointer is passed, this will clear the existing token from memory and future web requests will fail until a valid token is passed. |