Tizen Native API
5.5
|
The STT API provides functions to recognize the speech.
#include <stt.h>
A main function of Speech-To-Text (below STT) API recognizes sound data recorded by users. After choosing a language, applications will start recording and recognizing. After recording, the applications will receive the recognized result. To use of STT, use the following steps:
1. Create a handle
2. Register callback functions for notifications
3. Prepare stt-service asynchronously
4. Start recording for recognition
5. Stop recording
6. Get result after processing
7. Destroy a handle
The STT has a client-server for the service of multi-applications. The STT service always works in the background as a server. If the service is not working, client library will invoke it and client will communicate with it. The service has engines and the recorder so client does not have the recorder itself. Only the client request commands to the STT service for using STT.
The following diagram shows the life cycle and the states of the STT.
FUNCTION | PRE-STATE | POST-STATE | SYNC TYPE |
---|---|---|---|
stt_prepare() | Created | Ready | ASYNC |
stt_start() | Ready | Recording | ASYNC |
stt_stop() | Recording | Processing | ASYNC |
stt_cancel() | Recording or Processing | Ready | ASYNC |
The following table shows state-dependent function calls. It is forbidden to call functions listed below in wrong states. Violation of this rule may result in an unpredictable behavior.
This API is related with the following features:
Functions | |
int | stt_create (stt_h *stt) |
Creates a STT handle. | |
int | stt_destroy (stt_h stt) |
Destroys a STT handle. | |
int | stt_foreach_supported_engines (stt_h stt, stt_supported_engine_cb callback, void *user_data) |
Retrieves supported engine information using a callback function. | |
int | stt_get_engine (stt_h stt, char **engine_id) |
Gets the current engine ID. | |
int | stt_set_engine (stt_h stt, const char *engine_id) |
Sets the engine ID. | |
int | stt_set_credential (stt_h stt, const char *credential) |
Sets the app credential. | |
int | stt_set_private_data (stt_h stt, const char *key, const char *data) |
Sets the private data to stt engine. | |
int | stt_get_private_data (stt_h stt, const char *key, char **data) |
Gets the private data from stt engine. | |
int | stt_prepare (stt_h stt) |
Connects the STT service asynchronously. | |
int | stt_unprepare (stt_h stt) |
Disconnects the STT service. | |
int | stt_foreach_supported_languages (stt_h stt, stt_supported_language_cb callback, void *user_data) |
Retrieves all supported languages of current engine using callback function. | |
int | stt_get_default_language (stt_h stt, char **language) |
Gets the default language set by the user. | |
int | stt_get_state (stt_h stt, stt_state_e *state) |
Gets the current STT state. | |
int | stt_get_error_message (stt_h stt, char **err_msg) |
Gets the current error message. | |
int | stt_is_recognition_type_supported (stt_h stt, const char *type, bool *support) |
Checks whether the recognition type is supported. | |
int | stt_set_silence_detection (stt_h stt, stt_option_silence_detection_e type) |
Sets the silence detection. | |
int | stt_set_start_sound (stt_h stt, const char *filename) |
Sets the sound to start recording. | |
int | stt_unset_start_sound (stt_h stt) |
Unsets the sound to start recording. | |
int | stt_set_stop_sound (stt_h stt, const char *filename) |
Sets the sound to stop recording. | |
int | stt_unset_stop_sound (stt_h stt) |
Unsets the sound to stop recording. | |
int | stt_start (stt_h stt, const char *language, const char *type) |
Starts recording and recognition asynchronously. | |
int | stt_stop (stt_h stt) |
Finishes the recording and starts recognition processing in engine asynchronously. | |
int | stt_cancel (stt_h stt) |
Cancels processing recognition and recording asynchronously. | |
int | stt_get_recording_volume (stt_h stt, float *volume) |
Gets the microphone volume during recording. | |
int | stt_foreach_detailed_result (stt_h stt, stt_result_time_cb callback, void *user_data) |
Retrieves the time stamp of the current recognition result using the callback function. | |
int | stt_set_recognition_result_cb (stt_h stt, stt_recognition_result_cb callback, void *user_data) |
Sets a callback function to get the recognition result. | |
int | stt_unset_recognition_result_cb (stt_h stt) |
Unsets the callback function. | |
int | stt_set_state_changed_cb (stt_h stt, stt_state_changed_cb callback, void *user_data) |
Sets a callback function to be called when STT state changes. | |
int | stt_unset_state_changed_cb (stt_h stt) |
Unsets the callback function. | |
int | stt_set_error_cb (stt_h stt, stt_error_cb callback, void *user_data) |
Sets a callback function to be called when an error occurred. | |
int | stt_unset_error_cb (stt_h stt) |
Unsets the callback function. | |
int | stt_set_default_language_changed_cb (stt_h stt, stt_default_language_changed_cb callback, void *user_data) |
Sets a callback function to detect the default language change. | |
int | stt_unset_default_language_changed_cb (stt_h stt) |
Unsets the callback function. | |
int | stt_set_engine_changed_cb (stt_h stt, stt_engine_changed_cb callback, void *user_data) |
Sets a callback function to detect the engine change. | |
int | stt_unset_engine_changed_cb (stt_h stt) |
Unsets the callback function. | |
int | stt_set_speech_status_cb (stt_h stt, stt_speech_status_cb callback, void *user_data) |
Sets a callback function to detect the speech status is changed. | |
int | stt_unset_speech_status_cb (stt_h stt) |
Unsets the callback function to detect the speech status is changed. | |
Typedefs | |
typedef struct stt_s * | stt_h |
A structure of STT handle. | |
typedef bool(* | stt_supported_engine_cb )(stt_h stt, const char *engine_id, const char *engine_name, void *user_data) |
Called to get the engine information. | |
typedef void(* | stt_recognition_result_cb )(stt_h stt, stt_result_event_e event, const char **data, int data_count, const char *msg, void *user_data) |
Called when STT gets the recognition result from the engine. | |
typedef bool(* | stt_result_time_cb )(stt_h stt, int index, stt_result_time_event_e event, const char *text, long start_time, long end_time, void *user_data) |
Called when STT get the result time stamp in free partial type. | |
typedef void(* | stt_state_changed_cb )(stt_h stt, stt_state_e previous, stt_state_e current, void *user_data) |
Called when the state of STT is changed. | |
typedef void(* | stt_error_cb )(stt_h stt, stt_error_e reason, void *user_data) |
Called when an error occurs. | |
typedef bool(* | stt_supported_language_cb )(stt_h stt, const char *language, void *user_data) |
Called to retrieve the supported languages. | |
typedef void(* | stt_default_language_changed_cb )(stt_h stt, const char *previous_language, const char *current_language, void *user_data) |
Called when the default language is changed. | |
typedef void(* | stt_engine_changed_cb )(stt_h stt, const char *engine_id, const char *language, bool support_silence, bool need_credential, void *user_data) |
Called when the engine is changed. | |
typedef void(* | stt_speech_status_cb )(stt_h stt, stt_speech_status_e status, void *user_data) |
Called when STT engine detects beginning or ending of the speech. | |
Defines | |
#define | STT_RECOGNITION_TYPE_FREE "stt.recognition.type.FREE" |
Definition for free form dictation and default type. | |
#define | STT_RECOGNITION_TYPE_FREE_PARTIAL "stt.recognition.type.FREE.PARTIAL" |
Definition for continuous free dictation. | |
#define | STT_RECOGNITION_TYPE_SEARCH "stt.recognition.type.SEARCH" |
Definition for search. | |
#define | STT_RECOGNITION_TYPE_WEB_SEARCH "stt.recognition.type.WEB_SEARCH" |
Definition for web search. | |
#define | STT_RECOGNITION_TYPE_MAP "stt.recognition.type.MAP" |
Definition for map. | |
#define | STT_RESULT_MESSAGE_NONE "stt.result.message.none" |
Definition for none message. | |
#define | STT_RESULT_MESSAGE_ERROR_TOO_SOON "stt.result.message.error.too.soon" |
Definition for failed recognition because the speech started too soon. | |
#define | STT_RESULT_MESSAGE_ERROR_TOO_SHORT "stt.result.message.error.too.short" |
Definition for failed recognition because the speech is too short. | |
#define | STT_RESULT_MESSAGE_ERROR_TOO_LONG "stt.result.message.error.too.long" |
Definition for failed recognition because the speech is too long. | |
#define | STT_RESULT_MESSAGE_ERROR_TOO_QUIET "stt.result.message.error.too.quiet" |
Definition for failed recognition because the speech is too quiet to listen. | |
#define | STT_RESULT_MESSAGE_ERROR_TOO_LOUD "stt.result.message.error.too.loud" |
Definition for failed recognition because the speech is too loud to listen. | |
#define | STT_RESULT_MESSAGE_ERROR_TOO_FAST "stt.result.message.error.too.fast" |
Definition for failed recognition because the speech is too fast to listen. |
#define STT_RECOGNITION_TYPE_FREE "stt.recognition.type.FREE" |
Definition for free form dictation and default type.
#define STT_RECOGNITION_TYPE_FREE_PARTIAL "stt.recognition.type.FREE.PARTIAL" |
Definition for continuous free dictation.
#define STT_RECOGNITION_TYPE_MAP "stt.recognition.type.MAP" |
Definition for map.
#define STT_RECOGNITION_TYPE_SEARCH "stt.recognition.type.SEARCH" |
Definition for search.
#define STT_RECOGNITION_TYPE_WEB_SEARCH "stt.recognition.type.WEB_SEARCH" |
Definition for web search.
#define STT_RESULT_MESSAGE_ERROR_TOO_FAST "stt.result.message.error.too.fast" |
Definition for failed recognition because the speech is too fast to listen.
#define STT_RESULT_MESSAGE_ERROR_TOO_LONG "stt.result.message.error.too.long" |
Definition for failed recognition because the speech is too long.
#define STT_RESULT_MESSAGE_ERROR_TOO_LOUD "stt.result.message.error.too.loud" |
Definition for failed recognition because the speech is too loud to listen.
#define STT_RESULT_MESSAGE_ERROR_TOO_QUIET "stt.result.message.error.too.quiet" |
Definition for failed recognition because the speech is too quiet to listen.
#define STT_RESULT_MESSAGE_ERROR_TOO_SHORT "stt.result.message.error.too.short" |
Definition for failed recognition because the speech is too short.
#define STT_RESULT_MESSAGE_ERROR_TOO_SOON "stt.result.message.error.too.soon" |
Definition for failed recognition because the speech started too soon.
#define STT_RESULT_MESSAGE_NONE "stt.result.message.none" |
Definition for none message.
typedef void(* stt_default_language_changed_cb)(stt_h stt, const char *previous_language, const char *current_language, void *user_data) |
Called when the default language is changed.
[in] | stt | The STT handle |
[in] | previous_language | A previous language |
[in] | current_language | A current language |
[in] | user_data | The user data passed from the callback registration function |
typedef void(* stt_engine_changed_cb)(stt_h stt, const char *engine_id, const char *language, bool support_silence, bool need_credential, void *user_data) |
Called when the engine is changed.
[in] | stt | The STT handle |
[in] | engine_id | Engine ID |
[in] | language | The default language |
[in] | support_silence | Whether the silence detection is supported or not |
[in] | need_credential | The necessity of credential |
[in] | user_data | The user data passed from the callback registration function |
typedef void(* stt_error_cb)(stt_h stt, stt_error_e reason, void *user_data) |
Called when an error occurs.
[in] | stt | The STT handle |
[in] | reason | The error type (e.g. STT_ERROR_OUT_OF_NETWORK, STT_ERROR_IO_ERROR) |
[in] | user_data | The user data passed from the callback registration function |
typedef struct stt_s* stt_h |
A structure of STT handle.
typedef void(* stt_recognition_result_cb)(stt_h stt, stt_result_event_e event, const char **data, int data_count, const char *msg, void *user_data) |
Called when STT gets the recognition result from the engine.
[in] | stt | The STT handle |
[in] | event | The result event |
[in] | data | Result texts |
[in] | data_count | Result text count |
[in] | msg | Engine message (e.g. STT_RESULT_MESSAGE_NONE, STT_RESULT_MESSAGE_ERROR_TOO_SHORT) |
[in] | user_data | The user data passed from the callback registration function |
typedef bool(* stt_result_time_cb)(stt_h stt, int index, stt_result_time_event_e event, const char *text, long start_time, long end_time, void *user_data) |
Called when STT get the result time stamp in free partial type.
[in] | stt | The STT handle |
[in] | index | The result index |
[in] | event | The token event |
[in] | text | The result text |
[in] | start_time | The start time of result text |
[in] | end_time | The end time of result text |
[in] | user_data | The user data passed from the foreach function |
true
to continue with the next iteration of the loop otherwise false
to break out of the loop typedef void(* stt_speech_status_cb)(stt_h stt, stt_speech_status_e status, void *user_data) |
Called when STT engine detects beginning or ending of the speech.
[in] | stt | The STT handle |
[in] | status | The speech status |
[in] | user_data | The user data passed from the callback registration function |
typedef void(* stt_state_changed_cb)(stt_h stt, stt_state_e previous, stt_state_e current, void *user_data) |
Called when the state of STT is changed.
[in] | stt | The STT handle |
[in] | previous | A previous state |
[in] | current | A current state |
[in] | user_data | The user data passed from the callback registration function |
typedef bool(* stt_supported_engine_cb)(stt_h stt, const char *engine_id, const char *engine_name, void *user_data) |
Called to get the engine information.
[in] | stt | The STT handle |
[in] | engine_id | Engine ID |
[in] | engine_name | Engine name |
[in] | user_data | User data passed from the stt_setting_foreach_supported_engines() |
true
to continue with the next iteration of the loop, otherwise false
to break out of the loop typedef bool(* stt_supported_language_cb)(stt_h stt, const char *language, void *user_data) |
Called to retrieve the supported languages.
[in] | stt | The STT handle |
[in] | language | The language |
[in] | user_data | The user data passed from the foreach function |
true
to continue with the next iteration of the loop, false
to break out of the loop enum stt_error_e |
Enumeration for error codes.
enum stt_result_event_e |
enum stt_speech_status_e |
enum stt_state_e |
int stt_cancel | ( | stt_h | stt | ) |
Cancels processing recognition and recording asynchronously.
[in] | stt | The STT handle |
0
on success, otherwise a negative error value STT_ERROR_NONE | Successful |
STT_ERROR_INVALID_PARAMETER | Invalid parameter |
STT_ERROR_INVALID_STATE | Invalid state |
STT_ERROR_OPERATION_FAILED | Operation failure |
STT_ERROR_NOT_SUPPORTED | STT NOT supported |
STT_ERROR_PERMISSION_DENIED | Permission denied |
STT_ERROR_IN_PROGRESS_TO_READY | Progress to ready is not finished |
STT_ERROR_IN_PROGRESS_TO_RECORDING | Progress to recording is not finished |
STT_ERROR_IN_PROGRESS_TO_PROCESSING | Progress to processing is not finished |
int stt_create | ( | stt_h * | stt | ) |
Creates a STT handle.
[out] | stt | The STT handle |
0
on success, otherwise a negative error value STT_ERROR_NONE | Successful |
STT_ERROR_OUT_OF_MEMORY | Out of memory |
STT_ERROR_INVALID_PARAMETER | Invalid parameter |
STT_ERROR_OPERATION_FAILED | Operation failure |
STT_ERROR_NOT_SUPPORTED | STT NOT supported |
STT_ERROR_PERMISSION_DENIED | Permission denied |
int stt_destroy | ( | stt_h | stt | ) |
Destroys a STT handle.
[in] | stt | The STT handle |
0
on success, otherwise a negative error value STT_ERROR_NONE | Successful |
STT_ERROR_INVALID_PARAMETER | Invalid parameter |
STT_ERROR_OPERATION_FAILED | Operation failure |
STT_ERROR_NOT_SUPPORTED | STT NOT supported |
STT_ERROR_PERMISSION_DENIED | Permission denied |
int stt_foreach_detailed_result | ( | stt_h | stt, |
stt_result_time_cb | callback, | ||
void * | user_data | ||
) |
Retrieves the time stamp of the current recognition result using the callback function.
[in] | stt | The STT handle |
[in] | callback | The callback function to invoke |
[in] | user_data | The user data to be passed to the callback function |
0
on success, otherwise a negative error value STT_ERROR_NONE | Successful |
STT_ERROR_INVALID_PARAMETER | Invalid parameter |
STT_ERROR_OPERATION_FAILED | Operation failure |
STT_ERROR_NOT_SUPPORTED | STT NOT supported |
STT_ERROR_PERMISSION_DENIED | Permission denied |
int stt_foreach_supported_engines | ( | stt_h | stt, |
stt_supported_engine_cb | callback, | ||
void * | user_data | ||
) |
Retrieves supported engine information using a callback function.
[in] | stt | The STT handle |
[in] | callback | The callback function to invoke |
[in] | user_data | The user data to be passed to the callback function |
0
on success, otherwise a negative error value STT_ERROR_NONE | Success |
STT_ERROR_INVALID_PARAMETER | Invalid parameter |
STT_ERROR_INVALID_STATE | STT Not initialized |
STT_ERROR_OPERATION_FAILED | Operation failure |
STT_ERROR_NOT_SUPPORTED | STT NOT supported |
STT_ERROR_PERMISSION_DENIED | Permission denied |
int stt_foreach_supported_languages | ( | stt_h | stt, |
stt_supported_language_cb | callback, | ||
void * | user_data | ||
) |
Retrieves all supported languages of current engine using callback function.
[in] | stt | The STT handle |
[in] | callback | The callback function to invoke |
[in] | user_data | The user data to be passed to the callback function |
0
on success, otherwise a negative error value STT_ERROR_NONE | Successful |
STT_ERROR_INVALID_PARAMETER | Invalid parameter |
STT_ERROR_OUT_OF_MEMORY | Out of memory |
STT_ERROR_OPERATION_FAILED | Operation failure |
STT_ERROR_ENGINE_NOT_FOUND | No available engine |
STT_ERROR_NOT_SUPPORTED | STT NOT supported |
STT_ERROR_PERMISSION_DENIED | Permission denied |
int stt_get_default_language | ( | stt_h | stt, |
char ** | language | ||
) |
Gets the default language set by the user.
[in] | stt | The STT handle |
[out] | language | The language |
0
on success, otherwise a negative error value STT_ERROR_NONE | Successful |
STT_ERROR_INVALID_PARAMETER | Invalid parameter |
STT_ERROR_OPERATION_FAILED | Operation failure |
STT_ERROR_NOT_SUPPORTED | STT NOT supported |
STT_ERROR_PERMISSION_DENIED | Permission denied |
int stt_get_engine | ( | stt_h | stt, |
char ** | engine_id | ||
) |
Gets the current engine ID.
[in] | stt | The STT handle |
[out] | engine_id | Engine ID |
0
on success, otherwise a negative error value STT_ERROR_NONE | Success |
STT_ERROR_INVALID_PARAMETER | Invalid parameter |
STT_ERROR_INVALID_STATE | STT Not initialized |
STT_ERROR_OPERATION_FAILED | Operation failure |
STT_ERROR_NOT_SUPPORTED | STT NOT supported |
STT_ERROR_PERMISSION_DENIED | Permission denied |
int stt_get_error_message | ( | stt_h | stt, |
char ** | err_msg | ||
) |
Gets the current error message.
[in] | stt | The STT handle |
[out] | err_msg | The current error message |
0
on success, otherwise a negative error value STT_ERROR_NONE | Successful |
STT_ERROR_INVALID_PARAMETER | Invalid parameter |
STT_ERROR_NOT_SUPPORTED | STT NOT supported |
STT_ERROR_OPERATION_FAILED | Operation failure |
int stt_get_private_data | ( | stt_h | stt, |
const char * | key, | ||
char ** | data | ||
) |
Gets the private data from stt engine.
The private data is the information provided by the engine. Using this API, the application can get the private data which corresponds to the key from the engine.
[in] | stt | The STT handle |
[in] | key | The field name of private data |
[out] | data | The data field of private data |
0
on success, otherwise a negative error value STT_ERROR_NONE | Successful |
STT_ERROR_INVALID_PARAMETER | Invalid parameter |
STT_ERROR_INVALID_STATE | Invalid state |
STT_ERROR_NOT_SUPPORTED | STT NOT supported |
STT_ERROR_TIMED_OUT | No answer from the STT service |
int stt_get_recording_volume | ( | stt_h | stt, |
float * | volume | ||
) |
Gets the microphone volume during recording.
[in] | stt | The STT handle |
[out] | volume | Recording volume |
0
on success, otherwise a negative error value STT_ERROR_NONE | Successful |
STT_ERROR_INVALID_PARAMETER | Invalid parameter |
STT_ERROR_INVALID_STATE | Invalid state |
STT_ERROR_OPERATION_FAILED | Operation failure |
STT_ERROR_NOT_SUPPORTED | STT NOT supported |
STT_ERROR_PERMISSION_DENIED | Permission denied |
int stt_get_state | ( | stt_h | stt, |
stt_state_e * | state | ||
) |
Gets the current STT state.
[in] | stt | The STT handle |
[out] | state | The current STT state |
0
on success, otherwise a negative error value STT_ERROR_NONE | Successful |
STT_ERROR_INVALID_PARAMETER | Invalid parameter |
STT_ERROR_NOT_SUPPORTED | STT NOT supported |
STT_ERROR_PERMISSION_DENIED | Permission denied |
int stt_is_recognition_type_supported | ( | stt_h | stt, |
const char * | type, | ||
bool * | support | ||
) |
Checks whether the recognition type is supported.
[in] | stt | The STT handle |
[in] | type | The type for recognition (e.g. STT_RECOGNITION_TYPE_FREE, STT_RECOGNITION_TYPE_FREE_PARTIAL) |
[out] | support | The result status true = supported, false = not supported |
0
on success, otherwise a negative error value STT_ERROR_NONE | Successful |
STT_ERROR_INVALID_PARAMETER | Invalid parameter |
STT_ERROR_OPERATION_FAILED | Operation failure |
STT_ERROR_INVALID_STATE | Invalid state |
STT_ERROR_NOT_SUPPORTED | STT NOT supported |
STT_ERROR_PERMISSION_DENIED | Permission denied |
int stt_prepare | ( | stt_h | stt | ) |
Connects the STT service asynchronously.
[in] | stt | The STT handle |
0
on success, otherwise a negative error value STT_ERROR_NONE | Successful |
STT_ERROR_INVALID_PARAMETER | Invalid parameter |
STT_ERROR_INVALID_STATE | Invalid state |
STT_ERROR_NOT_SUPPORTED | STT NOT supported |
STT_ERROR_PERMISSION_DENIED | Permission denied |
int stt_set_credential | ( | stt_h | stt, |
const char * | credential | ||
) |
Sets the app credential.
Using this API, the application can set a credential. The credential is a key to verify the authorization about using the engine. If the application sets the credential, it will be able to use functions of the engine entirely.
[in] | stt | The STT handle |
[in] | credential | The app credential |
0
on success, otherwise a negative error value STT_ERROR_NONE | Success |
STT_ERROR_INVALID_PARAMETER | Invalid parameter |
STT_ERROR_INVALID_STATE | Invalid state |
STT_ERROR_NOT_SUPPORTED | STT NOT supported |
int stt_set_default_language_changed_cb | ( | stt_h | stt, |
stt_default_language_changed_cb | callback, | ||
void * | user_data | ||
) |
Sets a callback function to detect the default language change.
[in] | stt | The STT handle |
[in] | callback | The callback function to register |
[in] | user_data | The user data to be passed to the callback function |
0
on success, otherwise a negative error value STT_ERROR_NONE | Successful |
STT_ERROR_INVALID_PARAMETER | Invalid parameter |
STT_ERROR_INVALID_STATE | Invalid state |
STT_ERROR_NOT_SUPPORTED | STT NOT supported |
STT_ERROR_PERMISSION_DENIED | Permission denied |
int stt_set_engine | ( | stt_h | stt, |
const char * | engine_id | ||
) |
Sets the engine ID.
[in] | stt | The STT handle |
[in] | engine_id | Engine ID |
0
on success, otherwise a negative error value STT_ERROR_NONE | Success |
STT_ERROR_INVALID_PARAMETER | Invalid parameter |
STT_ERROR_INVALID_STATE | STT Not initialized |
STT_ERROR_OPERATION_FAILED | Operation failure |
STT_ERROR_NOT_SUPPORTED | STT NOT supported |
STT_ERROR_PERMISSION_DENIED | Permission denied |
int stt_set_engine_changed_cb | ( | stt_h | stt, |
stt_engine_changed_cb | callback, | ||
void * | user_data | ||
) |
Sets a callback function to detect the engine change.
[in] | stt | The STT handle |
[in] | callback | The callback function to register |
[in] | user_data | The user data to be passed to the callback function |
0
on success, otherwise a negative error value STT_ERROR_NONE | Successful |
STT_ERROR_INVALID_PARAMETER | Invalid parameter |
STT_ERROR_INVALID_STATE | Invalid state |
STT_ERROR_NOT_SUPPORTED | STT NOT supported |
int stt_set_error_cb | ( | stt_h | stt, |
stt_error_cb | callback, | ||
void * | user_data | ||
) |
Sets a callback function to be called when an error occurred.
[in] | stt | The STT handle |
[in] | callback | The callback function to register |
[in] | user_data | The user data to be passed to the callback function |
0
on success, otherwise a negative error value STT_ERROR_NONE | Successful |
STT_ERROR_INVALID_PARAMETER | Invalid parameter |
STT_ERROR_INVALID_STATE | Invalid state |
STT_ERROR_NOT_SUPPORTED | STT NOT supported |
STT_ERROR_PERMISSION_DENIED | Permission denied |
int stt_set_private_data | ( | stt_h | stt, |
const char * | key, | ||
const char * | data | ||
) |
Sets the private data to stt engine.
The private data is the setting parameter for applying keys provided by the engine. Using this API, the application can set the private data and use the corresponding key of the engine. For example, if the engine provides 'partial recognition' as a recognition type, the application can set the private data as the following. int ret = stt_set_private_data(stt_h, "recognition_type", "PARTIAL");
[in] | stt | The STT handle |
[in] | key | The field name of private data |
[in] | data | The data for set |
0
on success, otherwise a negative error value STT_ERROR_NONE | Successful |
STT_ERROR_INVALID_PARAMETER | Invalid parameter |
STT_ERROR_INVALID_STATE | Invalid state |
STT_ERROR_NOT_SUPPORTED | STT NOT supported |
STT_ERROR_TIMED_OUT | No answer from the STT service |
int stt_set_recognition_result_cb | ( | stt_h | stt, |
stt_recognition_result_cb | callback, | ||
void * | user_data | ||
) |
Sets a callback function to get the recognition result.
[in] | stt | The STT handle |
[in] | callback | The callback function to register |
[in] | user_data | The user data to be passed to the callback function |
0
on success, otherwise a negative error value STT_ERROR_NONE | Successful |
STT_ERROR_INVALID_PARAMETER | Invalid parameter |
STT_ERROR_INVALID_STATE | Invalid state |
STT_ERROR_NOT_SUPPORTED | STT NOT supported |
STT_ERROR_PERMISSION_DENIED | Permission denied |
int stt_set_silence_detection | ( | stt_h | stt, |
stt_option_silence_detection_e | type | ||
) |
Sets the silence detection.
[in] | stt | The STT handle |
[in] | type | The option type |
0
on success, otherwise a negative error value STT_ERROR_NONE | Successful |
STT_ERROR_INVALID_PARAMETER | Invalid parameter |
STT_ERROR_INVALID_STATE | Invalid state |
STT_ERROR_NOT_SUPPORTED_FEATURE | Not supported feature of current engine |
STT_ERROR_NOT_SUPPORTED | STT NOT supported |
STT_ERROR_PERMISSION_DENIED | Permission denied |
int stt_set_speech_status_cb | ( | stt_h | stt, |
stt_speech_status_cb | callback, | ||
void * | user_data | ||
) |
Sets a callback function to detect the speech status is changed.
[in] | stt | The STT handle |
[in] | callback | The callback function to register |
[in] | user_data | The user data to be passed to the callback function |
0
on success, otherwise a negative error value STT_ERROR_NONE | Successful |
STT_ERROR_NOT_SUPPORTED | STT NOT supported |
STT_ERROR_PERMISSION_DENIED | Permission denied |
STT_ERROR_INVALID_PARAMETER | Invalid parameter |
STT_ERROR_INVALID_STATE | Invalid state |
int stt_set_start_sound | ( | stt_h | stt, |
const char * | filename | ||
) |
Sets the sound to start recording.
[in] | stt | The STT handle |
[in] | filename | The sound file path |
0
on success, otherwise a negative error value STT_ERROR_NONE | Successful |
STT_ERROR_INVALID_PARAMETER | Invalid parameter |
STT_ERROR_INVALID_STATE | Invalid state |
STT_ERROR_OPERATION_FAILED | Operation failure |
STT_ERROR_NOT_SUPPORTED | STT NOT supported |
STT_ERROR_PERMISSION_DENIED | Permission denied |
int stt_set_state_changed_cb | ( | stt_h | stt, |
stt_state_changed_cb | callback, | ||
void * | user_data | ||
) |
Sets a callback function to be called when STT state changes.
[in] | stt | The STT handle |
[in] | callback | The callback function to register |
[in] | user_data | The user data to be passed to the callback function |
0
on success, otherwise a negative error value STT_ERROR_NONE | Successful |
STT_ERROR_INVALID_PARAMETER | Invalid parameter |
STT_ERROR_INVALID_STATE | Invalid state |
STT_ERROR_NOT_SUPPORTED | STT NOT supported |
STT_ERROR_PERMISSION_DENIED | Permission denied |
int stt_set_stop_sound | ( | stt_h | stt, |
const char * | filename | ||
) |
Sets the sound to stop recording.
[in] | stt | The STT handle |
[in] | filename | The sound file path |
0
on success, otherwise a negative error value STT_ERROR_NONE | Successful |
STT_ERROR_INVALID_PARAMETER | Invalid parameter |
STT_ERROR_INVALID_STATE | Invalid state |
STT_ERROR_OPERATION_FAILED | Operation failure |
STT_ERROR_NOT_SUPPORTED | STT NOT supported |
STT_ERROR_PERMISSION_DENIED | Permission denied |
Starts recording and recognition asynchronously.
[in] | stt | The STT handle |
[in] | language | The language selected from stt_foreach_supported_languages() |
[in] | type | The type for recognition (e.g. STT_RECOGNITION_TYPE_FREE, STT_RECOGNITION_TYPE_FREE_PARTIAL) |
0
on success, otherwise a negative error value STT_ERROR_NONE | Successful |
STT_ERROR_INVALID_PARAMETER | Invalid parameter |
STT_ERROR_INVALID_STATE | Invalid state |
STT_ERROR_OPERATION_FAILED | Operation failure |
STT_ERROR_RECORDER_BUSY | Recorder busy |
STT_ERROR_INVALID_LANGUAGE | Invalid language |
STT_ERROR_NOT_SUPPORTED | STT NOT supported |
STT_ERROR_PERMISSION_DENIED | Permission denied |
STT_ERROR_IN_PROGRESS_TO_RECORDING | Progress to recording is not finished |
Finishes the recording and starts recognition processing in engine asynchronously.
[in] | stt | The STT handle |
0
on success, otherwise a negative error value STT_ERROR_NONE | Successful |
STT_ERROR_INVALID_PARAMETER | Invalid parameter |
STT_ERROR_INVALID_STATE | Invalid state |
STT_ERROR_OPERATION_FAILED | Operation failure |
STT_ERROR_NOT_SUPPORTED | STT NOT supported |
STT_ERROR_PERMISSION_DENIED | Permission denied |
STT_ERROR_IN_PROGRESS_TO_READY | Progress to ready is not finished |
STT_ERROR_IN_PROGRESS_TO_RECORDING | Progress to recording is not finished |
STT_ERROR_IN_PROGRESS_TO_PROCESSING | Progress to processing is not finished |
int stt_unprepare | ( | stt_h | stt | ) |
Disconnects the STT service.
[in] | stt | The STT handle |
0
on success, otherwise a negative error value STT_ERROR_NONE | Successful |
STT_ERROR_INVALID_PARAMETER | Invalid parameter |
STT_ERROR_INVALID_STATE | Invalid state |
STT_ERROR_NOT_SUPPORTED | STT NOT supported |
STT_ERROR_PERMISSION_DENIED | Permission denied |
int stt_unset_default_language_changed_cb | ( | stt_h | stt | ) |
Unsets the callback function.
[in] | stt | The STT handle |
0
on success, otherwise a negative error value STT_ERROR_NONE | Successful |
STT_ERROR_INVALID_PARAMETER | Invalid parameter |
STT_ERROR_INVALID_STATE | Invalid state |
STT_ERROR_NOT_SUPPORTED | STT NOT supported |
STT_ERROR_PERMISSION_DENIED | Permission denied |
int stt_unset_engine_changed_cb | ( | stt_h | stt | ) |
Unsets the callback function.
[in] | stt | The STT handle |
0
on success, otherwise a negative error value STT_ERROR_NONE | Successful |
STT_ERROR_INVALID_PARAMETER | Invalid parameter |
STT_ERROR_INVALID_STATE | Invalid state |
STT_ERROR_NOT_SUPPORTED | STT NOT supported |
int stt_unset_error_cb | ( | stt_h | stt | ) |
Unsets the callback function.
[in] | stt | The STT handle |
0
on success, otherwise a negative error value STT_ERROR_NONE | Successful |
STT_ERROR_INVALID_PARAMETER | Invalid parameter |
STT_ERROR_INVALID_STATE | Invalid state |
STT_ERROR_NOT_SUPPORTED | STT NOT supported |
STT_ERROR_PERMISSION_DENIED | Permission denied |
int stt_unset_recognition_result_cb | ( | stt_h | stt | ) |
Unsets the callback function.
[in] | stt | The STT handle |
0
on success, otherwise a negative error value STT_ERROR_NONE | Successful |
STT_ERROR_INVALID_PARAMETER | Invalid parameter |
STT_ERROR_INVALID_STATE | Invalid state |
STT_ERROR_NOT_SUPPORTED | STT NOT supported |
STT_ERROR_PERMISSION_DENIED | Permission denied |
int stt_unset_speech_status_cb | ( | stt_h | stt | ) |
Unsets the callback function to detect the speech status is changed.
[in] | stt | The STT handle |
0
on success, otherwise a negative error value STT_ERROR_NONE | Successful |
STT_ERROR_NOT_SUPPORTED | STT NOT supported |
STT_ERROR_PERMISSION_DENIED | Permission denied |
STT_ERROR_INVALID_PARAMETER | Invalid parameter |
STT_ERROR_INVALID_STATE | Invalid state |
int stt_unset_start_sound | ( | stt_h | stt | ) |
Unsets the sound to start recording.
[in] | stt | The STT handle |
0
on success, otherwise a negative error value STT_ERROR_NONE | Successful |
STT_ERROR_INVALID_PARAMETER | Invalid parameter |
STT_ERROR_INVALID_STATE | Invalid state |
STT_ERROR_OPERATION_FAILED | Operation failure |
STT_ERROR_NOT_SUPPORTED | STT NOT supported |
STT_ERROR_PERMISSION_DENIED | Permission denied |
int stt_unset_state_changed_cb | ( | stt_h | stt | ) |
Unsets the callback function.
[in] | stt | The STT handle |
0
on success, otherwise a negative error value STT_ERROR_NONE | Successful |
STT_ERROR_INVALID_PARAMETER | Invalid parameter |
STT_ERROR_INVALID_STATE | Invalid state |
STT_ERROR_NOT_SUPPORTED | STT NOT supported |
STT_ERROR_PERMISSION_DENIED | Permission denied |
int stt_unset_stop_sound | ( | stt_h | stt | ) |
Unsets the sound to stop recording.
[in] | stt | The STT handle |
0
on success, otherwise a negative error value STT_ERROR_NONE | Successful |
STT_ERROR_INVALID_PARAMETER | Invalid parameter |
STT_ERROR_INVALID_STATE | Invalid state |
STT_ERROR_OPERATION_FAILED | Operation failure |
STT_ERROR_NOT_SUPPORTED | STT NOT supported |
STT_ERROR_PERMISSION_DENIED | Permission denied |