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