|
1 /* |
|
2 * Copyright (c) 2005-2006 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: This class acts as a high level wrapper around the media server |
|
15 * playback and recording functionalities. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 #ifndef AUDIOMESSAGERECORDER_H |
|
23 #define AUDIOMESSAGERECORDER_H |
|
24 |
|
25 #include <e32base.h> |
|
26 #include <mdaaudiosampleeditor.h> |
|
27 |
|
28 class MAmsVoiceObserver; |
|
29 class CAudioOutput; |
|
30 class CAudioInput; |
|
31 class CMdaAudioRecorderUtility; |
|
32 class CAudioMessageBeep; |
|
33 |
|
34 const TInt KAmsDisplayUpdateDelay = 200000; |
|
35 |
|
36 /** |
|
37 * Class for control recording and playing operations |
|
38 * |
|
39 * @lib audiomessage.exe |
|
40 * @since S60 v3.1 |
|
41 */ |
|
42 class CAudioMessageRecorder |
|
43 : public CBase, public MMdaObjectStateChangeObserver |
|
44 { |
|
45 public: |
|
46 /** |
|
47 * Default constructor |
|
48 */ |
|
49 CAudioMessageRecorder(); |
|
50 |
|
51 /** |
|
52 * Destructor |
|
53 */ |
|
54 ~CAudioMessageRecorder(); |
|
55 |
|
56 |
|
57 static CAudioMessageRecorder* NewL(const RFile& aFile, const TBool aAudioOutput ); |
|
58 |
|
59 private: |
|
60 |
|
61 void ConstructL(const RFile& aFile, const TBool aAudioOutput ); |
|
62 |
|
63 public: |
|
64 /** |
|
65 * Encapsulates the interface for handling the change of state of |
|
66 * an audio data sample object. |
|
67 * @param aObject A pointer to the audio sample object that has |
|
68 * changed state. |
|
69 * @param aPreviousState The state before the change |
|
70 * @param aCurrentState The state after the change |
|
71 * @param aErrorCode If not KErrNone, then the error that |
|
72 * caused the state change |
|
73 */ |
|
74 void MoscoStateChangeEvent(CBase* aObject, TInt aPreviousState, |
|
75 TInt aCurrentState, TInt aErrorCode); |
|
76 |
|
77 /** |
|
78 * Registers an observer for receiving update notifications. |
|
79 * @param aObserver The observer object. |
|
80 */ |
|
81 void SetObserver( MAmsVoiceObserver* aObserver ); |
|
82 |
|
83 /** |
|
84 * Starts recording. |
|
85 */ |
|
86 void StartRecordingL(); |
|
87 |
|
88 /** |
|
89 * Starts playback. |
|
90 */ |
|
91 void StartPlayingL(); |
|
92 |
|
93 /** |
|
94 * Stops playback or recording. |
|
95 */ |
|
96 void StopL(); |
|
97 |
|
98 /** |
|
99 * Pauses recording. |
|
100 */ |
|
101 void Pause(); |
|
102 |
|
103 /** |
|
104 * Continues recording. |
|
105 */ |
|
106 void ContinueL(); |
|
107 |
|
108 /** |
|
109 * Position for pause use |
|
110 * @return position in ms |
|
111 */ |
|
112 TTimeIntervalMicroSeconds GetPosition(); |
|
113 |
|
114 /** |
|
115 * Duration for playing use |
|
116 * @return position in ms |
|
117 */ |
|
118 TTimeIntervalMicroSeconds GetDuration(); |
|
119 |
|
120 /** |
|
121 * bitrate for size calc. |
|
122 */ |
|
123 TUint GetBitRateL(); |
|
124 |
|
125 /** |
|
126 * Stops and deletes the timer object. |
|
127 */ |
|
128 void StopTimer(); |
|
129 |
|
130 /** |
|
131 * increace vol. |
|
132 */ |
|
133 void IncrementVol(); |
|
134 |
|
135 /** |
|
136 * dec vol. |
|
137 */ |
|
138 void DecrementVol(); |
|
139 |
|
140 /** |
|
141 * Gets volume |
|
142 * @return currentvolume |
|
143 */ |
|
144 TInt GetCurrentVolume(); |
|
145 |
|
146 /** |
|
147 * Sets volume |
|
148 * @param aVal wanted volume |
|
149 */ |
|
150 void SetVol(TInt aVal); |
|
151 |
|
152 /** |
|
153 * Sets audiorouting |
|
154 * @param EFalse earpiece,ETrue loudspkr |
|
155 */ |
|
156 TInt SetAudioOutput(TBool aOutputPublic); |
|
157 |
|
158 /** |
|
159 * Initialize routing |
|
160 */ |
|
161 void InitializeAudioRoutingL(); |
|
162 |
|
163 |
|
164 private: |
|
165 |
|
166 /** |
|
167 * Creates and starts a CPeriodic timer object |
|
168 * with a resolution of one second. |
|
169 */ |
|
170 void StartTimer(); |
|
171 static TInt TimerCallBack( TAny* aMdaRecorder ); |
|
172 void HandleTick(); |
|
173 void ResetAudioInputL(); |
|
174 |
|
175 private: //data |
|
176 /** |
|
177 * Pointer to the media server audio recorder object. |
|
178 * Owned. |
|
179 */ |
|
180 CMdaAudioRecorderUtility* iRecUtility; |
|
181 |
|
182 /** |
|
183 * CActiveScheduler wrapper object. |
|
184 * Owned. |
|
185 */ |
|
186 CActiveSchedulerWait iActiveWait; |
|
187 |
|
188 /** |
|
189 * Pointer to the timer object. |
|
190 * Owned. |
|
191 */ |
|
192 CPeriodic* iTimer; |
|
193 |
|
194 /** |
|
195 * Pointer to the status observer. |
|
196 * Not owned. |
|
197 */ |
|
198 MAmsVoiceObserver* iObserver; |
|
199 |
|
200 /** |
|
201 * Pointer to the audiorouting object. |
|
202 * Owned. |
|
203 */ |
|
204 CAudioOutput* iAudioOutput; |
|
205 CAudioInput* iAudioInput; |
|
206 |
|
207 /** |
|
208 * For storing current volume |
|
209 */ |
|
210 TInt iCurrentVolume; |
|
211 |
|
212 /** |
|
213 * True if outputrouting is supported |
|
214 */ |
|
215 TBool iSupportAudioOutput; |
|
216 |
|
217 /** |
|
218 * For playing the recording start and stop tones. |
|
219 * Owned. |
|
220 */ |
|
221 CAudioMessageBeep* iBeepPlayer; |
|
222 |
|
223 /** |
|
224 * ETrue if pause |
|
225 */ |
|
226 TBool iPause; |
|
227 TInt iErrorCode; |
|
228 }; |
|
229 |
|
230 #endif // AUDIOMESSAGERECORDER_H |
|
231 |