|
1 /* |
|
2 * Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Algorithms for text normalization |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 #ifndef NLPHWDEVICE_H |
|
23 #define NLPHWDEVICE_H |
|
24 |
|
25 // INCLUDES |
|
26 #include <e32std.h> |
|
27 #include <e32base.h> |
|
28 #include <nssttscommon.h> |
|
29 #include <asrshwdevice.h> |
|
30 |
|
31 // FORWARD DECLARATIONS |
|
32 class CNlpAlgorithm; |
|
33 |
|
34 // CLASS DECLARATION |
|
35 /** |
|
36 * Class to define callback functions |
|
37 * |
|
38 * @lib asrsttshwdevice.lib |
|
39 * @since 3.0 |
|
40 */ |
|
41 class MNlpHwDeviceObserver |
|
42 { |
|
43 public: // New functions |
|
44 |
|
45 /** |
|
46 * Called by the HW device when the asynchronous text processing |
|
47 * has been completed. |
|
48 * @since 3.0 |
|
49 * @param aStatus Error code, KErrNone if success |
|
50 * @return none |
|
51 */ |
|
52 virtual void MnhdoNlpCompleted( TInt aStatus ) = 0; |
|
53 |
|
54 |
|
55 /** |
|
56 * Invoked by Nlp Hw Device when it needs a configuration data package. |
|
57 * @since 3.0 |
|
58 * @param aPackageType Type identifier. |
|
59 * @param aPackageID Identifier of package |
|
60 * @param aStartPosition Start index in bytes |
|
61 * @param aEndPosition End index in bytes. If the position is bigger |
|
62 * than the size of data package, the end part will be returned. |
|
63 * @return Data package in a buffer |
|
64 */ |
|
65 virtual HBufC8* MnhdoConfigurationData( TUint32 aPackageType, |
|
66 TUint32 aPackageID, |
|
67 TUint32 aStartPosition = 0, |
|
68 TUint32 aEndPosition = KMaxTUint32 |
|
69 ) = 0; |
|
70 |
|
71 |
|
72 /** |
|
73 * Returns style given the style id. |
|
74 * @since 3.0 |
|
75 * @param aStyleID The style id. |
|
76 * @return A reference to TTtsStyle. |
|
77 */ |
|
78 virtual const TTtsStyle& MnhdoStyleL( TTtsStyleID aStyleID ) = 0; |
|
79 |
|
80 }; |
|
81 |
|
82 |
|
83 /** |
|
84 * Class to provide text normalization |
|
85 * |
|
86 * @lib asrsnlphwdevice.lib |
|
87 * @since 3.0 |
|
88 */ |
|
89 class CNlpHwDevice : public CASRSHwDevice |
|
90 { |
|
91 public: // Constructors and destructor |
|
92 |
|
93 /** |
|
94 * Two-phased constructor. |
|
95 * @param aObserver Observer which implements callback functions. |
|
96 * @param aSamplingRate Sampling rate for output audio |
|
97 * @param aBufferSize Buffer size for output audio |
|
98 */ |
|
99 IMPORT_C static CNlpHwDevice* NewL( MNlpHwDeviceObserver& aObserver ); |
|
100 |
|
101 /** |
|
102 * Destructor. |
|
103 */ |
|
104 IMPORT_C virtual ~CNlpHwDevice(); |
|
105 |
|
106 public: // New functions |
|
107 |
|
108 /** |
|
109 * Ask if a language is supported or not. |
|
110 * @since 3.0 |
|
111 * @param aLanguage Synthesizing language. |
|
112 * @return ETrue language is supported otherwise EFalse |
|
113 */ |
|
114 IMPORT_C TBool IsLanguageSupported( TLanguage aLanguage ); |
|
115 |
|
116 |
|
117 /** |
|
118 * Normalize given text, text is not splits into segments. |
|
119 * @since 3.0 |
|
120 * @param aText |
|
121 */ |
|
122 IMPORT_C void NormalizeTextL( CTtsParsedText& aText ); |
|
123 |
|
124 |
|
125 /** |
|
126 * Normalize given text asynchronously, text is not splits into segments. |
|
127 * @since 3.0 |
|
128 * @param aText |
|
129 */ |
|
130 IMPORT_C void NormalizeTextAsyncL( CTtsParsedText& aText ); |
|
131 |
|
132 |
|
133 /** |
|
134 * Normalize given text, text is split into segments |
|
135 * @since 3.0 |
|
136 * @param aText |
|
137 */ |
|
138 IMPORT_C void NormalizeAndSegmentTextL( CTtsParsedText& aText ); |
|
139 |
|
140 /** |
|
141 * Normalize given text asynchronously, text is split into segments |
|
142 * @since 3.0 |
|
143 * @param aText |
|
144 */ |
|
145 IMPORT_C void NormalizeAndSegmentTextAsyncL( CTtsParsedText& aText ); |
|
146 |
|
147 private: |
|
148 |
|
149 /** |
|
150 * C++ default constructor. |
|
151 */ |
|
152 CNlpHwDevice(); |
|
153 |
|
154 /** |
|
155 * By default Symbian 2nd phase constructor is private. |
|
156 */ |
|
157 void ConstructL( MNlpHwDeviceObserver& aObserver ); |
|
158 |
|
159 private: // Data |
|
160 |
|
161 // Actual algorithm where all processing happens |
|
162 CNlpAlgorithm* iAlgorithm; |
|
163 |
|
164 // Reserved pointer for future extension |
|
165 TAny* iReserved; |
|
166 |
|
167 }; |
|
168 |
|
169 #endif // NLPHWDEVICE_H |
|
170 |
|
171 // End of File |