CTTSAlgorithmManager Class Reference

class CTTSAlgorithmManager : public CBase

CTTSAlgorithmManager contains implementations behind DevTTS interface. Observer callbacks from TtsHwDevice and DevTTSAudio

NssDevTts.lib

Inherits from

Public Member Functions
~CTTSAlgorithmManager ()
TTtsStyleID AddStyleL (const TTtsStyle &)
TInt Balance ()
void BufferProcessed (const TDesC8 &)
TAny * CustomInterface ( TUid )
void DeleteStyleL ( TTtsStyleID )
void GetPositionL ( TTimeIntervalMicroSeconds &)
void GetPositionL ( TTtsSegment &, TInt &)
TBool IsLanguageSupported ( TLanguage )
void LanguageIdentificationL ( CTtsParsedText &, TInt , RArray < TLanguage > &, RArray < TInt > &)
HBufC8 * MathdoConfigurationData ( TUint32 , TUint32 , TUint32 , TUint32 )
void MathdoWordListReady (const TInt )
TInt MaxVolume ()
void MdtaoBufferToBeFilled ( TDes8 &, TInt )
void MdtaoInitializeComplete ( TInt )
void MdtaoPlayFinished ( TInt )
HBufC8 * MnhdoConfigurationData ( TUint32 , TUint32 , TUint32 , TUint32 )
void MnhdoNlpCompleted ( TInt )
const TTtsStyle & MnhdoStyleL ( TTtsStyleID )
void MthdCustomEvent ( TInt , TInt , const TDesC8 &)
void MthdProcessBuffer (const TDesC8 &)
void MthdTtsCompleted ( TInt )
HBufC8 * MthdoConfigurationData ( TUint32 , TUint32 , TUint32 , TUint32 )
CTTSAlgorithmManager * NewL ( MDevTTSObserver &)
void NormalizeAndSegmentTextL ( CTtsParsedText &)
void NormalizeTextL ( CTtsParsedText &)
TUint16 NumberOfStyles ()
void Pause ()
void PrimeSynthesisL ( MTtsSegmentStream &)
void PrimeSynthesisL ( CTtsParsedText &)
void SetAudioOutputL ( TInt )
void SetAudioPriority ( TInt , TDevTTSAudioPreference )
void SetBalance ( TInt )
void SetPositionL (const TTimeIntervalMicroSeconds &)
void SetPositionL (const TTtsSegment &, TInt )
void SetVolume ( TInt )
void SetVolumeRamp (const TTimeIntervalMicroSeconds &)
void Stop ()
TTtsStyle & StyleL ( TTtsStyleID )
TTtsStyle & StyleL ( TUint16 )
void SynthesizeL ( TDevTTSOutputMode )
TInt Volume ()
Private Member Functions
CTTSAlgorithmManager ( MDevTTSObserver &)
CTTSAlgorithmManager (const CTTSAlgorithmManager &)
void CheckStateL ()
void ConstructL ()
CTTSAlgorithmManager & operator= (const CTTSAlgorithmManager &)
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Private Member Enumerations
enum TDevTTSState { EDevTTSNotInitialized  = 0, EDevTTSStopped , EDevTTSPrimed , EDevTTSSynthesizing }
enum TTTSAudioPlayerState {
ETTSAudioPlayerNotInitialized  = 0, ETTSAudioPlayerInitializing , ETTSAudioPlayerIdle , ETTSAudioPlayerPlaying , ETTSAudioPlayerRecording , ETTSAudioPlayerPaused , ETTSAudioPlayerError
}
Private Attributes
CDevTTSAudio * iAudio
TTTSAudioPlayerState iAudioState
CActiveSchedulerWait iAudioWait
TInt iError
CTtsHwDevice * iHw
TBool iLastBufferFromTts
TDevTTSOutputMode iMode
CNlpHwDevice * iNlp
TBool iNlpInitialized
MDevTTSObserver & iObserver
TBool iPaused
TPtrC8 iPlaybackBuffer
TInt iStartPoint
TDevTTSState iState
TInt iStopPoint
CASRSTtpHwDevice * iTtpHw

Constructor & Destructor Documentation

CTTSAlgorithmManager(MDevTTSObserver &)

CTTSAlgorithmManager ( MDevTTSObserver & aObserver ) [private]

C++ default constructor.

Parameters

MDevTTSObserver & aObserver

CTTSAlgorithmManager(const CTTSAlgorithmManager &)

CTTSAlgorithmManager ( const CTTSAlgorithmManager & ) [private]

Parameters

const CTTSAlgorithmManager &

~CTTSAlgorithmManager()

