Class Engine

Definition

Namespace:
Tizen.Uix.TtsEngine
Assembly:
Tizen.Uix.TtsEngine.dll

This class represents the TTS engine, which has to be inherited to make the engine.

C#
Copy
public abstract class Engine
Inheritance
object
Engine

Constructors

View Source

Engine()

Public constructor.

Declaration
C#
Copy
public Engine()

Methods

View Source

CancelSynthesis()

Called when the engine service user cancels to synthesize a voice.

Declaration
C#
Copy
public abstract Error CancelSynthesis()
Returns
Type Description
Error

The following error codes can be returned:

  1. None
  2. InvalidState
View Source

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
C#
Copy
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:

  1. None
  2. InvalidState
  3. NotSupportedFeature
  4. InvalidParameter
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.

View Source

Deinitialize()

Called when the engine service user deinitializes the TTS engine.

Declaration
C#
Copy
public abstract Error Deinitialize()
Returns
Type Description
Error

The following error codes can be returned:

  1. None
  2. InvalidState
Remarks

NOTE that the engine may be terminated automatically. When this callback function is invoked, the release of the resources is necessary.

View Source

EngineMain(int, string[])

Main function for the Text-To-Speech (TTS) engine. This function is the main function for operating the TTS engine.

Declaration
C#
Copy
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.

View Source

ForEachSupportedVoices(SupportedVoice, IntPtr)

Called when the engine service user gets the whole supported voice list.

Declaration
C#
Copy
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:

  1. None
  2. OperationFailed
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()'.

View Source

GetInformation(out string, out string, out string, out bool)

Called when the engine service user requests the basic information of the TTS engine.

Declaration
C#
Copy
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:

  1. None
  2. InvalidState
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.

View Source

GetPitchRange(out int, out int, out int)

Gets the pitch range from the Tizen platform.

Declaration
C#
Copy
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.

View Source

GetSpeedRange(out int, out int, out int)

Gets the speed range from the Tizen platform.

Declaration
C#
Copy
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.

View Source

Initialize()

Called when the engine service user initializes the TTS engine.

Declaration
C#
Copy
public abstract Error Initialize()
Returns
Type Description
Error

The following error codes can be returned:

  1. None
  2. InvalidState
  3. NotSupportedFeature
  4. PermissionDenied
View Source

IsValidVoice(string, int, out bool)

Called when the engine service user checks whether the voice is valid or not in the TTS engine.

Declaration
C#
Copy
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:

  1. None
  2. InvalidParameter
View Source

LoadVoice(string, int)

Called when the engine service user requests to load the corresponding voice type for the first time.

Declaration
C#
Copy
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:

  1. None
  2. InvalidState
  3. OperationFailed
  4. InvalidVoice
  5. InvalidParameter
  6. OutOfMemory
View Source

NeedAppCredential()

Called when the engine service user checks whether the TTS engine needs the application's credentials.

Declaration
C#
Copy
public abstract bool NeedAppCredential()
Returns
Type Description
bool

true if TTS engine needs the application's credentials, otherwise false.

View Source

SendError(Error, string)

Sends the error to the engine service user.

Declaration
C#
Copy
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.

View Source

SendResult(ResultEvent, IntPtr, int, AudioType, int)

Sends the synthesized result to the engine service user.

Declaration
C#
Copy
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.

View Source

SetPitch(int)

Called when the engine service user sets the default pitch of the TTS engine.

Declaration
C#
Copy
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:

  1. None
  2. InvalidState
  3. OperationFailed
  4. InvalidParameter
View Source

SetPrivateDataRequestedDelegate(OutAction<string>)

Sets a callback function for setting the private data.

Declaration
C#
Copy
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:

  1. None
  2. InvalidParameter
  3. OperationFailed
  4. NotSupported
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.

View Source

SetPrivateDataSetDelegate(Action<string>)

Sets a callback function for setting the private data.

Declaration
C#
Copy
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:

  1. None
  2. InvalidParameter
  3. OperationFailed
  4. NotSupported
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.

View Source

StartSynthesis(string, int, string, int, string, string, IntPtr)

Called when the engine service user starts to synthesize a voice, asynchronously.

Declaration
C#
Copy
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:

  1. None
  2. InvalidState
  3. InvalidParameter
  4. InvalidVoice
  5. OperationFailed
  6. NetworkDown
  7. PermissionDenied
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.

View Source

UnloadVoice(string, int)

Called when the engine service user requests to unload the corresponding voice type or to stop using voice.

Declaration
C#
Copy
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:

  1. None
  2. InvalidState
  3. OperationFailed
  4. InvalidVoice
  5. InvalidParameter