|
1 /* |
|
2 * Copyright (c) 2006-2007 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: Speech synthesis session |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef SPEECHSYNTHESISSESSION_H |
|
20 #define SPEECHSYNTHESISSESSION_H |
|
21 |
|
22 // INCLUDES |
|
23 |
|
24 #include <e32base.h> |
|
25 #include <f32file.h> |
|
26 |
|
27 #include "speechsynthesisserverutilities.h" |
|
28 |
|
29 |
|
30 // FORWARD DECLARATIONS |
|
31 |
|
32 class CSpeechSynthesisServer; |
|
33 |
|
34 // Structure for saving custom command - value pairs |
|
35 class TCustomCommand |
|
36 { |
|
37 public: |
|
38 TInt iCommand; |
|
39 TInt iValue; |
|
40 }; |
|
41 |
|
42 |
|
43 // ---------------------------------------------------------------------------- |
|
44 // CSpeechSynthesisSession |
|
45 // Provides synthesis session functionality |
|
46 // ---------------------------------------------------------------------------- |
|
47 class CSpeechSynthesisSession : public CSession2, |
|
48 public MSpeechSynthesisServerObserver |
|
49 { |
|
50 |
|
51 public: |
|
52 |
|
53 /** |
|
54 * Constructor |
|
55 */ |
|
56 CSpeechSynthesisSession(); |
|
57 |
|
58 /** |
|
59 * Destructor |
|
60 */ |
|
61 virtual ~CSpeechSynthesisSession(); |
|
62 |
|
63 /** |
|
64 * 2nd phase construct for sessions - called by the CServer framework |
|
65 */ |
|
66 void CreateL(); |
|
67 |
|
68 public: // From base class MSpeechSynthesisServerObserver |
|
69 |
|
70 /** |
|
71 * Callback when initialized |
|
72 */ |
|
73 void MsssInitComplete( TInt aError, |
|
74 const TTimeIntervalMicroSeconds& aDuration ); |
|
75 |
|
76 /** |
|
77 * Callback when playback finished |
|
78 */ |
|
79 void MsssPlayComplete( TInt aError ); |
|
80 |
|
81 /** |
|
82 * Callback when operation aborted. |
|
83 */ |
|
84 void MsssOperationAborted(); |
|
85 |
|
86 private: |
|
87 |
|
88 // Leaves if access is denied |
|
89 void CheckAccessL( TInt aMessageType ); |
|
90 |
|
91 // Returns reference to the server |
|
92 inline CSpeechSynthesisServer& Server(); |
|
93 |
|
94 // Provides services |
|
95 void ServiceL( const RMessage2& aMessage ); |
|
96 |
|
97 // Handles asynchronous services |
|
98 void DoAsyncServiceL( const RMessage2& aMessage ); |
|
99 |
|
100 // Handles synchronous services |
|
101 void DoSyncServiceL( const RMessage2& aMessage ); |
|
102 |
|
103 // Fuctions to provide actual services |
|
104 void DoStopSynthesisL(); |
|
105 void DoPauseSynthesisL(); |
|
106 void DoGetDurationL( const RMessage2& aMessage ); |
|
107 void DoGetLanguagesL( const RMessage2& aMessage ); |
|
108 void DoGetLanguageCountL( const RMessage2& aMessage ); |
|
109 void DoGetVoicesL( const RMessage2& aMessage ); |
|
110 void DoGetVoiceCountL( const RMessage2& aMessage ); |
|
111 void DoVoiceL( const RMessage2& aMessage ); |
|
112 void DoSetVoiceL( const RMessage2& aMessage ); |
|
113 void DoMaxSpeakingRateL( const RMessage2& aMessage ); |
|
114 void DoSpeakingRateL( const RMessage2& aMessage ); |
|
115 void DoSetSpeakingRateL( const RMessage2& aMessage ); |
|
116 void DoMaxVolumeL( const RMessage2& aMessage ); |
|
117 void DoVolumeL( const RMessage2& aMessage ); |
|
118 void DoSetVolumeL( const RMessage2& aMessage ); |
|
119 void DoSetAudioPriority( const RMessage2& aMessage ); |
|
120 void DoSetAudioOutputL( const RMessage2& aMessage ); |
|
121 void DoCustomCommandL( const RMessage2& aMessage ); |
|
122 |
|
123 // Handles leave happened in ServiceL() |
|
124 void ServiceError( const RMessage2& aMessage, TInt aError ); |
|
125 |
|
126 private: |
|
127 |
|
128 // Session state information values |
|
129 enum TSessionState |
|
130 { |
|
131 ESessionIdle, |
|
132 ESessionPrimed |
|
133 }; |
|
134 |
|
135 // Asynchronous messages has to be kept in mind |
|
136 RMessage2 iStoredMessage; |
|
137 |
|
138 // Duration information filled in MsssInitComplete() |
|
139 TTimeIntervalMicroSeconds iDuration; |
|
140 |
|
141 // Current voice in use |
|
142 TVoice iCurrentVoice; |
|
143 |
|
144 // Current speking rate |
|
145 TInt iSpeakingRate; |
|
146 |
|
147 // Maximum value of speaking rate |
|
148 TInt iMaxSpeakingRate; |
|
149 |
|
150 // Current volume |
|
151 TInt iVolume; |
|
152 TInt iTmpVolume; |
|
153 |
|
154 // Maximum value of volume setting |
|
155 TInt iMaxVolume; |
|
156 |
|
157 // Current audio priority |
|
158 TInt iAudioPriority; |
|
159 |
|
160 // Current audio preference |
|
161 TInt iAudioPreference; |
|
162 |
|
163 // Current audio output |
|
164 TInt iAudioOutput; |
|
165 TInt iTmpAudioOutput; |
|
166 |
|
167 // Session state information |
|
168 TSessionState iSessionState; |
|
169 |
|
170 // Used when client is asking supported languages. |
|
171 RArray<TLanguage> iLanguages; |
|
172 |
|
173 // Used when client is asking supported voices. |
|
174 RArray<TVoice> iVoices; |
|
175 |
|
176 // Array for custom commands |
|
177 RArray<TCustomCommand> iCustomCommands; |
|
178 |
|
179 // File handle used for saving output to file. |
|
180 RFile iFile; |
|
181 |
|
182 // ETrue when file output is activated |
|
183 TBool iFileOutputActivated; |
|
184 |
|
185 // ETrue when closing of a plugin has been requested |
|
186 TBool iClosePlugin; |
|
187 |
|
188 }; |
|
189 |
|
190 #endif // SPEECHSYNTHESISSESSION_H |