Class Engine
Definition
- Assembly:
- Tizen.Uix.TtsEngine.dll
This class represents the TTS engine, which has to be inherited to make the engine.
public abstract class Engine
- Inheritance
-
objectEngine
Constructors
View SourceEngine()
Public constructor.
Declaration
public Engine()
Methods
View SourceCancelSynthesis()
Called when the engine service user cancels to synthesize a voice.
Declaration
public abstract Error CancelSynthesis()
Returns
Type | Description |
---|---|
Error | The following error codes can be returned:
|
CheckAppAgreed(string, out bool)
Called when the engine service user requests for the TTS engine to check whether the application agreed the usage of the TTS engine. This callback function is called when the engine service user requests for the TTS engine to check the application's agreement about using the the engine. According to the need, the engine developer can provide some user interfaces to check the agreement.
Declaration
public abstract Error CheckAppAgreed(string appid, out bool isAgreed)
Parameters
Type | Name | Description |
---|---|---|
string | appid | The application ID. |
bool | isAgreed | A variable for checking whether the application agreed to use the TTS engine or not. true to agree, false to disagree. |
Returns
Type | Description |
---|---|
Error | The following error codes can be returned:
|
Remarks
If the TTS engine developer does not want to check the agreement, the developer needs to return proper values as isAgreed in accordance with the intention. true if the developer regards that every application agreed the usage of the engine, false if the developer regards that every application disagreed. NOTE that, however, there may be any legal issue unless the developer checks the agreement. Therefore, we suggest that the engine developers should provide a function to check the agreement.
Deinitialize()
Called when the engine service user deinitializes the TTS engine.
Declaration
public abstract Error Deinitialize()
Returns
Type | Description |
---|---|
Error | The following error codes can be returned:
|
Remarks
NOTE that the engine may be terminated automatically. When this callback function is invoked, the release of the resources is necessary.
EngineMain(int, string[])
Main function for the Text-To-Speech (TTS) engine. This function is the main function for operating the TTS engine.
Declaration
public void EngineMain(int argc, string[] argv)
Parameters
Type | Name | Description |
---|---|---|
int | argc | The argument count (original). |
string[] | argv | The argument (original). |
Remarks
ServiceAppMain should be used for working the engine after this function.
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown in case of not supported. |
System.InvalidOperationException | Thrown in case of operation failure. |
ForEachSupportedVoices(SupportedVoice, IntPtr)
Called when the engine service user gets the whole supported voice list.
Declaration
public abstract Error ForEachSupportedVoices(Engine.SupportedVoice callback, IntPtr userData)
Parameters
Type | Name | Description |
---|---|---|
Engine.SupportedVoice | callback | The callback function. |
System.IntPtr | userData | The user data which must be passed to SupportedVoice(). |
Returns
Type | Description |
---|---|
Error | The following error codes can be returned:
|
Remarks
In this function, the engine service user's callback function 'SupportedVoice()' is invoked repeatedly for getting all the supported voices, and userData must be transferred to 'SupportedVoice()'. If 'SupportedVoice()' returns false, it should be stopped to call 'SupportedVoice()'.
GetInformation(out string, out string, out string, out bool)
Called when the engine service user requests the basic information of the TTS engine.
Declaration
public abstract Error GetInformation(out string engineUuid, out string engineName, out string engineSetting, out bool useNetwork)
Parameters
Type | Name | Description |
---|---|---|
string | engineUuid | UUID of the engine. |
string | engineName | Name of the engine. |
string | engineSetting | The engine setting application (UI application)'s ID. |
bool | useNetwork | The status for using the network. |
Returns
Type | Description |
---|---|
Error | The following error codes can be returned:
|
Remarks
The allocated engineUuid, engineName, and engineSetting will be released internally. In order to upload the engine at Tizen Appstore, both a service application and a UI application are necessary. Therefore, engineSetting must be transferred to the engine service user.
GetPitchRange(out int, out int, out int)
Gets the pitch range from the Tizen platform.
Declaration
public void GetPitchRange(out int min, out int normal, out int max)
Parameters
Type | Name | Description |
---|---|---|
int | min | The minimum pitch value. |
int | normal | The normal pitch value. |
int | max | The maximum pitch value. |
Remarks
This API is used when the TTS engine wants to get the pitch range from the Tizen platform.
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown in case of not supported. |
System.InvalidOperationException | Thrown in case of operation failure. |
GetSpeedRange(out int, out int, out int)
Gets the speed range from the Tizen platform.
Declaration
public void GetSpeedRange(out int min, out int normal, out int max)
Parameters
Type | Name | Description |
---|---|---|
int | min | The minimum speed value. |
int | normal | The normal speed value. |
int | max | The maximum speed value. |
Remarks
This API is used when the TTS engine wants to get the speed range from the Tizen platform.
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown in case of not supported. |
System.InvalidOperationException | Thrown in case of operation failure. |
Initialize()
Called when the engine service user initializes the TTS engine.
Declaration
public abstract Error Initialize()
Returns
Type | Description |
---|---|
Error | The following error codes can be returned:
|
IsValidVoice(string, int, out bool)
Called when the engine service user checks whether the voice is valid or not in the TTS engine.
Declaration
public abstract Error IsValidVoice(string language, int type, out bool isValid)
Parameters
Type | Name | Description |
---|---|---|
string | language | The language is specified as an ISO 3166 alpha-2 two-letter country code followed by an ISO 639-1 for the two-letter language code. For example, "ko_KR" for Korean, "en_US" for American English. |
int | type | The voice type. |
bool | isValid | A variable for checking whether the corresponding voice is valid or not. true to be valid, false to be invalid. |
Returns
Type | Description |
---|---|
Error | The following error codes can be returned:
|
LoadVoice(string, int)
Called when the engine service user requests to load the corresponding voice type for the first time.
Declaration
public abstract Error LoadVoice(string language, int type)
Parameters
Type | Name | Description |
---|---|---|
string | language | The language is specified as an ISO 3166 alpha-2 two-letter country code followed by an ISO 639-1 for the two-letter language code. For example, "ko_KR" for Korean, "en_US" for American English. |
int | type | The voice type. |
Returns
Type | Description |
---|---|
Error | The following error codes can be returned:
|
NeedAppCredential()
Called when the engine service user checks whether the TTS engine needs the application's credentials.
Declaration
public abstract bool NeedAppCredential()
Returns
Type | Description |
---|---|
bool | true if TTS engine needs the application's credentials, otherwise false. |
SendError(Error, string)
Sends the error to the engine service user.
Declaration
public void SendError(Error error, string msg)
Parameters
Type | Name | Description |
---|---|---|
Error | error | The error reason. |
string | msg | The error message. |
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown in case of not supported. |
System.InvalidOperationException | Thrown in case of operation failure. |
SendResult(ResultEvent, IntPtr, int, AudioType, int)
Sends the synthesized result to the engine service user.
Declaration
public void SendResult(ResultEvent resultEvent, IntPtr data, int dataSize, AudioType audioType, int rate)
Parameters
Type | Name | Description |
---|---|---|
ResultEvent | resultEvent | The result event. |
System.IntPtr | data | The result data. |
int | dataSize | The result data size. |
AudioType | audioType | The audio type. |
int | rate | The sample rate. |
Remarks
This API is used in StartSynthesis(), when the TTS engine sends the synthesized result to the engine service user. The synthesized result must be transferred to the engine service user through this function.
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown in case of an invalid parameter. |
System.NotSupportedException | Thrown in case of not supported. |
System.InvalidOperationException | Thrown in case of operation failure. |
SetPitch(int)
Called when the engine service user sets the default pitch of the TTS engine.
Declaration
public abstract Error SetPitch(int pitch)
Parameters
Type | Name | Description |
---|---|---|
int | pitch | The default pitch. |
Returns
Type | Description |
---|---|
Error | The following error codes can be returned:
|
SetPrivateDataRequestedDelegate(OutAction<string>)
Sets a callback function for setting the private data.
Declaration
public void SetPrivateDataRequestedDelegate(Engine.OutAction<string> callback)
Parameters
Type | Name | Description |
---|---|---|
Engine.OutAction<string> | callback | The callback function. Called when the TTS engine receives the private data from the engine service user. This callback function is called when the engine service user sends the private data to the TTS engine. Out parameters: a = Key -- The key field of private data. b = data -- The data field of private data. The following error codes can be returned:
|
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown in case of an invalid parameter. |
System.NotSupportedException | Thrown in case of not supported. |
System.InvalidOperationException | thrown in case of operation failure. |
SetPrivateDataSetDelegate(Action<string>)
Sets a callback function for setting the private data.
Declaration
public void SetPrivateDataSetDelegate(Engine.Action<string> callback)
Parameters
Type | Name | Description |
---|---|---|
Engine.Action<string> | callback | Called when the engine service user gets the private data from the TTS engine. In parameters: a = Key -- The key field of private data. b = data -- The data field of private data. The following error codes can be returned:
|
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown in case of an invalid parameter. |
System.NotSupportedException | Thrown in case of not supported. |
System.InvalidOperationException | thrown in case of operation failure. |
StartSynthesis(string, int, string, int, string, string, IntPtr)
Called when the engine service user starts to synthesize a voice, asynchronously.
Declaration
public abstract Error StartSynthesis(string language, int type, string text, int speed, string appid, string credential, IntPtr userData)
Parameters
Type | Name | Description |
---|---|---|
string | language | The language is specified as an ISO 3166 alpha-2 two-letter country code followed by an ISO 639-1 for the two-letter language code. For example, "ko_KR" for Korean, "en_US" for American English. |
int | type | The voice type. |
string | text | Texts. |
int | speed | The speed of speaking. |
string | appid | The application ID. |
string | credential | The credential granted to the application. |
System.IntPtr | userData | The user data which must be passed to the SendResult() function. |
Returns
Type | Description |
---|---|
Error | The following error codes can be returned:
|
Remarks
In this callback function, the TTS engine must transfer the synthesized result to the engine service user using SendResult(). Also, if the TTS engine needs the application's credential, it can set the credential granted to the application.
UnloadVoice(string, int)
Called when the engine service user requests to unload the corresponding voice type or to stop using voice.
Declaration
public abstract Error UnloadVoice(string language, int type)
Parameters
Type | Name | Description |
---|---|---|
string | language | The language is specified as an ISO 3166 alpha-2 two-letter country code followed by an ISO 639-1 for the two-letter language code. For example, "ko_KR" for Korean, "en_US" for American English. |
int | type | The voice type. |
Returns
Type | Description |
---|---|
Error | The following error codes can be returned:
|