Class Engine

Definition

Namespace:
Tizen.Uix.TtsEngine
Assembly:
Tizen.Uix.TtsEngine.dll
API Level:
4

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

C#
Copy
public abstract class Engine
Inheritance
Engine

Constructors

View Source

Engine()

Public constructor.

Declaration
C#
Copy
public Engine()
API Level: 4
Feature: http://tizen.org/feature/speech.synthesis

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
API Level: 4
View Source

CheckAppAgreed(String, out Boolean)

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
System.String appid

The application ID.

System.Boolean 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.

API Level: 4
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.

API Level: 4
View Source

EngineMain(Int32, 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
System.Int32 argc

The argument count (original).

System.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.

API Level: 4
Feature: http://tizen.org/feature/speech.synthesis
View Source

ForEachSupportedVoices(Engine.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()'.

API Level: 4
View Source

GetInformation(out String, out String, out String, out Boolean)

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
System.String engineUuid

UUID of the engine.

System.String engineName

Name of the engine.

System.String engineSetting

The engine setting application (UI application)'s ID.

System.Boolean 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.

API Level: 4
View Source

GetPitchRange(out Int32, out Int32, out Int32)

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
System.Int32 min

The minimum pitch value.

System.Int32 normal

The normal pitch value.

System.Int32 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.

API Level: 4
Feature: http://tizen.org/feature/speech.synthesis
View Source

GetSpeedRange(out Int32, out Int32, out Int32)

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
System.Int32 min

The minimum speed value.

System.Int32 normal

The normal speed value.

System.Int32 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.

API Level: 4
Feature: http://tizen.org/feature/speech.synthesis
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
API Level: 4
View Source

IsValidVoice(String, Int32, out Boolean)

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
System.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.

System.Int32 type

The voice type.

System.Boolean 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
API Level: 4
View Source

LoadVoice(String, Int32)

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
System.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.

System.Int32 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
API Level: 4
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
System.Boolean

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

API Level: 4
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.

System.String msg

The error message.

Exceptions
Type Condition
System.NotSupportedException

Thrown in case of not supported.

System.InvalidOperationException

Thrown in case of operation failure.

API Level: 4
Feature: http://tizen.org/feature/speech.synthesis
View Source

SendResult(ResultEvent, IntPtr, Int32, AudioType, Int32)

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.

System.Int32 dataSize

The result data size.

AudioType audioType

The audio type.

System.Int32 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.

API Level: 4
Feature: http://tizen.org/feature/speech.synthesis
View Source

SetPitch(Int32)

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
System.Int32 pitch

The default pitch.

Returns
Type Description
Error

The following error codes can be returned:

  1. None
  2. InvalidState
  3. OperationFailed
  4. InvalidParameter
API Level: 4
View Source

SetPrivateDataRequestedDelegate(Engine.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<System.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.

API Level: 4
Feature: http://tizen.org/feature/speech.synthesis
View Source

SetPrivateDataSetDelegate(Engine.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<System.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.

API Level: 4
Feature: http://tizen.org/feature/speech.synthesis
View Source

StartSynthesis(String, Int32, String, Int32, 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
System.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.

System.Int32 type

The voice type.

System.String text

Texts.

System.Int32 speed

The speed of speaking.

System.String appid

The application ID.

System.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.

API Level: 4
View Source

UnloadVoice(String, Int32)

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
System.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.

System.Int32 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
API Level: 4