~CTTSAlgorithmManager ( ) [virtual]

Destructor.

Member Functions Documentation

AddStyleL(const TTtsStyle &)

TTtsStyleID AddStyleL ( const TTtsStyle & aStyle )

Adds a new style to the collection. If equal style exists already, new style is not added. Will leave if an error occurs. Likely errors are: KErrNoMemory, not enough memory to add new style. KErrNotSupported, the style is not supported. KErrArgument, the style contains an imposible value.

Parameters

const TTtsStyle & aStyle

Balance()

TInt Balance ( )

Returns the current balance setting.

BufferProcessed(const TDesC8 &)

void BufferProcessed ( const TDesC8 & aBuffer )

Notifies that the buffer has been processed. The method is used if output mode of synthesizing is EDevTTSClientMode.

Parameters

const TDesC8 & aBuffer

CheckStateL()

void CheckStateL ( ) [private]

Checks if state is idle and leaves in case of error.

ConstructL()

void ConstructL ( ) [private]

By default Symbian 2nd phase constructor is private.

CustomInterface(TUid)

TAny * CustomInterface ( TUid aInterfaceID )

Request a pointer to the custom interface. Currently not in use.

Parameters

TUid aInterfaceID

DeleteStyleL(TTtsStyleID)

void DeleteStyleL ( TTtsStyleID aStyleID )

Deletes style.

Parameters

TTtsStyleID aStyleID

GetPositionL(TTimeIntervalMicroSeconds &)

void GetPositionL ( TTimeIntervalMicroSeconds & aTime ) const

Gives current position of synthesizing. The method will leave if an error occurs. Likely errors are: KErrNotReady, no synthesizing is ongoing.

Parameters

TTimeIntervalMicroSeconds & aTime

GetPositionL(TTtsSegment &, TInt &)

void GetPositionL ( TTtsSegment & aSegment,
TInt & aWordIndex
) const

Gives current position of synthesizing. The method will leave if an error occurs. Likely errors are: KErrNotReady, no synthesizing is ongoing.

Parameters

TTtsSegment & aSegment
TInt & aWordIndex

IsLanguageSupported(TLanguage)

TBool IsLanguageSupported ( TLanguage aLanguage ) const

Tells if language is supported by the TTS engine or not.

Parameters

TLanguage aLanguage

LanguageIdentificationL(CTtsParsedText &, TInt, RArray< TLanguage > &, RArray< TInt > &)

void LanguageIdentificationL ( CTtsParsedText & aText,
TInt aNumberOfGuesses,
RArray < TLanguage > & aLanguages,
RArray < TInt > & aScores
)

Calls language identification for a given text.

Since
3.0M

Parameters

CTtsParsedText & aText
TInt aNumberOfGuesses
RArray < TLanguage > & aLanguages
RArray < TInt > & aScores

MathdoConfigurationData(TUint32, TUint32, TUint32, TUint32)

HBufC8 * MathdoConfigurationData ( TUint32 aPackageType,
TUint32 aPackageID,
TUint32 aStartPosition,
TUint32 aEndPosition
)

From MASRSTtpHwDeviceObserver::MathdoConfigurationData

Callback function to load configuration data. Client provides an implementation.

Parameters

TUint32 aPackageType
TUint32 aPackageID
TUint32 aStartPosition
TUint32 aEndPosition

MathdoWordListReady(const TInt)

void MathdoWordListReady ( const TInt aError )

From MASRSTtpHwDeviceObserver::MathdoWordListReady

Callback function to notify that word list is converted. Client provides an implementation.

Parameters

const TInt aError

MaxVolume()

TInt MaxVolume ( )

Returns maximum volume value.

MdtaoBufferToBeFilled(TDes8 &, TInt)

void MdtaoBufferToBeFilled ( TDes8 & aBuffer,
TInt aSizeRequested
)

From MDevTTSAudioObserver::BufferToBeFilled

Parameters

TDes8 & aBuffer
TInt aSizeRequested

MdtaoInitializeComplete(TInt)

void MdtaoInitializeComplete ( TInt aError )

From MDevTTSAudioObserver::InitializeComplete

Parameters

TInt aError

MdtaoPlayFinished(TInt)

void MdtaoPlayFinished ( TInt aError )

From MDevTTSAudioObserver::PlayFinished

Parameters

TInt aError

MnhdoConfigurationData(TUint32, TUint32, TUint32, TUint32)

HBufC8 * MnhdoConfigurationData ( TUint32 aPackageType,
TUint32 aPackageID,
TUint32 aStartPosition,
TUint32 aEndPosition
)

From MNlpHwDeviceObserver::MnhdoConfigurationData

