0
|
1 |
/*
|
|
2 |
* Copyright (c) 2002 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: AudioroutingControl test module
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
// INCLUDE FILES
|
|
21 |
#include "AudioRoutingTestClass.h"
|
|
22 |
#include "debug.h"
|
|
23 |
|
|
24 |
|
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
/************************************************************************************************************/
|
|
29 |
|
|
30 |
//Devsound initialization is completed.Configure devsound capabilities.
|
|
31 |
void CAudioRoutingTestClass::InitializeComplete(TInt aError)
|
|
32 |
{
|
|
33 |
if (aError)
|
|
34 |
{
|
|
35 |
FTRACE(FPrint(_L("InitializeComplete Error, return code =%d!!!"),aError));
|
|
36 |
iLog->Log(_L("InitializeComplete Error, return code =%d!!!"),aError);
|
|
37 |
}
|
|
38 |
else
|
|
39 |
{
|
|
40 |
FTRACE(FPrint(_L("InitializeComplete")));
|
|
41 |
iLog->Log(_L("InitializeComplete OK, return code =%d!!!"),aError);
|
|
42 |
}
|
|
43 |
ProcessEvent(EInitializeComplete, aError);
|
|
44 |
|
|
45 |
}
|
|
46 |
|
|
47 |
|
|
48 |
void CAudioRoutingTestClass::ToneFinished(TInt aError)
|
|
49 |
{
|
|
50 |
FTRACE(FPrint(_L("CAudioRoutingTestClass::ToneFinished")));
|
|
51 |
iLog->Log(_L("ToneFinished, return code =%d!!!"),aError);
|
|
52 |
// Panic(KErrNotSupported);
|
|
53 |
}
|
|
54 |
|
|
55 |
//This is called when an empty audio buffer is available.Fill the buffer with audio data.
|
|
56 |
void CAudioRoutingTestClass::BufferToBeFilled(CMMFBuffer* /*aBuffer*/)
|
|
57 |
{
|
|
58 |
FTRACE(FPrint(_L("CAudioRoutingTestClass::BufferToBeFilled")));
|
|
59 |
iLog->Log(_L("BufferToBeFilled, return code =!!!"));
|
|
60 |
}
|
|
61 |
|
|
62 |
//This is called when an audio play completion is successfully played or otherwise
|
|
63 |
void CAudioRoutingTestClass::PlayError(TInt aError)
|
|
64 |
{
|
|
65 |
FTRACE(FPrint(_L("CAudioRoutingTestClass::PlayError")));
|
|
66 |
iLog->Log(_L("PlayError, return code =%d!!!"),aError);
|
|
67 |
}
|
|
68 |
|
|
69 |
|
|
70 |
//Will panic if called.Should not be called during playing
|
|
71 |
void CAudioRoutingTestClass::BufferToBeEmptied(CMMFBuffer* /*aBuffer*/)
|
|
72 |
{
|
|
73 |
FTRACE(FPrint(_L("CAudioRoutingTestClass::BufferToBeEmptied")));
|
|
74 |
iLog->Log(_L("BufferToBeEmptied, return code =!!!"));
|
|
75 |
}
|
|
76 |
|
|
77 |
|
|
78 |
//Will panic if called.Should not be called during playing
|
|
79 |
void CAudioRoutingTestClass::RecordError(TInt aError)
|
|
80 |
{
|
|
81 |
FTRACE(FPrint(_L("CAudioRoutingTestClass::RecordError")));
|
|
82 |
iLog->Log(_L("RecordError, return code =%d!!!"),aError);
|
|
83 |
}
|
|
84 |
|
|
85 |
|
|
86 |
//Will panic if called.Should not be called during playing
|
|
87 |
void CAudioRoutingTestClass::ConvertError(TInt aError)
|
|
88 |
{
|
|
89 |
FTRACE(FPrint(_L("CAudioRoutingTestClass::ConvertError")));
|
|
90 |
iLog->Log(_L("ConvertError, return code =%d!!!"),aError);
|
|
91 |
}
|
|
92 |
|
|
93 |
|
|
94 |
//Will panic if called.Should not be called during playing
|
|
95 |
void CAudioRoutingTestClass::DeviceMessage(TUid /*aMessageType*/, const TDesC8& /*aMsg*/)
|
|
96 |
{
|
|
97 |
// Panic(KErrNotSupported);
|
|
98 |
}
|
|
99 |
|
|
100 |
void CAudioRoutingTestClass::MapcInitComplete(TInt aError,const TTimeIntervalMicroSeconds& /*aDuration*/)
|
|
101 |
{
|
|
102 |
iLog->Log(_L("CAudioInput::MapcInitComplete(*iRecorder) aError = %d!!!"),aError);
|
|
103 |
if (isInput != EFalse)
|
|
104 |
{
|
|
105 |
TInt err = KErrNone;
|
|
106 |
TRAP(err,iRecorder->OpenFileL(_L("c:\\testrecord.amr")));
|
|
107 |
if (err!=KErrNone)
|
|
108 |
{
|
|
109 |
iLog->Log(_L("iRecorder->OpenFileL Failed =%d!!!"),err);
|
|
110 |
}
|
|
111 |
}
|
|
112 |
}
|
|
113 |
void CAudioRoutingTestClass::MoscoStateChangeEvent(CBase* /*aObject*/, TInt /*aPreviousState*/, TInt aCurrentState, TInt aErrorCode)
|
|
114 |
{
|
|
115 |
if (aCurrentState == CMdaAudioClipUtility::EOpen)
|
|
116 |
{
|
|
117 |
if (isInput != EFalse)
|
|
118 |
{
|
|
119 |
iLog->Log(_L("MoscoStateChangeEvent = %d!!!"),aErrorCode);
|
|
120 |
}
|
|
121 |
}
|
|
122 |
}
|
|
123 |
|
|
124 |
void CAudioRoutingTestClass::MapcPlayComplete(
|
|
125 |
TInt /*aError*/
|
|
126 |
)
|
|
127 |
{
|
|
128 |
|
|
129 |
}
|
|
130 |
|
|
131 |
void CAudioRoutingTestClass::MaiscOpenComplete(TInt aError)
|
|
132 |
{
|
|
133 |
iPlayError = aError;
|
|
134 |
if (aError==KErrNone && iAudioInputStream)
|
|
135 |
{
|
|
136 |
iReady = ETrue;
|
|
137 |
|
|
138 |
iStreamSettings.iSampleRate = TMdaAudioDataSettings::ESampleRate8000Hz;
|
|
139 |
iStreamSettings.iChannels = TMdaAudioDataSettings::EChannelsMono;
|
|
140 |
|
|
141 |
iAudioInputStream->SetAudioPropertiesL(iStreamSettings.iSampleRate,iStreamSettings.iChannels);
|
|
142 |
iAudioInputStream->SetGain(iAudioInputStream->MaxGain());
|
|
143 |
iAudioInputStream->SetPriority(EPriorityNormal, EMdaPriorityPreferenceTime);
|
|
144 |
iStreamIdx=0;
|
|
145 |
iAudioInputStream->ReadL(*iStreamBuffer[iStreamIdx]);
|
|
146 |
}
|
|
147 |
}
|
|
148 |
|
|
149 |
|
|
150 |
void CAudioRoutingTestClass::MaiscBufferCopied(TInt aError, const TDesC8& aBuffer)
|
|
151 |
{
|
|
152 |
iPlayError = aError;
|
|
153 |
if (aError==KErrNone && iAudioInputStream)
|
|
154 |
{
|
|
155 |
if (&aBuffer==iStreamBuffer[iStreamBuffer.Count()-1])
|
|
156 |
iStreamIdx=0;
|
|
157 |
else
|
|
158 |
iStreamIdx++;
|
|
159 |
|
|
160 |
iAudioInputStream->ReadL(*iStreamBuffer[iStreamIdx]);
|
|
161 |
if(aBuffer.Length())
|
|
162 |
{
|
|
163 |
TInt ll = aBuffer.Length() + iSoundData->Des().Length();
|
|
164 |
|
|
165 |
if(ll < KMaxFileSize)
|
|
166 |
{
|
|
167 |
iSoundData->Des().Append(aBuffer);
|
|
168 |
}
|
|
169 |
else
|
|
170 |
{
|
|
171 |
iAudioInputStream->Stop();
|
|
172 |
}
|
|
173 |
}
|
|
174 |
}
|
|
175 |
}
|
|
176 |
|
|
177 |
void CAudioRoutingTestClass::MaiscRecordComplete(TInt aError)
|
|
178 |
{
|
|
179 |
iPlayError = aError;
|
|
180 |
}
|
|
181 |
|
|
182 |
|
|
183 |
void CAudioRoutingTestClass::DefaultAudioOutputChanged( CAudioOutput& /*aAudioOutput*/,
|
|
184 |
#ifdef _DEBUG
|
|
185 |
CAudioOutput::TAudioOutputPreference aNewDefault )
|
|
186 |
#else
|
|
187 |
CAudioOutput::TAudioOutputPreference /*aNewDefault*/ )
|
|
188 |
#endif
|
|
189 |
{
|
|
190 |
#ifdef _DEBUG
|
|
191 |
iLog->Log(_L("CRoutingAppUi::DefaultAudioOutputChanged - aNewDefault = %d"),aNewDefault);
|
|
192 |
#endif
|
|
193 |
}
|
|
194 |
|
|
195 |
|
|
196 |
// Audio Output Stream
|
|
197 |
void CAudioRoutingTestClass::MaoscOpenComplete(TInt aError)
|
|
198 |
{
|
|
199 |
iLog->Log(_L("MaoscOpenComplete, return code =%d!!!"),aError);
|
|
200 |
//ProcessEvent(EInitializeComplete, aError);
|
|
201 |
}
|
|
202 |
|
|
203 |
void CAudioRoutingTestClass::MaoscBufferCopied(TInt aError, const TDesC8& /*aBuffer*/)
|
|
204 |
{
|
|
205 |
iLog->Log(_L("MaoscBufferCopied, return code =%d!!!"),aError);
|
|
206 |
// ProcessEvent(EInitializeComplete, aError);
|
|
207 |
}
|
|
208 |
|
|
209 |
void CAudioRoutingTestClass::MaoscPlayComplete(TInt aError)
|
|
210 |
{
|
|
211 |
iLog->Log(_L("MaoscPlayComplete, return code =%d!!!"),aError);
|
|
212 |
// ProcessEvent(EInitializeComplete, aError);
|
|
213 |
}
|
|
214 |
|
|
215 |
// Audio Tone Observer
|
|
216 |
void CAudioRoutingTestClass::MatoPrepareComplete(TInt aError)
|
|
217 |
{
|
|
218 |
iLog->Log(_L("MatoPrepareComplete, return code =%d!!!"),aError);
|
|
219 |
//ProcessEvent(EInitializeComplete, aError);
|
|
220 |
}
|
|
221 |
|
|
222 |
void CAudioRoutingTestClass::MatoPlayComplete(TInt aError)
|
|
223 |
{
|
|
224 |
iLog->Log(_L("MatoPlayComplete, return code =%d!!!"),aError);
|
|
225 |
//ProcessEvent(EInitializeComplete, aError);
|
|
226 |
}
|
|
227 |
|
|
228 |
|
|
229 |
// MidiClientUtilityObserver
|
|
230 |
void CAudioRoutingTestClass::MmcuoStateChanged(TMidiState /*aOldState*/,TMidiState /*aNewState*/,const TTimeIntervalMicroSeconds& /*aTime*/,TInt aError)
|
|
231 |
{
|
|
232 |
iLog->Log(_L("MmcuoStateChanged, return code =%d!!!"),aError);
|
|
233 |
//ProcessEvent(EInitializeComplete, aError);
|
|
234 |
}
|
|
235 |
|
|
236 |
void CAudioRoutingTestClass::MmcuoTempoChanged(TInt aMicroBeatsPerMinute)
|
|
237 |
{
|
|
238 |
iLog->Log(_L("MmcuoTempoChanged, return aMicroBeatsPerMinute =%d!!!"),aMicroBeatsPerMinute);
|
|
239 |
}
|
|
240 |
|
|
241 |
void CAudioRoutingTestClass::MmcuoVolumeChanged(TInt aChannel,TReal32 /*aVolumeInDecibels*/)
|
|
242 |
{
|
|
243 |
iLog->Log(_L("MmcuoVolumeChanged, return aChannel =%d!!!"),aChannel);
|
|
244 |
}
|
|
245 |
|
|
246 |
void CAudioRoutingTestClass::MmcuoMuteChanged(TInt aChannel,TBool /*aMuted*/)
|
|
247 |
{
|
|
248 |
iLog->Log(_L("MmcuoMuteChanged, return aChannel =%d!!!"),aChannel);
|
|
249 |
}
|
|
250 |
|
|
251 |
void CAudioRoutingTestClass::MmcuoSyncUpdate(const TTimeIntervalMicroSeconds& /*aMicroSeconds*/,TInt64 aMicroBeats)
|
|
252 |
{
|
|
253 |
iLog->Log(_L("MmcuoSyncUpdate, return aMicroBeats =%d!!!"),aMicroBeats);
|
|
254 |
}
|
|
255 |
|
|
256 |
void CAudioRoutingTestClass::MmcuoMetaDataEntryFound(const TInt aMetaDataEntryId,const TTimeIntervalMicroSeconds& /*aPosition*/)
|
|
257 |
{
|
|
258 |
iLog->Log(_L("MmcuoMetaDataEntryFound, return aMetaDataEntryId =%d!!!"),aMetaDataEntryId);
|
|
259 |
}
|
|
260 |
|
|
261 |
void CAudioRoutingTestClass::MmcuoMipMessageReceived(const RArray<TMipMessageEntry>& /*aMessage*/)
|
|
262 |
{
|
|
263 |
iLog->Log(_L("MmcuoMipMessageReceived, !!!"));
|
|
264 |
}
|
|
265 |
|
|
266 |
void CAudioRoutingTestClass::MmcuoPolyphonyChanged(TInt aNewPolyphony)
|
|
267 |
{
|
|
268 |
iLog->Log(_L("MmcuoPolyphonyChanged, return code =%d!!!"),aNewPolyphony);
|
|
269 |
}
|
|
270 |
|
|
271 |
void CAudioRoutingTestClass::MmcuoInstrumentChanged(TInt aChannel,TInt /*aBankId*/,TInt /*aInstrumentId*/)
|
|
272 |
{
|
|
273 |
iLog->Log(_L("MmcuoInstrumentChanged, return aChannel =%d!!!"),aChannel);
|
|
274 |
}
|
|
275 |
|
|
276 |
//MDrmAudioPlayerCallback
|
|
277 |
void CAudioRoutingTestClass::MdapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& /*aDuration*/)
|
|
278 |
{
|
|
279 |
iLog->Log(_L("MdapcInitComplete, return code =%d!!!"),aError);
|
|
280 |
//ProcessEvent(EInitializeComplete, aError);
|
|
281 |
}
|
|
282 |
|
|
283 |
void CAudioRoutingTestClass::MdapcPlayComplete(TInt aError)
|
|
284 |
{
|
|
285 |
iLog->Log(_L("MdapcPlayComplete, return code =%d!!!"),aError);
|
|
286 |
//ProcessEvent(EInitializeComplete, aError);
|
|
287 |
}
|
|
288 |
|
|
289 |
|
|
290 |
//MVideoPlayerUtilityObserver
|
|
291 |
void CAudioRoutingTestClass::MvpuoOpenComplete(TInt aError)
|
|
292 |
{
|
|
293 |
iLog->Log(_L("MvpuoOpenComplete, return code =%d!!!"),aError);
|
|
294 |
//ProcessEvent(EInitializeComplete, aError);
|
|
295 |
if (aError != KErrNone)
|
|
296 |
{
|
|
297 |
iLog->Log(_L("Cannot open "));
|
|
298 |
_LIT(K3gpTestFile,"e:\\testing\\data\\videoTest.3gp");
|
|
299 |
iLog->Log(K3gpTestFile);
|
|
300 |
iLog->Log(_L("\nPress any key to exit ..."));
|
|
301 |
}
|
|
302 |
else
|
|
303 |
{
|
|
304 |
iLog->Log(_L("Ready!"));
|
|
305 |
}
|
|
306 |
if (isInput != EFalse)
|
|
307 |
{}
|
|
308 |
CActiveScheduler::Stop();
|
|
309 |
}
|
|
310 |
|
|
311 |
void CAudioRoutingTestClass::MvpuoPrepareComplete(TInt aError)
|
|
312 |
{
|
|
313 |
iLog->Log(_L("MvpuoPrepareComplete, return code =%d!!!"),aError);
|
|
314 |
//ProcessEvent(EInitializeComplete, aError);
|
|
315 |
}
|
|
316 |
|
|
317 |
void CAudioRoutingTestClass::MvpuoFrameReady(CFbsBitmap& /*aFrame*/,TInt aError)
|
|
318 |
{
|
|
319 |
iLog->Log(_L("MvpuoFrameReady, return code =%d!!!"),aError);
|
|
320 |
//ProcessEvent(EInitializeComplete, aError);
|
|
321 |
}
|
|
322 |
|
|
323 |
void CAudioRoutingTestClass::MvpuoPlayComplete(TInt aError)
|
|
324 |
{
|
|
325 |
iLog->Log(_L("MvpuoPlayComplete, return code =%d!!!"),aError);
|
|
326 |
//ProcessEvent(EInitializeComplete, aError);
|
|
327 |
}
|
|
328 |
|
|
329 |
void CAudioRoutingTestClass::MvpuoEvent(const TMMFEvent& aEvent)
|
|
330 |
{
|
5
|
331 |
iLog->Log(_L("MvpuoEvent, return code =%x!!!"),aEvent.iEventType);
|
0
|
332 |
}
|
|
333 |
|
|
334 |
void CAudioRoutingTestClass::MvruoOpenComplete(TInt aError)
|
|
335 |
{
|
|
336 |
iLog->Log(_L("MvruoOpenComplete, return code =%d!!!"),aError);
|
|
337 |
//ProcessEvent(EInitializeComplete, aError);
|
|
338 |
}
|
|
339 |
|
|
340 |
void CAudioRoutingTestClass::MvruoPrepareComplete(TInt aError)
|
|
341 |
{
|
|
342 |
iLog->Log(_L("MvruoPrepareComplete, return code =%d!!!"),aError);
|
|
343 |
//ProcessEvent(EInitializeComplete, aError);
|
|
344 |
}
|
|
345 |
|
|
346 |
void CAudioRoutingTestClass::MvruoRecordComplete(TInt aError)
|
|
347 |
{
|
|
348 |
iLog->Log(_L("MvruoRecordComplete, return code =%d!!!"),aError);
|
|
349 |
//ProcessEvent(EInitializeComplete, aError);
|
|
350 |
}
|
|
351 |
|
|
352 |
void CAudioRoutingTestClass::MvruoEvent(const TMMFEvent& /*aEvent*/)
|
|
353 |
{
|
|
354 |
iLog->Log(_L("MvruoEvent, return code =!!!")/*,aEvent*/);
|
|
355 |
}
|
|
356 |
|
|
357 |
// End of File
|