|
1 /* |
|
2 * Copyright (c) 2005-2009 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef T_CMMFDEVSOUND_DATA_H |
|
21 #define T_CMMFDEVSOUND_DATA_H |
|
22 |
|
23 //User includes |
|
24 #include "datawrapperbase.h" |
|
25 |
|
26 //Epoc Includes |
|
27 #include <sounddevice.h> //CMMFDevSound |
|
28 |
|
29 /** |
|
30 * This class tests the CMMFDevSound API's |
|
31 */ |
|
32 |
|
33 enum THwDeviceType |
|
34 { |
|
35 EDecoder, |
|
36 EEncoder |
|
37 }; |
|
38 |
|
39 class CT_CMMFDevSoundData : public CDataWrapperBase, public MDevSoundObserver |
|
40 { |
|
41 public: |
|
42 ~CT_CMMFDevSoundData(); |
|
43 static CT_CMMFDevSoundData* NewL(); |
|
44 virtual TAny* GetObject(); |
|
45 virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex); |
|
46 |
|
47 protected: |
|
48 CT_CMMFDevSoundData(); |
|
49 void ConstructL(); |
|
50 |
|
51 private: |
|
52 void UtilityFourCCToHwDeviceUidL(const TDesC& aFourCC, THwDeviceType aType, TUid& aHwDeviceUid); |
|
53 void DestroyData(); |
|
54 void Stop(); |
|
55 void PlayData(); |
|
56 void RecordData(); |
|
57 |
|
58 /** From MDevSoundObserver */ |
|
59 virtual void InitializeComplete(TInt aError); |
|
60 virtual void ToneFinished(TInt aError); |
|
61 virtual void BufferToBeFilled(CMMFBuffer* aBuffer); |
|
62 virtual void PlayError(TInt aError); |
|
63 virtual void BufferToBeEmptied(CMMFBuffer* aBuffer); |
|
64 virtual void RecordError(TInt aError); |
|
65 virtual void ConvertError(TInt aError); |
|
66 virtual void DeviceMessage(TUid uid, const TDesC8& aMsg); |
|
67 |
|
68 protected: |
|
69 void DoCmdNewL(); |
|
70 void DoCmdNewLLoopL(const TTEFSectionName&aSection); |
|
71 void DoCmdDestructor(); |
|
72 void DoCmdCapabilities(); |
|
73 void DoCmdConfig(); |
|
74 void DoCmdMaxGain(const TTEFSectionName& aSection); |
|
75 void DoCmdMaxVolume(const TTEFSectionName& aSection); |
|
76 void DoCmdGetPlayBalanceL(const TTEFSectionName& aSection); |
|
77 void DoCmdGetRecordBalanceL(const TTEFSectionName& aSection); |
|
78 void DoCmdGetSupportedInputDataTypesL(); |
|
79 void DoCmdGetSupportedOutputDataTypesL(); |
|
80 void DoCmdSamplesPlayed(); |
|
81 void DoCmdSamplesRecorded(); |
|
82 void DoCmdVolume(const TTEFSectionName& aSection); |
|
83 void DoCmdGain(const TTEFSectionName& aSection); |
|
84 void DoCmdFixedSequenceCount(); |
|
85 void DoCmdFixedSequenceName(const TTEFSectionName& aSection); |
|
86 void DoCmdSetConfigL(const TTEFSectionName& aSection); |
|
87 void DoCmdSetDTMFLengths(const TTEFSectionName& aSection); |
|
88 void DoCmdSetGain(const TTEFSectionName& aSection); |
|
89 void DoCmdSetPlayBalanceL(const TTEFSectionName& aSection); |
|
90 void DoCmdSetPrioritySettings(const TTEFSectionName& aSection); |
|
91 void DoCmdSetRecordBalanceL(const TTEFSectionName& aSection); |
|
92 void DoCmdSetToneRepeats(const TTEFSectionName& aSection); |
|
93 void DoCmdSetVolume(const TTEFSectionName& aSection); |
|
94 void DoCmdSetVolumeRamp(const TTEFSectionName& aSection); |
|
95 void DoCmdInitializeL(const TTEFSectionName& aSection, const TInt aAsyncErrorIndex); |
|
96 void DoCmdPlayDTMFStringL(const TTEFSectionName& aSection, const TInt aAsyncErrorIndex); |
|
97 void DoCmdPlayData(); |
|
98 void DoCmdPlayDualToneL(const TTEFSectionName& aSection, const TInt aAsyncErrorIndex); |
|
99 void DoCmdPlayInitL(const TInt aAsyncErrorIndex); |
|
100 void DoCmdPlayToneL(const TTEFSectionName& aSection , const TInt aAsyncErrorIndex); |
|
101 void DoCmdPlayToneSequenceL(const TTEFSectionName& aSection , const TInt aAsyncErrorIndex); |
|
102 void DoCmdRecordData(); |
|
103 void DoCmdRecordInitL(const TInt aAsyncErrorIndex); |
|
104 void DoCmdStop(const TTEFSectionName& aSection); |
|
105 void DoCmdSetVolumeLoop(const TTEFSectionName& aSection); |
|
106 |
|
107 void DoCmdUtilityErrorConceal(); |
|
108 void DoCmdUtilityReplaceFile(const TTEFSectionName& aSection); |
|
109 void DoCmdUtilityOpenFile(const TTEFSectionName& aSection); |
|
110 void DoCmdUtilityCloseFile(); |
|
111 void DoCmdUtilityFileStartPosition(); |
|
112 |
|
113 private: |
|
114 |
|
115 /** |
|
116 * Wrapped object |
|
117 */ |
|
118 CMMFDevSound* iDevSound; |
|
119 /** |
|
120 * Array to store DevSound objects |
|
121 */ |
|
122 RPointerArray<CMMFDevSound> iObjectsDevSound; |
|
123 /** |
|
124 * Prority settings |
|
125 */ |
|
126 TMMFPrioritySettings iPrioritySettings; |
|
127 /** |
|
128 * Capabilities |
|
129 */ |
|
130 TMMFCapabilities iCapabilities; |
|
131 /** |
|
132 * Store the volume value |
|
133 */ |
|
134 TInt iVolumeValue; |
|
135 /** |
|
136 * Store the gain value |
|
137 */ |
|
138 TInt iGainValue; |
|
139 /** |
|
140 * Left percentage |
|
141 */ |
|
142 TInt iLeftPercentage; |
|
143 /** |
|
144 * Right percentage |
|
145 */ |
|
146 TInt iRightPercentage; |
|
147 /** |
|
148 * File Server |
|
149 */ |
|
150 RFs iFs; |
|
151 /** |
|
152 * File for tones |
|
153 */ |
|
154 RFile iToneFile; |
|
155 /** |
|
156 * File for audio |
|
157 */ |
|
158 RFile iAudiofile; |
|
159 /** |
|
160 * Buffer to be filled or to review if it's empty |
|
161 */ |
|
162 CMMFBuffer* iBuffer; |
|
163 /** |
|
164 * Last sample of audio file |
|
165 */ |
|
166 TInt iLastSample; |
|
167 /** |
|
168 * for control the pause (DoCmdPause) |
|
169 */ |
|
170 TBool iPaused; |
|
171 /** |
|
172 * Conceal the error |
|
173 */ |
|
174 TBool iErrorConceal; |
|
175 /** |
|
176 * End of file |
|
177 */ |
|
178 TBool iEndFile; |
|
179 /** |
|
180 * Buffer to be filled with tone sequence |
|
181 */ |
|
182 TBuf8<1024> iToneSequence; |
|
183 /** |
|
184 * Enum for channels |
|
185 */ |
|
186 static const TEnumEntryTable iEnumChannels[]; |
|
187 /** |
|
188 * Enum for sample rate |
|
189 */ |
|
190 static const TEnumEntryTable iEnumSampleRate[]; |
|
191 /** |
|
192 * Enum for the mode |
|
193 */ |
|
194 static const TEnumEntryTable iEnumMode[]; |
|
195 /** |
|
196 * Enum for the priorities |
|
197 */ |
|
198 static const TEnumEntryTable iEnumPriority[]; |
|
199 /** |
|
200 * Enum for the priority preference |
|
201 */ |
|
202 static const TEnumEntryTable iEnumPriorityPreference[]; |
|
203 /** |
|
204 * Enum for initialize(FourCC, HwDevice) the mode and state |
|
205 */ |
|
206 static const TEnumEntryTable iEnumInitializeLType[]; |
|
207 /** |
|
208 * Async Error Index of RecordError. |
|
209 */ |
|
210 TInt iRecordErrorIndex; |
|
211 /** |
|
212 * Async Error Index of PlayError. |
|
213 */ |
|
214 TInt iPlayErrorIndex; |
|
215 /** |
|
216 * Async Error Index of ToneError. |
|
217 */ |
|
218 TInt iToneErrorIndex; |
|
219 /** |
|
220 * Async Error Index of InitializeError. |
|
221 */ |
|
222 TInt iInitializeErrorIndex; |
|
223 |
|
224 }; |
|
225 |
|
226 #endif // T_CMMFDEVSOUND_DATA_H |