Invoked by TTS HW Device when it needs a configuration data package.

Parameters

TUint32 aPackageType Type identifier.
TUint32 aPackageID Identifier of package
TUint32 aStartPosition Start index in bytes
TUint32 aEndPosition End index in bytes. If the position is bigger than the size of data package, the end part will be returned.

MnhdoNlpCompleted(TInt)

void MnhdoNlpCompleted ( TInt aStatus )

From MNlpHwDeviceObserver::MnhdNlpCompleted

Called by the HW device when the synthesis has been completed.

Parameters

TInt aStatus Error code, KErrNone if success

MnhdoStyleL(TTtsStyleID)

const TTtsStyle & MnhdoStyleL ( TTtsStyleID styleID )

From MNlpHwDeviceObserver::MnhdCustomEvent

Returns style given the style id.

Parameters

TTtsStyleID styleID

MthdCustomEvent(TInt, TInt, const TDesC8 &)

void MthdCustomEvent ( TInt aEvent,
TInt aStatus,
const TDesC8 & aParameter =  KNullDesC8
)

From MTtsHwDeviceObserver::MthdCustomEvent

Called by the HW device when custom command implementation wants to notify a client.

Parameters

TInt aEvent
TInt aStatus
const TDesC8 & aParameter =  KNullDesC8

MthdProcessBuffer(const TDesC8 &)

void MthdProcessBuffer ( const TDesC8 & aBuffer )

From MTtsHwDeviceObserver::MthdProcessBuffer

Called by the HW device when the HW device has synthesized a new audio buffer.

Parameters

const TDesC8 & aBuffer

MthdTtsCompleted(TInt)

void MthdTtsCompleted ( TInt aStatus )

From MTtsHwDeviceObserver::MthdTtsCompleted

Called by the HW device when the synthesis has been completed.

Parameters

TInt aStatus

MthdoConfigurationData(TUint32, TUint32, TUint32, TUint32)

HBufC8 * MthdoConfigurationData ( TUint32 aPackageType,
TUint32 aPackageID,
TUint32 aStartPosition,
TUint32 aEndPosition
)

From MTtsHwDeviceObserver::MthdoConfigurationData

Invoked by TTS HW Device when it needs a configuration data package.

Parameters

TUint32 aPackageType
TUint32 aPackageID
TUint32 aStartPosition
TUint32 aEndPosition

NewL(MDevTTSObserver &)

CTTSAlgorithmManager * NewL ( MDevTTSObserver & aObserver ) [static]

Two-phased constructor.

Parameters

MDevTTSObserver & aObserver

NormalizeAndSegmentTextL(CTtsParsedText &)

void NormalizeAndSegmentTextL ( CTtsParsedText & aText )

Calls Natural Language Processing (NLP) to normalize and segment text.

Since
3.0M

Parameters

CTtsParsedText & aText

NormalizeTextL(CTtsParsedText &)

void NormalizeTextL ( CTtsParsedText & aText )

Calls Natural Language Processing (NLP) to normalize text.

Since
3.0M

Parameters

CTtsParsedText & aText

NumberOfStyles()

TUint16 NumberOfStyles ( ) const

Gives number of styles.

Pause()

void Pause ( )

Pauses synthesizing.

PrimeSynthesisL(MTtsSegmentStream &)

void PrimeSynthesisL ( MTtsSegmentStream & aStream )

Prepares for synthesis. The method will leave if an error occurs. Likely errors are: KErrInUse, synthesizing is currently ongoing. KErrNoMemory, not enough memory to start synthesis. KErrNotSupport, requested function is not supported.

Parameters

MTtsSegmentStream & aStream

PrimeSynthesisL(CTtsParsedText &)

void PrimeSynthesisL ( CTtsParsedText & aText )

Prepares for synthesis. The method will leave if an error occurs. Likely errors are: KErrInUse, synthesizing is currently ongoing. KErrNoMemory, not enough memory to start synthesis. KErrNotSupport, requested function is not supported.

Parameters

CTtsParsedText & aText

SetAudioOutputL(TInt)

void SetAudioOutputL ( TInt aAudioOutput )

Sets the audio output routing

Parameters

TInt aAudioOutput

SetAudioPriority(TInt, TDevTTSAudioPreference)

void SetAudioPriority ( TInt aPriority,
TDevTTSAudioPreference aPref
)

Sets the priority for audio playback if in EDevTTSSoundDeviceMode.

Parameters

TInt aPriority
TDevTTSAudioPreference aPref

SetBalance(TInt)

void SetBalance ( TInt aBalance )

Sets the playback device balance. Affects only when DevTTS is in EDevTTSSoundDeviceMode. Illegal values are neglected.

Parameters

TInt aBalance

SetPositionL(const TTimeIntervalMicroSeconds &)

void SetPositionL ( const TTimeIntervalMicroSeconds & aTime )

Sets new position for synthesizing. The method will leave if an error occurs. Likely errors are: KErrNotReady, no synthesizing is ongoing. KErrArgument, position cannot be set.

Parameters

const TTimeIntervalMicroSeconds & aTime

SetPositionL(const TTtsSegment &, TInt)

void SetPositionL ( const TTtsSegment & aSegment,
TInt aWordIndex
)

Sets new position for synthesizing. The method will leave if an error occurs. Likely errors are: KErrNotReady, no synthesizing is ongoing. KErrArgument, position cannot be set.

Parameters

const TTtsSegment & aSegment
TInt aWordIndex

SetVolume(TInt)

void SetVolume ( TInt aVolume )

Sets the playback device volume. Affects only when DevTTS is in EDevTTSSoundDeviceMode. Range is from 0.. MaxVolume() . Illegal values are neglected.

Parameters

TInt aVolume

SetVolumeRamp(const TTimeIntervalMicroSeconds &)

void SetVolumeRamp ( const TTimeIntervalMicroSeconds & aRampDuration )

Sets the volume ramp duration. Start and end volumes must be set with SetVolume() function.

Parameters

const TTimeIntervalMicroSeconds & aRampDuration

Stop()

void Stop ( )

Stops synthesizing and releases resources of synthesizing. The method does nothing if already stopped.

StyleL(TTtsStyleID)

TTtsStyle & StyleL ( TTtsStyleID aStyleID ) const

Receives style information. The method will leave if an error occurs. Likely errors are: KErrNotFound, style identifier not found.

Parameters

TTtsStyleID aStyleID

StyleL(TUint16)

TTtsStyle & StyleL ( TUint16 aIndex ) const

Receives style information. The method will leave if an error occurs. Likely errors are: KErrArgument, index is out of bounds.

Parameters

TUint16 aIndex

SynthesizeL(TDevTTSOutputMode)

void SynthesizeL ( TDevTTSOutputMode aOutputMode )

Starts synthesizing the text. The method is asynchronous, as soon as the request has been placed, function call will return. MDevTTSObserver::MdtoEvent will be called when synthesizing finishes. The method will leave if an error occurs. Likely errors are: KErrNoMemory, not enough memory. KErrInUse, synthesizing is currently ongoing

Parameters

TDevTTSOutputMode aOutputMode

Volume()

TInt Volume ( )

Returns current playback volume.

operator=(const CTTSAlgorithmManager &)

CTTSAlgorithmManager & operator= ( const CTTSAlgorithmManager & ) [private]

Parameters

const CTTSAlgorithmManager &

Member Enumerations Documentation

Enum TDevTTSState

Enumerators

EDevTTSNotInitialized = 0
EDevTTSStopped
EDevTTSPrimed
EDevTTSSynthesizing

Enum TTTSAudioPlayerState

Enumerators

ETTSAudioPlayerNotInitialized = 0
ETTSAudioPlayerInitializing
ETTSAudioPlayerIdle
ETTSAudioPlayerPlaying
ETTSAudioPlayerRecording
ETTSAudioPlayerPaused
ETTSAudioPlayerError

Member Data Documentation

CDevTTSAudio * iAudio

CDevTTSAudio * iAudio [private]

TTTSAudioPlayerState iAudioState

TTTSAudioPlayerState iAudioState [private]

CActiveSchedulerWait iAudioWait

CActiveSchedulerWait iAudioWait [private]

TInt iError

TInt iError [private]

CTtsHwDevice * iHw

CTtsHwDevice * iHw [private]

TBool iLastBufferFromTts

TBool iLastBufferFromTts [private]

TDevTTSOutputMode iMode

TDevTTSOutputMode iMode [private]

CNlpHwDevice * iNlp

CNlpHwDevice * iNlp [private]

TBool iNlpInitialized

TBool iNlpInitialized [private]

MDevTTSObserver & iObserver

MDevTTSObserver & iObserver [private]

TBool iPaused

TBool iPaused [private]

TPtrC8 iPlaybackBuffer

TPtrC8 iPlaybackBuffer [private]

TInt iStartPoint

TInt iStartPoint [private]

TDevTTSState iState

TDevTTSState iState [private]

TInt iStopPoint

TInt iStopPoint [private]

CASRSTtpHwDevice * iTtpHw

CASRSTtpHwDevice * iTtpHw [private]