sl@0
|
1 |
// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
|
sl@0
|
17 |
|
sl@0
|
18 |
#include "logicalaudiogaincontrol.h"
|
sl@0
|
19 |
#include "logicalaudiocodec.h"
|
sl@0
|
20 |
#include "logicalbuffersource.h"
|
sl@0
|
21 |
#include "logicalbuffersink.h"
|
sl@0
|
22 |
#include "logicalaudiodevicesink.h"
|
sl@0
|
23 |
#include "logicalaudiodevicesource.h"
|
sl@0
|
24 |
#include "logicalaudiostream.h"
|
sl@0
|
25 |
|
sl@0
|
26 |
#include <mmf/server/sounddevice.h>
|
sl@0
|
27 |
#include <a3f/audioprocessingunittypeuids.h>
|
sl@0
|
28 |
#include <a3f/maudiocodec.h>
|
sl@0
|
29 |
#include <a3f/maudiocontext.h>
|
sl@0
|
30 |
#include "audiocontext.h"
|
sl@0
|
31 |
|
sl@0
|
32 |
// TODO: Remove when the MMRC Extension mechanism is ready
|
sl@0
|
33 |
#include "mstreampositioncontrol.h"
|
sl@0
|
34 |
#include "mstreampositioncontrol.h"
|
sl@0
|
35 |
#include "audioprocessingunit.h"
|
sl@0
|
36 |
|
sl@0
|
37 |
#include <ecom/implementationproxy.h> // For making it ECom plugin
|
sl@0
|
38 |
|
sl@0
|
39 |
|
sl@0
|
40 |
// Exported proxy for instantiation method resolution
|
sl@0
|
41 |
// Define the interface UIDs
|
sl@0
|
42 |
const TImplementationProxy ImplementationTable[] =
|
sl@0
|
43 |
{
|
sl@0
|
44 |
IMPLEMENTATION_PROXY_ENTRY(KAudioStreamUid, CLogicalAudioStream::NewL)
|
sl@0
|
45 |
};
|
sl@0
|
46 |
|
sl@0
|
47 |
EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
|
sl@0
|
48 |
{
|
sl@0
|
49 |
aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
|
sl@0
|
50 |
return ImplementationTable;
|
sl@0
|
51 |
}
|
sl@0
|
52 |
|
sl@0
|
53 |
// ---------------------------------------------------------------------------
|
sl@0
|
54 |
// Constructor
|
sl@0
|
55 |
// ---------------------------------------------------------------------------
|
sl@0
|
56 |
//
|
sl@0
|
57 |
CLogicalAudioStream::CLogicalAudioStream()
|
sl@0
|
58 |
: CAudioStreamManager(),
|
sl@0
|
59 |
iCurrentState(EUninitialized),
|
sl@0
|
60 |
iMessageType(ERegisterStreamObserver)
|
sl@0
|
61 |
{
|
sl@0
|
62 |
TRACE_CREATE();
|
sl@0
|
63 |
DP_CONTEXT(CLogicalAudioStream::CLogicalAudioStream *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
64 |
DP_IN();
|
sl@0
|
65 |
DP_OUT();
|
sl@0
|
66 |
}
|
sl@0
|
67 |
|
sl@0
|
68 |
// ---------------------------------------------------------------------------
|
sl@0
|
69 |
// CLogicalAudioStream::NewL
|
sl@0
|
70 |
// ---------------------------------------------------------------------------
|
sl@0
|
71 |
CLogicalAudioStream* CLogicalAudioStream::NewL(TUid /*aTypeId*/)
|
sl@0
|
72 |
{
|
sl@0
|
73 |
DP_STATIC_CONTEXT(CLogicalAudioStream::NewL *CD0*, CtxDevSound, DPLOCAL);
|
sl@0
|
74 |
DP_IN();
|
sl@0
|
75 |
CLogicalAudioStream* self = new(ELeave)CLogicalAudioStream();
|
sl@0
|
76 |
CleanupStack::PushL(self);
|
sl@0
|
77 |
self->ConstructL();
|
sl@0
|
78 |
CleanupStack::Pop(self);
|
sl@0
|
79 |
DP0_RET(self, "0x%x");
|
sl@0
|
80 |
}
|
sl@0
|
81 |
|
sl@0
|
82 |
// ---------------------------------------------------------------------------
|
sl@0
|
83 |
// Second phase constructor
|
sl@0
|
84 |
// ---------------------------------------------------------------------------
|
sl@0
|
85 |
void CLogicalAudioStream::ConstructL()
|
sl@0
|
86 |
{
|
sl@0
|
87 |
DP_CONTEXT(CLogicalAudioStream::ConstructL *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
88 |
DP_IN();
|
sl@0
|
89 |
DP_OUT();
|
sl@0
|
90 |
}
|
sl@0
|
91 |
|
sl@0
|
92 |
// ---------------------------------------------------------------------------
|
sl@0
|
93 |
// Destructor
|
sl@0
|
94 |
// ---------------------------------------------------------------------------
|
sl@0
|
95 |
//
|
sl@0
|
96 |
CLogicalAudioStream::~CLogicalAudioStream()
|
sl@0
|
97 |
{
|
sl@0
|
98 |
DP_CONTEXT(CLogicalAudioStream::~CLogicalAudioStream *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
99 |
DP_IN();
|
sl@0
|
100 |
iAudioProcessingUnits.Close();
|
sl@0
|
101 |
iCISupportObservers.Close();
|
sl@0
|
102 |
DP_OUT();
|
sl@0
|
103 |
}
|
sl@0
|
104 |
|
sl@0
|
105 |
|
sl@0
|
106 |
// From MAudioStream
|
sl@0
|
107 |
// ---------------------------------------------------------------------------
|
sl@0
|
108 |
// CLogicalAudioStream::Uninitialize
|
sl@0
|
109 |
// ---------------------------------------------------------------------------
|
sl@0
|
110 |
TInt CLogicalAudioStream::Uninitialize()
|
sl@0
|
111 |
{
|
sl@0
|
112 |
DP_CONTEXT(CLogicalAudioStream::Uninitialize *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
113 |
DP_IN();
|
sl@0
|
114 |
if (iCurrentState != EInitialized)
|
sl@0
|
115 |
{
|
sl@0
|
116 |
DP0_RET(KErrNotReady, "%d");
|
sl@0
|
117 |
}
|
sl@0
|
118 |
|
sl@0
|
119 |
iCurrentState = EUninitialized;
|
sl@0
|
120 |
DP0_RET(KErrNone, "%d");
|
sl@0
|
121 |
}
|
sl@0
|
122 |
|
sl@0
|
123 |
// ---------------------------------------------------------------------------
|
sl@0
|
124 |
// CLogicalAudioStream::Initialize
|
sl@0
|
125 |
// ---------------------------------------------------------------------------
|
sl@0
|
126 |
TInt CLogicalAudioStream::Initialize()
|
sl@0
|
127 |
{
|
sl@0
|
128 |
DP_CONTEXT(CLogicalAudioStream::Initialize *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
129 |
DP_IN();
|
sl@0
|
130 |
if (iCurrentState != EUninitialized)
|
sl@0
|
131 |
{
|
sl@0
|
132 |
DP0_RET(KErrNotReady, "%d");
|
sl@0
|
133 |
}
|
sl@0
|
134 |
|
sl@0
|
135 |
//calling commit??
|
sl@0
|
136 |
iCurrentState = EInitialized;
|
sl@0
|
137 |
DP0_RET(KErrNone, "%d");
|
sl@0
|
138 |
}
|
sl@0
|
139 |
|
sl@0
|
140 |
// ---------------------------------------------------------------------------
|
sl@0
|
141 |
// CLogicalAudioStream::Load
|
sl@0
|
142 |
// ---------------------------------------------------------------------------
|
sl@0
|
143 |
TInt CLogicalAudioStream::Load()
|
sl@0
|
144 |
{
|
sl@0
|
145 |
DP_CONTEXT(CLogicalAudioStream::Load *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
146 |
DP_IN();
|
sl@0
|
147 |
if (iCurrentState != EInitialized)
|
sl@0
|
148 |
{
|
sl@0
|
149 |
DP0_RET(KErrNotReady, "%d");
|
sl@0
|
150 |
}
|
sl@0
|
151 |
|
sl@0
|
152 |
iCurrentState = EIdle;
|
sl@0
|
153 |
ResetStreamTime();
|
sl@0
|
154 |
DP0_RET(KErrNone, "%d");
|
sl@0
|
155 |
}
|
sl@0
|
156 |
|
sl@0
|
157 |
// ---------------------------------------------------------------------------
|
sl@0
|
158 |
// CLogicalAudioStream::Stop
|
sl@0
|
159 |
// ---------------------------------------------------------------------------
|
sl@0
|
160 |
TInt CLogicalAudioStream::Stop()
|
sl@0
|
161 |
{
|
sl@0
|
162 |
DP_CONTEXT(CLogicalAudioStream::Stop *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
163 |
DP_IN();
|
sl@0
|
164 |
if (iCurrentState != EActive && iCurrentState != EPrimed)
|
sl@0
|
165 |
{
|
sl@0
|
166 |
DP0_RET(KErrNotReady, "%d");
|
sl@0
|
167 |
}
|
sl@0
|
168 |
iCurrentState = EIdle;
|
sl@0
|
169 |
DP0_RET(KErrNone, "%d");
|
sl@0
|
170 |
}
|
sl@0
|
171 |
|
sl@0
|
172 |
// ---------------------------------------------------------------------------
|
sl@0
|
173 |
// CLogicalAudioStream::Unload
|
sl@0
|
174 |
// ---------------------------------------------------------------------------
|
sl@0
|
175 |
TInt CLogicalAudioStream::Unload()
|
sl@0
|
176 |
{
|
sl@0
|
177 |
DP_CONTEXT(CLogicalAudioStream::Unload *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
178 |
DP_IN();
|
sl@0
|
179 |
if (iCurrentState != EIdle)
|
sl@0
|
180 |
{
|
sl@0
|
181 |
DP0_RET(KErrNotReady, "%d");
|
sl@0
|
182 |
}
|
sl@0
|
183 |
|
sl@0
|
184 |
iCurrentState = EInitialized;
|
sl@0
|
185 |
DP0_RET(KErrNone, "%d");
|
sl@0
|
186 |
}
|
sl@0
|
187 |
|
sl@0
|
188 |
// ---------------------------------------------------------------------------
|
sl@0
|
189 |
// CLogicalAudioStream::Prime
|
sl@0
|
190 |
// ---------------------------------------------------------------------------
|
sl@0
|
191 |
TInt CLogicalAudioStream::Prime()
|
sl@0
|
192 |
{
|
sl@0
|
193 |
DP_CONTEXT(CLogicalAudioStream::Prime *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
194 |
DP_IN();
|
sl@0
|
195 |
if (iCurrentState != EActive && iCurrentState != EIdle)
|
sl@0
|
196 |
{
|
sl@0
|
197 |
DP0_RET(KErrNotReady, "%d");
|
sl@0
|
198 |
}
|
sl@0
|
199 |
|
sl@0
|
200 |
iCurrentState = EPrimed;
|
sl@0
|
201 |
DP0_RET(KErrNone, "%d");
|
sl@0
|
202 |
}
|
sl@0
|
203 |
|
sl@0
|
204 |
// ---------------------------------------------------------------------------
|
sl@0
|
205 |
// CLogicalAudioStream::Flush
|
sl@0
|
206 |
// ---------------------------------------------------------------------------
|
sl@0
|
207 |
TInt CLogicalAudioStream::Flush()
|
sl@0
|
208 |
{
|
sl@0
|
209 |
DP_CONTEXT(CLogicalAudioStream::Flush *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
210 |
DP_IN();
|
sl@0
|
211 |
if (iCurrentState != EIdle && iCurrentState != EPrimed)
|
sl@0
|
212 |
{
|
sl@0
|
213 |
DP0_RET(KErrNotReady, "%d");
|
sl@0
|
214 |
}
|
sl@0
|
215 |
|
sl@0
|
216 |
if(!iStreamBufferControl)
|
sl@0
|
217 |
{
|
sl@0
|
218 |
DP0_RET(KErrNotReady, "%d");
|
sl@0
|
219 |
}
|
sl@0
|
220 |
//Empty any buffers that have been filled
|
sl@0
|
221 |
iStreamBufferControl->FlushBuffers();
|
sl@0
|
222 |
|
sl@0
|
223 |
DP0_RET(KErrNone, "%d");
|
sl@0
|
224 |
}
|
sl@0
|
225 |
|
sl@0
|
226 |
// ---------------------------------------------------------------------------
|
sl@0
|
227 |
// CLogicalAudioStream::Activate
|
sl@0
|
228 |
// ---------------------------------------------------------------------------
|
sl@0
|
229 |
TInt CLogicalAudioStream::Activate()
|
sl@0
|
230 |
{
|
sl@0
|
231 |
DP_CONTEXT(CLogicalAudioStream::Activate *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
232 |
DP_IN();
|
sl@0
|
233 |
if (iCurrentState != EIdle && iCurrentState != EPrimed)
|
sl@0
|
234 |
{
|
sl@0
|
235 |
DP0_RET(KErrNotReady, "%d");
|
sl@0
|
236 |
}
|
sl@0
|
237 |
|
sl@0
|
238 |
//The start-up procedures include requesting permission for audio processing
|
sl@0
|
239 |
//from audio policy. If permission to start is denied by audio policy, a state
|
sl@0
|
240 |
//change callback to the current state will occur.
|
sl@0
|
241 |
iCurrentState = EActive;
|
sl@0
|
242 |
DP0_RET(KErrNone, "%d");
|
sl@0
|
243 |
}
|
sl@0
|
244 |
|
sl@0
|
245 |
// ---------------------------------------------------------------------------
|
sl@0
|
246 |
// CLogicalAudioStream::AddSource
|
sl@0
|
247 |
// ---------------------------------------------------------------------------
|
sl@0
|
248 |
TInt CLogicalAudioStream::AddSource(MAudioProcessingUnit* aSource)
|
sl@0
|
249 |
{
|
sl@0
|
250 |
DP_CONTEXT(CLogicalAudioStream::AddSource *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
251 |
DP_IN();
|
sl@0
|
252 |
TInt err;
|
sl@0
|
253 |
if (aSource->IsTypeOf(KUidMmfBufferSource) || aSource->IsTypeOf(KUidAudioDeviceSource))
|
sl@0
|
254 |
{
|
sl@0
|
255 |
if (iCurrentState == EUninitialized)
|
sl@0
|
256 |
{
|
sl@0
|
257 |
err = DoAddProcessingUnit(aSource);
|
sl@0
|
258 |
}
|
sl@0
|
259 |
else
|
sl@0
|
260 |
{
|
sl@0
|
261 |
err = KErrNotReady;
|
sl@0
|
262 |
}
|
sl@0
|
263 |
}
|
sl@0
|
264 |
else
|
sl@0
|
265 |
{
|
sl@0
|
266 |
err = KErrNotSupported;
|
sl@0
|
267 |
}
|
sl@0
|
268 |
DP0_RET(err, "%d");
|
sl@0
|
269 |
}
|
sl@0
|
270 |
|
sl@0
|
271 |
|
sl@0
|
272 |
// ---------------------------------------------------------------------------
|
sl@0
|
273 |
// CLogicalAudioStream::AddSink
|
sl@0
|
274 |
// ---------------------------------------------------------------------------
|
sl@0
|
275 |
TInt CLogicalAudioStream::AddSink(MAudioProcessingUnit* aSink)
|
sl@0
|
276 |
{
|
sl@0
|
277 |
DP_CONTEXT(CLogicalAudioStream::AddSink *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
278 |
DP_IN();
|
sl@0
|
279 |
TInt err;
|
sl@0
|
280 |
if (aSink->IsTypeOf(KUidMmfBufferSink) || aSink->IsTypeOf(KUidAudioDeviceSink) )
|
sl@0
|
281 |
{
|
sl@0
|
282 |
if (iCurrentState == EUninitialized)
|
sl@0
|
283 |
{
|
sl@0
|
284 |
err = DoAddProcessingUnit(aSink);
|
sl@0
|
285 |
}
|
sl@0
|
286 |
else
|
sl@0
|
287 |
{
|
sl@0
|
288 |
err = KErrNotReady;
|
sl@0
|
289 |
}
|
sl@0
|
290 |
}
|
sl@0
|
291 |
else
|
sl@0
|
292 |
{
|
sl@0
|
293 |
err = KErrNotSupported;
|
sl@0
|
294 |
}
|
sl@0
|
295 |
DP0_RET(err, "%d");
|
sl@0
|
296 |
}
|
sl@0
|
297 |
|
sl@0
|
298 |
// ---------------------------------------------------------------------------
|
sl@0
|
299 |
// CLogicalAudioStream::AddCodec
|
sl@0
|
300 |
// ---------------------------------------------------------------------------
|
sl@0
|
301 |
TInt CLogicalAudioStream::AddAudioCodec(MAudioProcessingUnit* aCodec)
|
sl@0
|
302 |
{
|
sl@0
|
303 |
DP_CONTEXT(CLogicalAudioStream::AddAudioCodec *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
304 |
DP_IN();
|
sl@0
|
305 |
TInt err;
|
sl@0
|
306 |
if (iCodec != NULL)
|
sl@0
|
307 |
{
|
sl@0
|
308 |
DP0_RET(KErrInUse, "%d");
|
sl@0
|
309 |
}
|
sl@0
|
310 |
|
sl@0
|
311 |
if (aCodec->IsTypeOf(KUidAudioCodec))
|
sl@0
|
312 |
{
|
sl@0
|
313 |
if (iCurrentState == EUninitialized)
|
sl@0
|
314 |
{
|
sl@0
|
315 |
err = DoAddProcessingUnit(aCodec);
|
sl@0
|
316 |
}
|
sl@0
|
317 |
else
|
sl@0
|
318 |
{
|
sl@0
|
319 |
err = KErrNotReady;
|
sl@0
|
320 |
}
|
sl@0
|
321 |
}
|
sl@0
|
322 |
else
|
sl@0
|
323 |
{
|
sl@0
|
324 |
err = KErrNotSupported;
|
sl@0
|
325 |
}
|
sl@0
|
326 |
DP0_RET(err, "%d");
|
sl@0
|
327 |
}
|
sl@0
|
328 |
|
sl@0
|
329 |
// ---------------------------------------------------------------------------
|
sl@0
|
330 |
// CLogicalAudioStream::AddGainControl
|
sl@0
|
331 |
// ---------------------------------------------------------------------------
|
sl@0
|
332 |
TInt CLogicalAudioStream::AddGainControl(MAudioProcessingUnit* aGainControl)
|
sl@0
|
333 |
{
|
sl@0
|
334 |
DP_CONTEXT(CLogicalAudioStream::AddGainControl *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
335 |
DP_IN();
|
sl@0
|
336 |
TInt err(KErrNone);
|
sl@0
|
337 |
|
sl@0
|
338 |
if (iGain != NULL)
|
sl@0
|
339 |
{
|
sl@0
|
340 |
DP0_RET(KErrInUse, "%d");
|
sl@0
|
341 |
}
|
sl@0
|
342 |
|
sl@0
|
343 |
if (aGainControl->IsTypeOf(KUidAudioGainControl))
|
sl@0
|
344 |
{
|
sl@0
|
345 |
if (iCurrentState == EUninitialized)
|
sl@0
|
346 |
{
|
sl@0
|
347 |
err = DoAddProcessingUnit(aGainControl);
|
sl@0
|
348 |
}
|
sl@0
|
349 |
else
|
sl@0
|
350 |
{
|
sl@0
|
351 |
err = KErrNotReady;
|
sl@0
|
352 |
}
|
sl@0
|
353 |
}
|
sl@0
|
354 |
else
|
sl@0
|
355 |
{
|
sl@0
|
356 |
err = KErrNotSupported;
|
sl@0
|
357 |
}
|
sl@0
|
358 |
DP0_RET(err, "%d");
|
sl@0
|
359 |
}
|
sl@0
|
360 |
|
sl@0
|
361 |
// ---------------------------------------------------------------------------
|
sl@0
|
362 |
// CLogicalAudioStream::RemoveProcessigUnit
|
sl@0
|
363 |
// ---------------------------------------------------------------------------
|
sl@0
|
364 |
TInt CLogicalAudioStream::RemoveProcessingUnit(MAudioProcessingUnit* aProcessingUnit)
|
sl@0
|
365 |
{
|
sl@0
|
366 |
DP_CONTEXT(CLogicalAudioStream::RemoveProcessingUnit *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
367 |
DP_IN();
|
sl@0
|
368 |
|
sl@0
|
369 |
if(iCurrentState != EUninitialized)
|
sl@0
|
370 |
{
|
sl@0
|
371 |
DP0_RET(KErrNotReady, "%d");
|
sl@0
|
372 |
}
|
sl@0
|
373 |
|
sl@0
|
374 |
TInt err(KErrNotFound);
|
sl@0
|
375 |
if (aProcessingUnit != NULL)
|
sl@0
|
376 |
{
|
sl@0
|
377 |
TAudioComponentId param = aProcessingUnit->InstanceId();
|
sl@0
|
378 |
TUint count= iAudioProcessingUnits.Count();
|
sl@0
|
379 |
|
sl@0
|
380 |
if (aProcessingUnit->IsTypeOf(KUidAudioCodec))
|
sl@0
|
381 |
{
|
sl@0
|
382 |
iCodec = NULL;
|
sl@0
|
383 |
}
|
sl@0
|
384 |
else if (aProcessingUnit->IsTypeOf(KUidAudioGainControl))
|
sl@0
|
385 |
{
|
sl@0
|
386 |
iGain = NULL;
|
sl@0
|
387 |
}
|
sl@0
|
388 |
|
sl@0
|
389 |
for ( TUint i(0); i < count; i++ )
|
sl@0
|
390 |
{
|
sl@0
|
391 |
// find and remove component
|
sl@0
|
392 |
if( iAudioProcessingUnits[i]->InstanceId() == param)
|
sl@0
|
393 |
{
|
sl@0
|
394 |
iAudioProcessingUnits.Remove(i);
|
sl@0
|
395 |
break;
|
sl@0
|
396 |
}
|
sl@0
|
397 |
}
|
sl@0
|
398 |
SetMessageType(EComponentDestruction);
|
sl@0
|
399 |
err = KErrNone;
|
sl@0
|
400 |
}
|
sl@0
|
401 |
DP0_RET(err, "%d");
|
sl@0
|
402 |
}
|
sl@0
|
403 |
|
sl@0
|
404 |
// ---------------------------------------------------------------------------
|
sl@0
|
405 |
// CLogicalAudioStream::ResetStreamTime
|
sl@0
|
406 |
// ---------------------------------------------------------------------------
|
sl@0
|
407 |
TInt CLogicalAudioStream::ResetStreamTime()
|
sl@0
|
408 |
{
|
sl@0
|
409 |
DP_CONTEXT(CLogicalAudioStream::ResetStreamTime *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
410 |
DP_IN();
|
sl@0
|
411 |
TInt err(KErrNone);
|
sl@0
|
412 |
if (iCurrentState != EIdle)
|
sl@0
|
413 |
{
|
sl@0
|
414 |
DP0_RET(KErrNotReady, "%d");
|
sl@0
|
415 |
}
|
sl@0
|
416 |
if(iPositionControl)
|
sl@0
|
417 |
{
|
sl@0
|
418 |
iPositionControl->ResetControlPosition();
|
sl@0
|
419 |
}
|
sl@0
|
420 |
iTimeProcessed = 0;
|
sl@0
|
421 |
DP0_RET(err, "%d");
|
sl@0
|
422 |
}
|
sl@0
|
423 |
|
sl@0
|
424 |
|
sl@0
|
425 |
// ---------------------------------------------------------------------------
|
sl@0
|
426 |
// CLogicalAudioStream::GetStreamTime
|
sl@0
|
427 |
// ---------------------------------------------------------------------------
|
sl@0
|
428 |
TInt CLogicalAudioStream::GetStreamTime(TTimeIntervalMicroSeconds& aStreamTime)
|
sl@0
|
429 |
{
|
sl@0
|
430 |
DP_CONTEXT(CLogicalAudioStream::GetStreamTime *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
431 |
DP_IN();
|
sl@0
|
432 |
TInt err(KErrNone);
|
sl@0
|
433 |
|
sl@0
|
434 |
if(iPositionControl)
|
sl@0
|
435 |
{
|
sl@0
|
436 |
err = iPositionControl->GetControlPosition(aStreamTime);
|
sl@0
|
437 |
if(err == KErrNone)
|
sl@0
|
438 |
{
|
sl@0
|
439 |
iTimeProcessed = aStreamTime;
|
sl@0
|
440 |
}
|
sl@0
|
441 |
}
|
sl@0
|
442 |
else
|
sl@0
|
443 |
{
|
sl@0
|
444 |
aStreamTime = iTimeProcessed;
|
sl@0
|
445 |
}
|
sl@0
|
446 |
DP0_RET(err, "%d");
|
sl@0
|
447 |
}
|
sl@0
|
448 |
|
sl@0
|
449 |
// ---------------------------------------------------------------------------
|
sl@0
|
450 |
// CLogicalAudioStream::Interface
|
sl@0
|
451 |
// ---------------------------------------------------------------------------
|
sl@0
|
452 |
TAny* CLogicalAudioStream::Interface(TUid aType)
|
sl@0
|
453 |
{
|
sl@0
|
454 |
DP_CONTEXT(CLogicalAudioStream::Interface *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
455 |
DP_IN();
|
sl@0
|
456 |
TAny* interface(NULL);
|
sl@0
|
457 |
if( aType == KUidAudioStream)
|
sl@0
|
458 |
{
|
sl@0
|
459 |
interface = static_cast<MAudioStream*>(this);
|
sl@0
|
460 |
}
|
sl@0
|
461 |
else if( aType == KUidExtensionInferface)
|
sl@0
|
462 |
{
|
sl@0
|
463 |
interface = static_cast<MCustomInterfaceSupport*>(this);
|
sl@0
|
464 |
}
|
sl@0
|
465 |
else if (aType == KUidAudioStreamAdaptationObserver)
|
sl@0
|
466 |
{
|
sl@0
|
467 |
interface = static_cast<MAudioStreamAdaptationObserver*>(this);
|
sl@0
|
468 |
DP0_RET(interface, "0x%x");
|
sl@0
|
469 |
}
|
sl@0
|
470 |
else if (aType == KUidAudioCodecObserver)
|
sl@0
|
471 |
{
|
sl@0
|
472 |
interface = static_cast<MAudioCodecObserver*>(this);
|
sl@0
|
473 |
DP0_RET(interface, "0x%x");
|
sl@0
|
474 |
}
|
sl@0
|
475 |
|
sl@0
|
476 |
DP_OUT();
|
sl@0
|
477 |
return interface;
|
sl@0
|
478 |
}
|
sl@0
|
479 |
|
sl@0
|
480 |
// ---------------------------------------------------------------------------
|
sl@0
|
481 |
// From MCustomInterfaceSupport
|
sl@0
|
482 |
// CAudioStream::RequestCustomInterface
|
sl@0
|
483 |
// ---------------------------------------------------------------------------
|
sl@0
|
484 |
TInt CLogicalAudioStream::RequestCustomInterface(TUid aUid, TAny*& aPtr)
|
sl@0
|
485 |
{
|
sl@0
|
486 |
DP_CONTEXT(CLogicalAudioStream::RequestCustomInterface *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
487 |
DP_IN();
|
sl@0
|
488 |
TInt err = KErrNone;
|
sl@0
|
489 |
if (aUid == KA3FBackdoorAccessIfUid)
|
sl@0
|
490 |
{
|
sl@0
|
491 |
MA3FBackdoorAccessIf* self = this;
|
sl@0
|
492 |
aPtr = self;
|
sl@0
|
493 |
}
|
sl@0
|
494 |
else if(iInterfaceProvider)
|
sl@0
|
495 |
{
|
sl@0
|
496 |
err = iInterfaceProvider->RequestCustomInterface(aUid, aPtr);
|
sl@0
|
497 |
if (err != KErrNone)
|
sl@0
|
498 |
{
|
sl@0
|
499 |
aPtr = NULL;
|
sl@0
|
500 |
}
|
sl@0
|
501 |
}
|
sl@0
|
502 |
else
|
sl@0
|
503 |
{
|
sl@0
|
504 |
err = KErrNotReady;
|
sl@0
|
505 |
}
|
sl@0
|
506 |
DP0_RET(err, "%d");
|
sl@0
|
507 |
}
|
sl@0
|
508 |
|
sl@0
|
509 |
// ---------------------------------------------------------------------------
|
sl@0
|
510 |
// From MCustomInterfaceSupport
|
sl@0
|
511 |
// CAudioStream::RegisterObserver
|
sl@0
|
512 |
// ---------------------------------------------------------------------------
|
sl@0
|
513 |
TInt CLogicalAudioStream::RegisterObserver(MCustomInterfaceSupportObserver& aObserver)
|
sl@0
|
514 |
{
|
sl@0
|
515 |
DP_CONTEXT(CLogicalAudioStream::RegisterObserver *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
516 |
DP_IN();
|
sl@0
|
517 |
TInt err = KErrNone;
|
sl@0
|
518 |
err = iCISupportObservers.Find(&aObserver);
|
sl@0
|
519 |
if( err != KErrNotFound )
|
sl@0
|
520 |
{
|
sl@0
|
521 |
err = KErrAlreadyExists;
|
sl@0
|
522 |
}
|
sl@0
|
523 |
else
|
sl@0
|
524 |
{
|
sl@0
|
525 |
err = iCISupportObservers.Append(&aObserver);
|
sl@0
|
526 |
}
|
sl@0
|
527 |
DP0_RET(err, "%d");
|
sl@0
|
528 |
}
|
sl@0
|
529 |
|
sl@0
|
530 |
// ---------------------------------------------------------------------------
|
sl@0
|
531 |
// From MCustomInterfaceSupport
|
sl@0
|
532 |
// CAudioStream::UnRegisterObserver
|
sl@0
|
533 |
// ---------------------------------------------------------------------------
|
sl@0
|
534 |
void CLogicalAudioStream::UnRegisterObserver(MCustomInterfaceSupportObserver& aObserver)
|
sl@0
|
535 |
{
|
sl@0
|
536 |
DP_CONTEXT(CLogicalAudioStream::UnRegisterObserver *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
537 |
DP_IN();
|
sl@0
|
538 |
TInt idxOrErr = iCISupportObservers.Find(&aObserver);
|
sl@0
|
539 |
if( idxOrErr != KErrNotFound )
|
sl@0
|
540 |
{
|
sl@0
|
541 |
iCISupportObservers.Remove(idxOrErr);
|
sl@0
|
542 |
}
|
sl@0
|
543 |
DP_OUT();
|
sl@0
|
544 |
}
|
sl@0
|
545 |
|
sl@0
|
546 |
// ---------------------------------------------------------------------------
|
sl@0
|
547 |
// From MCustomInterfaceSupport
|
sl@0
|
548 |
// CAudioStream::CustomInterfaceRemoval
|
sl@0
|
549 |
// ---------------------------------------------------------------------------
|
sl@0
|
550 |
void CLogicalAudioStream::CustomInterfaceRemoval(TUid aInterfaceUid, TAny* aPtr)
|
sl@0
|
551 |
{
|
sl@0
|
552 |
DP_CONTEXT(CLogicalAudioStream::CustomInterfaceRemoval *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
553 |
DP_IN();
|
sl@0
|
554 |
TUint count = iCISupportObservers.Count();
|
sl@0
|
555 |
for ( TUint idx(0); idx < count; idx++ )
|
sl@0
|
556 |
{
|
sl@0
|
557 |
iCISupportObservers[idx]->CustomInterfaceRemoval(aInterfaceUid, aPtr);
|
sl@0
|
558 |
}
|
sl@0
|
559 |
DP_OUT();
|
sl@0
|
560 |
}
|
sl@0
|
561 |
|
sl@0
|
562 |
// ---------------------------------------------------------------------------
|
sl@0
|
563 |
// From MAudioStreamAdaptationObserver
|
sl@0
|
564 |
// CAudioStream::PhysicalAdaptationEvent
|
sl@0
|
565 |
// ---------------------------------------------------------------------------
|
sl@0
|
566 |
void CLogicalAudioStream::PhysicalAdaptationEvent(TPhysicalEvent /*aEvent*/, TInt /*aError*/)
|
sl@0
|
567 |
{
|
sl@0
|
568 |
DP_CONTEXT(CLogicalAudioStream::PhysicalAdaptationEvent *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
569 |
DP_IN();
|
sl@0
|
570 |
DP_OUT();
|
sl@0
|
571 |
}
|
sl@0
|
572 |
|
sl@0
|
573 |
// ---------------------------------------------------------------------------
|
sl@0
|
574 |
// CAudioStream::StateEvent
|
sl@0
|
575 |
// ---------------------------------------------------------------------------
|
sl@0
|
576 |
void CLogicalAudioStream::StateEvent(TInt aReason, TAudioState aNewState)
|
sl@0
|
577 |
{
|
sl@0
|
578 |
DP_CONTEXT(CLogicalAudioStream::StateEvent *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
579 |
DP_IN();
|
sl@0
|
580 |
#ifdef _DEBUG
|
sl@0
|
581 |
RDebug::Print(_L("CLogicalAudioStream::StateEvent Error %d Stay %d"), aReason, aNewState);
|
sl@0
|
582 |
#endif
|
sl@0
|
583 |
TUint count = iAudioStreamObserver.Count();
|
sl@0
|
584 |
for ( TUint idx(0); idx < count; idx++ )
|
sl@0
|
585 |
{
|
sl@0
|
586 |
iAudioStreamObserver[idx]->StateEvent(*this, aReason, aNewState);
|
sl@0
|
587 |
}
|
sl@0
|
588 |
iCurrentState = aNewState;
|
sl@0
|
589 |
DP_OUT();
|
sl@0
|
590 |
}
|
sl@0
|
591 |
|
sl@0
|
592 |
// ---------------------------------------------------------------------------
|
sl@0
|
593 |
// CLogicalAudioStream::AddProcessingUnitComplete
|
sl@0
|
594 |
// ---------------------------------------------------------------------------
|
sl@0
|
595 |
void CLogicalAudioStream::AddProcessingUnitComplete(TUid aType, TInt aError)
|
sl@0
|
596 |
{
|
sl@0
|
597 |
DP_CONTEXT(CLogicalAudioStream::AddProcessingUnitComplete *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
598 |
DP_IN();
|
sl@0
|
599 |
MAudioProcessingUnit* instance = NULL;
|
sl@0
|
600 |
MapUidToProcessingUnit(aType, instance);
|
sl@0
|
601 |
TUint count = iAudioStreamObserver.Count();
|
sl@0
|
602 |
for ( TUint idx(0); idx < count; idx++ )
|
sl@0
|
603 |
{
|
sl@0
|
604 |
iAudioStreamObserver[idx]->AddProcessingUnitComplete(*this, instance, aError);
|
sl@0
|
605 |
}
|
sl@0
|
606 |
DP_OUT();
|
sl@0
|
607 |
}
|
sl@0
|
608 |
|
sl@0
|
609 |
// ---------------------------------------------------------------------------
|
sl@0
|
610 |
// CLogicalAudioStream::RemoveProcessingUnitComplete
|
sl@0
|
611 |
// ---------------------------------------------------------------------------
|
sl@0
|
612 |
void CLogicalAudioStream::RemoveProcessingUnitComplete(TUid aType, TInt aError)
|
sl@0
|
613 |
{
|
sl@0
|
614 |
DP_CONTEXT(CLogicalAudioStream::RemoveProcessingUnitComplete *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
615 |
DP_IN();
|
sl@0
|
616 |
MAudioProcessingUnit* instance = NULL;
|
sl@0
|
617 |
MapUidToProcessingUnit(aType, instance);
|
sl@0
|
618 |
TUint count = iAudioStreamObserver.Count();
|
sl@0
|
619 |
for ( TUint idx(0); idx < count; idx++ )
|
sl@0
|
620 |
{
|
sl@0
|
621 |
iAudioStreamObserver[idx]->RemoveProcessingUnitComplete(*this, instance, aError);
|
sl@0
|
622 |
}
|
sl@0
|
623 |
DP_OUT();
|
sl@0
|
624 |
}
|
sl@0
|
625 |
|
sl@0
|
626 |
// ---------------------------------------------------------------------------
|
sl@0
|
627 |
// From MAudioStreamAdaptationObserver
|
sl@0
|
628 |
// CLogicalAudioStream::ProcessingFinished
|
sl@0
|
629 |
// ---------------------------------------------------------------------------
|
sl@0
|
630 |
void CLogicalAudioStream::ProcessingFinished()
|
sl@0
|
631 |
{
|
sl@0
|
632 |
DP_CONTEXT(CLogicalAudioStream::ProcessingFinished *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
633 |
DP_IN();
|
sl@0
|
634 |
TUint count = iAudioStreamObserver.Count();
|
sl@0
|
635 |
for ( TUint idx(0); idx < count; idx++ )
|
sl@0
|
636 |
{
|
sl@0
|
637 |
iAudioStreamObserver[idx]->ProcessingFinished(*this);
|
sl@0
|
638 |
}
|
sl@0
|
639 |
DP_OUT();
|
sl@0
|
640 |
}
|
sl@0
|
641 |
|
sl@0
|
642 |
// ---------------------------------------------------------------------------
|
sl@0
|
643 |
// CLogicalAudioStream::FlushComplete
|
sl@0
|
644 |
// ---------------------------------------------------------------------------
|
sl@0
|
645 |
void CLogicalAudioStream::FlushComplete(TInt aError)
|
sl@0
|
646 |
{
|
sl@0
|
647 |
DP_CONTEXT(CLogicalAudioStream::FlushComplete *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
648 |
DP_IN();
|
sl@0
|
649 |
TUint count = iAudioStreamObserver.Count();
|
sl@0
|
650 |
for ( TUint idx(0); idx < count; idx++ )
|
sl@0
|
651 |
{
|
sl@0
|
652 |
iAudioStreamObserver[idx]->FlushComplete(*this, aError);
|
sl@0
|
653 |
}
|
sl@0
|
654 |
DP_OUT();
|
sl@0
|
655 |
}
|
sl@0
|
656 |
|
sl@0
|
657 |
|
sl@0
|
658 |
// ---------------------------------------------------------------------------
|
sl@0
|
659 |
// Internal
|
sl@0
|
660 |
// CLogicalAudioStream::DoAddProcessingUnit
|
sl@0
|
661 |
// ---------------------------------------------------------------------------
|
sl@0
|
662 |
TInt CLogicalAudioStream::DoAddProcessingUnit(MAudioProcessingUnit* aProcessingUnit)
|
sl@0
|
663 |
{
|
sl@0
|
664 |
DP_CONTEXT(CLogicalAudioStream::DoAddProcessingUnit *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
665 |
DP_IN();
|
sl@0
|
666 |
TInt err(KErrNone);
|
sl@0
|
667 |
|
sl@0
|
668 |
if (aProcessingUnit->IsTypeOf(KUidAudioCodec) )
|
sl@0
|
669 |
{
|
sl@0
|
670 |
// Need for tone handling error
|
sl@0
|
671 |
CAudioProcessingUnit* pUnit = static_cast<CAudioProcessingUnit*>(aProcessingUnit);
|
sl@0
|
672 |
iCodec = static_cast<MAudioProcessingUnit*>(pUnit);
|
sl@0
|
673 |
}
|
sl@0
|
674 |
else if (aProcessingUnit->IsTypeOf(KUidAudioGainControl) )
|
sl@0
|
675 |
{
|
sl@0
|
676 |
CAudioProcessingUnit* pUnit = static_cast<CAudioProcessingUnit*>(aProcessingUnit);
|
sl@0
|
677 |
iGain = static_cast<MAudioProcessingUnit*>(pUnit);
|
sl@0
|
678 |
}
|
sl@0
|
679 |
|
sl@0
|
680 |
err = iAudioProcessingUnits.Append(aProcessingUnit);
|
sl@0
|
681 |
SetMessageType(EComponentCreation);
|
sl@0
|
682 |
|
sl@0
|
683 |
DP0_RET(err, "%d");
|
sl@0
|
684 |
}
|
sl@0
|
685 |
|
sl@0
|
686 |
// ---------------------------------------------------------------------------
|
sl@0
|
687 |
// Internal
|
sl@0
|
688 |
// CLogicalAudioStream::MapUidToProcessingUnit
|
sl@0
|
689 |
// ---------------------------------------------------------------------------
|
sl@0
|
690 |
void CLogicalAudioStream::MapUidToProcessingUnit(TUid aType, MAudioProcessingUnit*& aInstance)
|
sl@0
|
691 |
{
|
sl@0
|
692 |
DP_CONTEXT(CLogicalAudioStream::MapUidToProcessingUnit *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
693 |
DP_IN();
|
sl@0
|
694 |
TUint count = iAudioProcessingUnits.Count();
|
sl@0
|
695 |
for(TUint i=0; i<count; i++)
|
sl@0
|
696 |
{
|
sl@0
|
697 |
aInstance = static_cast<MAudioProcessingUnit*>(iAudioProcessingUnits[i]);
|
sl@0
|
698 |
if ( aInstance->IsTypeOf(aType) )
|
sl@0
|
699 |
{
|
sl@0
|
700 |
break;
|
sl@0
|
701 |
}
|
sl@0
|
702 |
aInstance = NULL;
|
sl@0
|
703 |
}
|
sl@0
|
704 |
DP_OUT();
|
sl@0
|
705 |
}
|
sl@0
|
706 |
|
sl@0
|
707 |
// From MLogicalChain
|
sl@0
|
708 |
// ---------------------------------------------------------------------------
|
sl@0
|
709 |
// CLogicalAudioStream::SetMessageType
|
sl@0
|
710 |
// ---------------------------------------------------------------------------
|
sl@0
|
711 |
void CLogicalAudioStream::SetMessageType(TMMRCMessageType aMessageType)
|
sl@0
|
712 |
{
|
sl@0
|
713 |
DP_CONTEXT(CLogicalAudioStream::SetMessageType *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
714 |
DP_IN();
|
sl@0
|
715 |
iMessageType |= aMessageType;
|
sl@0
|
716 |
DP_OUT();
|
sl@0
|
717 |
}
|
sl@0
|
718 |
|
sl@0
|
719 |
// ---------------------------------------------------------------------------
|
sl@0
|
720 |
// CLogicalAudioStream::ResetMessage
|
sl@0
|
721 |
// ---------------------------------------------------------------------------
|
sl@0
|
722 |
void CLogicalAudioStream::ResetMessage()
|
sl@0
|
723 |
{
|
sl@0
|
724 |
DP_CONTEXT(CLogicalAudioStream::SetMessageType *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
725 |
DP_IN();
|
sl@0
|
726 |
iMessageType = ENoMessage;
|
sl@0
|
727 |
DP_OUT();
|
sl@0
|
728 |
}
|
sl@0
|
729 |
|
sl@0
|
730 |
// ---------------------------------------------------------------------------
|
sl@0
|
731 |
// CLogicalAudioStream::MessageType
|
sl@0
|
732 |
// ---------------------------------------------------------------------------
|
sl@0
|
733 |
TUint CLogicalAudioStream::MessageType()
|
sl@0
|
734 |
{
|
sl@0
|
735 |
DP_CONTEXT(CLogicalAudioStream::MessageType *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
736 |
DP_IN();
|
sl@0
|
737 |
DP0_RET(iMessageType, "Message type %d");
|
sl@0
|
738 |
}
|
sl@0
|
739 |
|
sl@0
|
740 |
|
sl@0
|
741 |
// ---------------------------------------------------------------------------
|
sl@0
|
742 |
// CLogicalAudioStream::AudioProcessingUnitUid
|
sl@0
|
743 |
// ---------------------------------------------------------------------------
|
sl@0
|
744 |
TUid CLogicalAudioStream::AudioProcessingUnitUid(TInt aIndex)
|
sl@0
|
745 |
{
|
sl@0
|
746 |
DP_CONTEXT(CLogicalAudioStream::AudioProcessingUnitUid *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
747 |
DP_IN();
|
sl@0
|
748 |
TUid uid = {0};
|
sl@0
|
749 |
MAudioProcessingUnit* pUnit(NULL);
|
sl@0
|
750 |
if (aIndex >= 0)
|
sl@0
|
751 |
{
|
sl@0
|
752 |
pUnit = static_cast<MAudioProcessingUnit*>(iAudioProcessingUnits[aIndex]);
|
sl@0
|
753 |
}
|
sl@0
|
754 |
|
sl@0
|
755 |
if (pUnit != NULL)
|
sl@0
|
756 |
{
|
sl@0
|
757 |
if (pUnit->IsTypeOf(KUidAudioDecoder))
|
sl@0
|
758 |
{
|
sl@0
|
759 |
uid = KUidAudioDecoder;
|
sl@0
|
760 |
}
|
sl@0
|
761 |
else if (pUnit->IsTypeOf(KUidAudioEncoder))
|
sl@0
|
762 |
{
|
sl@0
|
763 |
uid = KUidAudioEncoder;
|
sl@0
|
764 |
}
|
sl@0
|
765 |
else if (pUnit->IsTypeOf(KUidMmfBufferSource))
|
sl@0
|
766 |
{
|
sl@0
|
767 |
uid = KUidMmfBufferSource;
|
sl@0
|
768 |
}
|
sl@0
|
769 |
else if (pUnit->IsTypeOf(KUidAudioGainControl))
|
sl@0
|
770 |
{
|
sl@0
|
771 |
uid = KUidAudioGainControl;
|
sl@0
|
772 |
}
|
sl@0
|
773 |
else if (pUnit->IsTypeOf(KUidAudioDeviceSink))
|
sl@0
|
774 |
{
|
sl@0
|
775 |
uid = KUidAudioDeviceSink;
|
sl@0
|
776 |
}
|
sl@0
|
777 |
else if (pUnit->IsTypeOf(KUidMmfBufferSink))
|
sl@0
|
778 |
{
|
sl@0
|
779 |
uid = KUidMmfBufferSink;
|
sl@0
|
780 |
}
|
sl@0
|
781 |
else if (pUnit->IsTypeOf(KUidAudioDeviceSource))
|
sl@0
|
782 |
{
|
sl@0
|
783 |
uid = KUidAudioDeviceSource;
|
sl@0
|
784 |
}
|
sl@0
|
785 |
else if (pUnit->IsTypeOf(KUidAudioCodec))
|
sl@0
|
786 |
{
|
sl@0
|
787 |
uid = KUidAudioCodec;
|
sl@0
|
788 |
}
|
sl@0
|
789 |
}
|
sl@0
|
790 |
DP_OUT();
|
sl@0
|
791 |
return uid;
|
sl@0
|
792 |
}
|
sl@0
|
793 |
|
sl@0
|
794 |
// ---------------------------------------------------------------------------
|
sl@0
|
795 |
// CLogicalAudioStream::AudioProcessingUnitsCount
|
sl@0
|
796 |
// ---------------------------------------------------------------------------
|
sl@0
|
797 |
TInt CLogicalAudioStream::AudioProcessingUnitsCount()
|
sl@0
|
798 |
{
|
sl@0
|
799 |
DP_CONTEXT(CLogicalAudioStream::AudioProcessingUnitsCount *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
800 |
DP_IN();
|
sl@0
|
801 |
DP0_RET(iAudioProcessingUnits.Count(), "%d");
|
sl@0
|
802 |
}
|
sl@0
|
803 |
|
sl@0
|
804 |
// ---------------------------------------------------------------------------
|
sl@0
|
805 |
// CLogicalAudioStream::StreamState
|
sl@0
|
806 |
// ---------------------------------------------------------------------------
|
sl@0
|
807 |
TAudioState CLogicalAudioStream::StreamState()
|
sl@0
|
808 |
{
|
sl@0
|
809 |
DP_CONTEXT(CLogicalAudioStream::StreamState *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
810 |
DP_IN();
|
sl@0
|
811 |
DP0_RET(iCurrentState, "Stream state %d");
|
sl@0
|
812 |
}
|
sl@0
|
813 |
|
sl@0
|
814 |
// ---------------------------------------------------------------------------
|
sl@0
|
815 |
// From MLogicalChain
|
sl@0
|
816 |
// CLogicalAudioStream::SetStreamState
|
sl@0
|
817 |
// ---------------------------------------------------------------------------
|
sl@0
|
818 |
void CLogicalAudioStream::SetStreamState(TAudioState aAudioState)
|
sl@0
|
819 |
{
|
sl@0
|
820 |
DP_CONTEXT(CLogicalAudioStream::StreamState *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
821 |
DP_IN();
|
sl@0
|
822 |
iCurrentState = aAudioState;
|
sl@0
|
823 |
DP_OUT();
|
sl@0
|
824 |
}
|
sl@0
|
825 |
|
sl@0
|
826 |
// ---------------------------------------------------------------------------
|
sl@0
|
827 |
// From MLogicalChain
|
sl@0
|
828 |
// CLogicalAudioStream::CodecFormat
|
sl@0
|
829 |
// ---------------------------------------------------------------------------
|
sl@0
|
830 |
TUid CLogicalAudioStream::CodecFormat()
|
sl@0
|
831 |
{
|
sl@0
|
832 |
DP_CONTEXT(CLogicalAudioStream::CodecFormat *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
833 |
DP_IN();
|
sl@0
|
834 |
CLogicalAudioCodec* codec = static_cast<CLogicalAudioCodec*>(iCodec);
|
sl@0
|
835 |
DP_OUT();
|
sl@0
|
836 |
TUid tuidnull = {0};
|
sl@0
|
837 |
if(codec)
|
sl@0
|
838 |
{
|
sl@0
|
839 |
return codec->iFormat;
|
sl@0
|
840 |
}
|
sl@0
|
841 |
else
|
sl@0
|
842 |
{
|
sl@0
|
843 |
return tuidnull;
|
sl@0
|
844 |
}
|
sl@0
|
845 |
}
|
sl@0
|
846 |
|
sl@0
|
847 |
// ---------------------------------------------------------------------------
|
sl@0
|
848 |
// From MLogicalChain
|
sl@0
|
849 |
// CLogicalAudioStream::GetSampleRate
|
sl@0
|
850 |
// ---------------------------------------------------------------------------
|
sl@0
|
851 |
TInt CLogicalAudioStream::GetSampleRate()
|
sl@0
|
852 |
{
|
sl@0
|
853 |
DP_CONTEXT(CLogicalAudioStream::GetSampleRate *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
854 |
DP_IN();
|
sl@0
|
855 |
const TUint KDefaultSampleRate = 8000; // Default sample rate
|
sl@0
|
856 |
CLogicalAudioCodec* codec = static_cast<CLogicalAudioCodec*>(iCodec);
|
sl@0
|
857 |
DP_OUT();
|
sl@0
|
858 |
TInt sampleRateValue = KDefaultSampleRate;
|
sl@0
|
859 |
if(codec)
|
sl@0
|
860 |
{
|
sl@0
|
861 |
sampleRateValue = codec->iSampleRateConfig;
|
sl@0
|
862 |
}
|
sl@0
|
863 |
return sampleRateValue;
|
sl@0
|
864 |
}
|
sl@0
|
865 |
|
sl@0
|
866 |
// ---------------------------------------------------------------------------
|
sl@0
|
867 |
// From MLogicalChain
|
sl@0
|
868 |
// CLogicalAudioStream::GetMode
|
sl@0
|
869 |
// ---------------------------------------------------------------------------
|
sl@0
|
870 |
TUid CLogicalAudioStream::GetMode()
|
sl@0
|
871 |
{
|
sl@0
|
872 |
DP_CONTEXT(CLogicalAudioStream::GetMode *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
873 |
DP_IN();
|
sl@0
|
874 |
CLogicalAudioCodec* codec = static_cast<CLogicalAudioCodec*>(iCodec);
|
sl@0
|
875 |
TUid tuidnull = {0};
|
sl@0
|
876 |
DP_OUT();
|
sl@0
|
877 |
if(codec)
|
sl@0
|
878 |
{
|
sl@0
|
879 |
return codec->iModeConfig;
|
sl@0
|
880 |
}
|
sl@0
|
881 |
else
|
sl@0
|
882 |
{
|
sl@0
|
883 |
return tuidnull;
|
sl@0
|
884 |
}
|
sl@0
|
885 |
}
|
sl@0
|
886 |
|
sl@0
|
887 |
|
sl@0
|
888 |
// ---------------------------------------------------------------------------
|
sl@0
|
889 |
// From MLogicalChain
|
sl@0
|
890 |
// CLogicalAudioStream::Priority
|
sl@0
|
891 |
// ---------------------------------------------------------------------------
|
sl@0
|
892 |
TInt CLogicalAudioStream::Priority()
|
sl@0
|
893 |
{
|
sl@0
|
894 |
DP_CONTEXT(CLogicalAudioStream::Priority*CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
895 |
DP_IN();
|
sl@0
|
896 |
DP0_RET(iAudioTypeSettings.iPriority, "Priority %d");
|
sl@0
|
897 |
}
|
sl@0
|
898 |
|
sl@0
|
899 |
// ---------------------------------------------------------------------------
|
sl@0
|
900 |
// From MLogicalChain
|
sl@0
|
901 |
// CLogicalAudioStream::GetVolumeRampParameters
|
sl@0
|
902 |
// ---------------------------------------------------------------------------
|
sl@0
|
903 |
void CLogicalAudioStream::GetVolumeRampParameters(TUid& aRampOperation, TTimeIntervalMicroSeconds& aRampDuration)
|
sl@0
|
904 |
{
|
sl@0
|
905 |
DP_CONTEXT(CLogicalAudioStream::GetVolumeRampParameters*CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
906 |
DP_IN();
|
sl@0
|
907 |
CLogicalAudioGainControl* gain = static_cast<CLogicalAudioGainControl*>(iGain);
|
sl@0
|
908 |
if(gain)
|
sl@0
|
909 |
{
|
sl@0
|
910 |
aRampOperation = gain->iDesiredRampOperation;
|
sl@0
|
911 |
aRampDuration = gain->iDesiredRampTime;
|
sl@0
|
912 |
}
|
sl@0
|
913 |
DP_OUT();
|
sl@0
|
914 |
}
|
sl@0
|
915 |
|
sl@0
|
916 |
// ---------------------------------------------------------------------------
|
sl@0
|
917 |
// From MLogicalChain
|
sl@0
|
918 |
// CLogicalAudioStream::CopySettings
|
sl@0
|
919 |
// @param the logical chain from where the parameter will be copied
|
sl@0
|
920 |
// ---------------------------------------------------------------------------
|
sl@0
|
921 |
void CLogicalAudioStream::CopySettings(const MLogicalChain& aChain)
|
sl@0
|
922 |
{
|
sl@0
|
923 |
DP_CONTEXT(CLogicalAudioStream::CopySettings *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
924 |
DP_IN();
|
sl@0
|
925 |
CopyStreamSettings(aChain);
|
sl@0
|
926 |
CopyCodecSettings(aChain);
|
sl@0
|
927 |
CopyGainSettings(aChain);
|
sl@0
|
928 |
DP_OUT();
|
sl@0
|
929 |
}
|
sl@0
|
930 |
|
sl@0
|
931 |
void CLogicalAudioStream::CopyStreamSettings(const MLogicalChain& aChain)
|
sl@0
|
932 |
{
|
sl@0
|
933 |
DP_CONTEXT(CLogicalAudioStream::CopyStreamSettings *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
934 |
DP_IN();
|
sl@0
|
935 |
// LogicalAudioStream settings
|
sl@0
|
936 |
CLogicalAudioStream& srcChain = static_cast<CLogicalAudioStream&>(const_cast<MLogicalChain&>(aChain));
|
sl@0
|
937 |
|
sl@0
|
938 |
iAudioTypeSettings = srcChain.iAudioTypeSettings;
|
sl@0
|
939 |
iCurrentState = srcChain.iCurrentState;
|
sl@0
|
940 |
iRequestState = srcChain.iRequestState;
|
sl@0
|
941 |
iMessageType = srcChain.iMessageType;
|
sl@0
|
942 |
iTimeProcessed = srcChain.iTimeProcessed;
|
sl@0
|
943 |
DP_OUT();
|
sl@0
|
944 |
}
|
sl@0
|
945 |
|
sl@0
|
946 |
void CLogicalAudioStream::CopyCodecSettings(const MLogicalChain& aChain)
|
sl@0
|
947 |
{
|
sl@0
|
948 |
DP_CONTEXT(CLogicalAudioStream::CopyCodecSettings *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
949 |
DP_IN();
|
sl@0
|
950 |
|
sl@0
|
951 |
CLogicalAudioStream& srcChain = static_cast<CLogicalAudioStream&>(const_cast<MLogicalChain&>(aChain));
|
sl@0
|
952 |
// Copy codec settings
|
sl@0
|
953 |
CLogicalAudioCodec* srcCodec = static_cast<CLogicalAudioCodec*>(srcChain.iCodec);
|
sl@0
|
954 |
if(iCodec && srcCodec)
|
sl@0
|
955 |
{
|
sl@0
|
956 |
CLogicalAudioCodec* logicalCodec = static_cast<CLogicalAudioCodec*>(iCodec);
|
sl@0
|
957 |
logicalCodec->iFormat = srcCodec->iFormat;
|
sl@0
|
958 |
logicalCodec->iSampleRateConfig = srcCodec->iSampleRateConfig;
|
sl@0
|
959 |
logicalCodec->iModeConfig = srcCodec->iModeConfig;
|
sl@0
|
960 |
}
|
sl@0
|
961 |
DP_OUT();
|
sl@0
|
962 |
}
|
sl@0
|
963 |
|
sl@0
|
964 |
|
sl@0
|
965 |
void CLogicalAudioStream::CopyGainSettings(const MLogicalChain& aChain)
|
sl@0
|
966 |
{
|
sl@0
|
967 |
DP_CONTEXT(CLogicalAudioStream::CopyGainSettings *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
968 |
DP_IN();
|
sl@0
|
969 |
|
sl@0
|
970 |
CLogicalAudioStream& srcChain = static_cast<CLogicalAudioStream&>(const_cast<MLogicalChain&>(aChain));
|
sl@0
|
971 |
// Copy gain settings
|
sl@0
|
972 |
CLogicalAudioGainControl* srcGain = static_cast<CLogicalAudioGainControl*>(srcChain.iGain);
|
sl@0
|
973 |
if (iGain && srcGain )
|
sl@0
|
974 |
{
|
sl@0
|
975 |
if(srcGain->iDesiredChannels.Count() > 0)
|
sl@0
|
976 |
{
|
sl@0
|
977 |
CLogicalAudioGainControl* logicalGain = static_cast<CLogicalAudioGainControl*>(iGain);
|
sl@0
|
978 |
TUint count = srcGain->iDesiredChannels.Count();
|
sl@0
|
979 |
for (TUint i(0); i < count; i++)
|
sl@0
|
980 |
{
|
sl@0
|
981 |
logicalGain->iDesiredChannels[i] = srcGain->iDesiredChannels[i];
|
sl@0
|
982 |
}
|
sl@0
|
983 |
logicalGain->iDesiredRampOperation = srcGain->iDesiredRampOperation;
|
sl@0
|
984 |
logicalGain->iDesiredRampTime = srcGain->iDesiredRampTime;
|
sl@0
|
985 |
}
|
sl@0
|
986 |
}
|
sl@0
|
987 |
DP_OUT();
|
sl@0
|
988 |
}
|
sl@0
|
989 |
|
sl@0
|
990 |
// ---------------------------------------------------------------------------
|
sl@0
|
991 |
// From MLogicalChain
|
sl@0
|
992 |
// CLogicalAudioStream::CloneL
|
sl@0
|
993 |
// ---------------------------------------------------------------------------
|
sl@0
|
994 |
MLogicalChain* CLogicalAudioStream::CloneL()
|
sl@0
|
995 |
{
|
sl@0
|
996 |
DP_CONTEXT(CLogicalAudioStream::CloneL *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
997 |
DP_IN();
|
sl@0
|
998 |
TInt err = KErrNone;
|
sl@0
|
999 |
MLogicalChain* newLogicalChain = NULL;
|
sl@0
|
1000 |
|
sl@0
|
1001 |
// Create another audiostream
|
sl@0
|
1002 |
CAudioStreamManager *manager = NULL;
|
sl@0
|
1003 |
manager = CAudioStreamManager::NewL(KUidAudioStream);
|
sl@0
|
1004 |
// Copy stream settings
|
sl@0
|
1005 |
CLogicalAudioStream* logicalAudioStream = static_cast<CLogicalAudioStream*>(manager);
|
sl@0
|
1006 |
|
sl@0
|
1007 |
MAudioProcessingUnit* pUnit=NULL;
|
sl@0
|
1008 |
TInt count = iAudioProcessingUnits.Count();
|
sl@0
|
1009 |
for(TInt i = 0; i < count ; i++)
|
sl@0
|
1010 |
{
|
sl@0
|
1011 |
// Create processing unit
|
sl@0
|
1012 |
TUid type = AudioProcessingUnitUid(i);
|
sl@0
|
1013 |
TComponentParameters cParameters;
|
sl@0
|
1014 |
cParameters.iTypeUid = type;
|
sl@0
|
1015 |
cParameters.iInstanceId = 0;
|
sl@0
|
1016 |
cParameters.iContextId = 0;
|
sl@0
|
1017 |
cParameters.iSettingsObserver = NULL;
|
sl@0
|
1018 |
pUnit = CAudioProcessingUnit::NewL(cParameters);
|
sl@0
|
1019 |
|
sl@0
|
1020 |
// If no error then add to the stream
|
sl@0
|
1021 |
if ( (type == KUidAudioDecoder) || (type == KUidAudioEncoder) )
|
sl@0
|
1022 |
{
|
sl@0
|
1023 |
err = logicalAudioStream->AddAudioCodec(pUnit);
|
sl@0
|
1024 |
}
|
sl@0
|
1025 |
else if (type == KUidMmfBufferSource || (type == KUidAudioDeviceSource) )
|
sl@0
|
1026 |
{
|
sl@0
|
1027 |
err = logicalAudioStream->AddSource(pUnit);
|
sl@0
|
1028 |
}
|
sl@0
|
1029 |
else if (type == KUidAudioGainControl)
|
sl@0
|
1030 |
{
|
sl@0
|
1031 |
err = logicalAudioStream->AddGainControl(pUnit);
|
sl@0
|
1032 |
}
|
sl@0
|
1033 |
else if (type == KUidAudioDeviceSink || ( type == KUidMmfBufferSink) )
|
sl@0
|
1034 |
{
|
sl@0
|
1035 |
err = logicalAudioStream->AddSink(pUnit);
|
sl@0
|
1036 |
}
|
sl@0
|
1037 |
// TODO:
|
sl@0
|
1038 |
// Check this couldn't be added
|
sl@0
|
1039 |
if(err != KErrNone)
|
sl@0
|
1040 |
{
|
sl@0
|
1041 |
logicalAudioStream->iAudioProcessingUnits.Remove(iAudioProcessingUnits.Count()-1);
|
sl@0
|
1042 |
delete pUnit;
|
sl@0
|
1043 |
}
|
sl@0
|
1044 |
}
|
sl@0
|
1045 |
// Cast to MLogicalChain
|
sl@0
|
1046 |
newLogicalChain = static_cast<MLogicalChain*>(logicalAudioStream);
|
sl@0
|
1047 |
newLogicalChain->CopySettings(*this);
|
sl@0
|
1048 |
|
sl@0
|
1049 |
DP0_RET(newLogicalChain, "0x%x");
|
sl@0
|
1050 |
}
|
sl@0
|
1051 |
|
sl@0
|
1052 |
// ---------------------------------------------------------------------------
|
sl@0
|
1053 |
// From MLogicalChain
|
sl@0
|
1054 |
// CLogicalAudioStream::Release
|
sl@0
|
1055 |
// ---------------------------------------------------------------------------
|
sl@0
|
1056 |
void CLogicalAudioStream::Release()
|
sl@0
|
1057 |
{
|
sl@0
|
1058 |
DP_CONTEXT(CLogicalAudioStream::Release *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
1059 |
DP_IN();
|
sl@0
|
1060 |
// ResetAndDestroy
|
sl@0
|
1061 |
TInt count = iAudioProcessingUnits.Count();
|
sl@0
|
1062 |
TInt i;
|
sl@0
|
1063 |
for (i=0; i<count; i++)
|
sl@0
|
1064 |
{
|
sl@0
|
1065 |
CAudioProcessingUnit* pUnit = static_cast<CAudioProcessingUnit*>(iAudioProcessingUnits[i]);
|
sl@0
|
1066 |
delete pUnit;
|
sl@0
|
1067 |
}
|
sl@0
|
1068 |
iAudioProcessingUnits.Reset();
|
sl@0
|
1069 |
DP_OUT();
|
sl@0
|
1070 |
delete this;
|
sl@0
|
1071 |
}
|
sl@0
|
1072 |
|
sl@0
|
1073 |
// ---------------------------------------------------------------------------
|
sl@0
|
1074 |
// From MLogicalChain
|
sl@0
|
1075 |
// CLogicalAudioStream::GetComponent
|
sl@0
|
1076 |
// ---------------------------------------------------------------------------
|
sl@0
|
1077 |
TAny* CLogicalAudioStream::GetComponent(TUid aType)
|
sl@0
|
1078 |
{
|
sl@0
|
1079 |
DP_CONTEXT(CLogicalAudioStream::GetComponent *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
1080 |
DP_IN();
|
sl@0
|
1081 |
TAny* interface = NULL;
|
sl@0
|
1082 |
|
sl@0
|
1083 |
// go through this or our subcomponents to see if somebody knows about the interface
|
sl@0
|
1084 |
interface = Interface(aType);
|
sl@0
|
1085 |
if (interface==NULL)
|
sl@0
|
1086 |
{
|
sl@0
|
1087 |
TUint count = iAudioProcessingUnits.Count();
|
sl@0
|
1088 |
// go through components looking for valid interface
|
sl@0
|
1089 |
for ( TInt i=0; i < count; i++ )
|
sl@0
|
1090 |
{
|
sl@0
|
1091 |
interface = iAudioProcessingUnits[i]->Interface(aType);
|
sl@0
|
1092 |
if (interface!=NULL)
|
sl@0
|
1093 |
{
|
sl@0
|
1094 |
break;
|
sl@0
|
1095 |
};
|
sl@0
|
1096 |
}
|
sl@0
|
1097 |
};
|
sl@0
|
1098 |
|
sl@0
|
1099 |
|
sl@0
|
1100 |
DP0_RET(interface, "0x%x");
|
sl@0
|
1101 |
}
|
sl@0
|
1102 |
|
sl@0
|
1103 |
|
sl@0
|
1104 |
|
sl@0
|
1105 |
// ---------------------------------------------------------------------------
|
sl@0
|
1106 |
// From MLogicalChain
|
sl@0
|
1107 |
// CLogicalAudioStream::SetAdaptationSource
|
sl@0
|
1108 |
// ---------------------------------------------------------------------------
|
sl@0
|
1109 |
void CLogicalAudioStream::SetAdaptationSource(MMMFBufferSource& aSource)
|
sl@0
|
1110 |
{
|
sl@0
|
1111 |
DP_CONTEXT(CLogicalAudioStream::SetAdaptationSource *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
1112 |
DP_IN();
|
sl@0
|
1113 |
MapUidToProcessingUnit(KUidMmfBufferSource, iAudioProcessingUnit);
|
sl@0
|
1114 |
ASSERT(iAudioProcessingUnit);
|
sl@0
|
1115 |
|
sl@0
|
1116 |
CAudioProcessingUnit* cUnit = static_cast<CAudioProcessingUnit*>(iAudioProcessingUnit);
|
sl@0
|
1117 |
CLogicalBufferSource* bufferSource = (static_cast<CLogicalBufferSource*>(cUnit));
|
sl@0
|
1118 |
|
sl@0
|
1119 |
bufferSource->iAdaptationBufferSource = &aSource;
|
sl@0
|
1120 |
aSource.SetDataSupplier(*bufferSource);
|
sl@0
|
1121 |
|
sl@0
|
1122 |
iAudioProcessingUnit = NULL;
|
sl@0
|
1123 |
DP_OUT();
|
sl@0
|
1124 |
}
|
sl@0
|
1125 |
|
sl@0
|
1126 |
// ---------------------------------------------------------------------------
|
sl@0
|
1127 |
// From MLogicalChain
|
sl@0
|
1128 |
// CLogicalAudioStream::SetAdaptationSink
|
sl@0
|
1129 |
// ---------------------------------------------------------------------------
|
sl@0
|
1130 |
void CLogicalAudioStream::SetAdaptationSink(MMMFBufferSink& aSink)
|
sl@0
|
1131 |
{
|
sl@0
|
1132 |
DP_CONTEXT(CLogicalAudioStream::SetAdaptationSink *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
1133 |
DP_IN();
|
sl@0
|
1134 |
MapUidToProcessingUnit(KUidMmfBufferSink, iAudioProcessingUnit);
|
sl@0
|
1135 |
ASSERT(iAudioProcessingUnit);
|
sl@0
|
1136 |
|
sl@0
|
1137 |
CAudioProcessingUnit* cUnit = static_cast<CAudioProcessingUnit*>(iAudioProcessingUnit);
|
sl@0
|
1138 |
CLogicalBufferSink* bufferSink = (static_cast<CLogicalBufferSink*>(cUnit));
|
sl@0
|
1139 |
|
sl@0
|
1140 |
bufferSink->iAdaptationBufferSink = &aSink;
|
sl@0
|
1141 |
aSink.SetDataConsumer(*bufferSink);
|
sl@0
|
1142 |
|
sl@0
|
1143 |
iAudioProcessingUnit = NULL;
|
sl@0
|
1144 |
DP_OUT();
|
sl@0
|
1145 |
}
|
sl@0
|
1146 |
|
sl@0
|
1147 |
// ---------------------------------------------------------------------------
|
sl@0
|
1148 |
// From MLogicalChain
|
sl@0
|
1149 |
// CLogicalAudioStream::SetAdaptationGainControl
|
sl@0
|
1150 |
// ---------------------------------------------------------------------------
|
sl@0
|
1151 |
void CLogicalAudioStream::SetAdaptationGainControl(MAudioGainControl& aGain)
|
sl@0
|
1152 |
{
|
sl@0
|
1153 |
DP_CONTEXT(CLogicalAudioStream::SetAdaptationGainControl *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
1154 |
DP_IN();
|
sl@0
|
1155 |
ASSERT(iGain);
|
sl@0
|
1156 |
CLogicalAudioGainControl* gain = static_cast<CLogicalAudioGainControl*>(iGain);
|
sl@0
|
1157 |
gain->iAdaptationGain = &aGain;
|
sl@0
|
1158 |
aGain.RegisterAudioGainControlObserver(*gain);
|
sl@0
|
1159 |
DP_OUT();
|
sl@0
|
1160 |
}
|
sl@0
|
1161 |
|
sl@0
|
1162 |
|
sl@0
|
1163 |
|
sl@0
|
1164 |
// ---------------------------------------------------------------------------
|
sl@0
|
1165 |
// From MLogicalChain
|
sl@0
|
1166 |
// CLogicalAudioStream::SetPositionControl
|
sl@0
|
1167 |
// ---------------------------------------------------------------------------
|
sl@0
|
1168 |
void CLogicalAudioStream::SetStreamPositionControl(MStreamPositionControl& aPositionControl)
|
sl@0
|
1169 |
{
|
sl@0
|
1170 |
DP_CONTEXT(CLogicalAudioStream::SetStreamPositionControl *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
1171 |
DP_IN();
|
sl@0
|
1172 |
iPositionControl = &aPositionControl;
|
sl@0
|
1173 |
DP_OUT();
|
sl@0
|
1174 |
}
|
sl@0
|
1175 |
|
sl@0
|
1176 |
// ---------------------------------------------------------------------------
|
sl@0
|
1177 |
// CLogicalAudioStream::SetAdaptationStream
|
sl@0
|
1178 |
// ---------------------------------------------------------------------------
|
sl@0
|
1179 |
void CLogicalAudioStream::SetAdaptationStream(MConfigurationHelper& aStream)
|
sl@0
|
1180 |
{
|
sl@0
|
1181 |
DP_CONTEXT(CLogicalAudioStream::SetAdaptationStream *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
1182 |
DP_IN();
|
sl@0
|
1183 |
CLogicalAudioCodec* codec = static_cast<CLogicalAudioCodec*>(iCodec);
|
sl@0
|
1184 |
if (codec != NULL)
|
sl@0
|
1185 |
{
|
sl@0
|
1186 |
if (codec->iAdaptationStream == NULL)
|
sl@0
|
1187 |
{
|
sl@0
|
1188 |
codec->iAdaptationStream = &aStream;
|
sl@0
|
1189 |
}
|
sl@0
|
1190 |
}
|
sl@0
|
1191 |
DP_OUT();
|
sl@0
|
1192 |
}
|
sl@0
|
1193 |
|
sl@0
|
1194 |
// ---------------------------------------------------------------------------
|
sl@0
|
1195 |
// CLogicalAudioStream::SetStreamBufferControl
|
sl@0
|
1196 |
// ---------------------------------------------------------------------------
|
sl@0
|
1197 |
void CLogicalAudioStream::SetStreamBufferControl(MStreamBufferControl& aStreamBufferControl)
|
sl@0
|
1198 |
{
|
sl@0
|
1199 |
DP_CONTEXT(CLogicalAudioStream::SetAdaptationStream *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
1200 |
DP_IN();
|
sl@0
|
1201 |
iStreamBufferControl = &aStreamBufferControl;
|
sl@0
|
1202 |
DP_OUT();
|
sl@0
|
1203 |
}
|
sl@0
|
1204 |
|
sl@0
|
1205 |
|
sl@0
|
1206 |
// ---------------------------------------------------------------------------
|
sl@0
|
1207 |
// CLogicalAudioStream::SetCustomInterfaceProvider
|
sl@0
|
1208 |
// ---------------------------------------------------------------------------
|
sl@0
|
1209 |
void CLogicalAudioStream::SetCustomInterfaceProvider(MCustomInterfaceSupport& aInterfaceProvider)
|
sl@0
|
1210 |
{
|
sl@0
|
1211 |
DP_CONTEXT(CLogicalAudioStream::SetCustomInterfaceProvider *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
1212 |
DP_IN();
|
sl@0
|
1213 |
iInterfaceProvider = &aInterfaceProvider;
|
sl@0
|
1214 |
DP_OUT();
|
sl@0
|
1215 |
}
|
sl@0
|
1216 |
|
sl@0
|
1217 |
// ---------------------------------------------------------------------------
|
sl@0
|
1218 |
// CLogicalAudioStream::SampleRateSet
|
sl@0
|
1219 |
// ---------------------------------------------------------------------------
|
sl@0
|
1220 |
void CLogicalAudioStream::SampleRateSet(TInt aError)
|
sl@0
|
1221 |
{
|
sl@0
|
1222 |
DP_CONTEXT(CLogicalAudioStream::SampleRateSet *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
1223 |
DP_IN();
|
sl@0
|
1224 |
CLogicalAudioCodec* codec = static_cast<CLogicalAudioCodec*>(iCodec);
|
sl@0
|
1225 |
if(codec)
|
sl@0
|
1226 |
{
|
sl@0
|
1227 |
TUint count = codec->iAudioCodecObserver.Count();
|
sl@0
|
1228 |
for ( TUint idx(0); idx < count; idx++ )
|
sl@0
|
1229 |
{
|
sl@0
|
1230 |
codec->iAudioCodecObserver[idx]->SampleRateSet(aError);
|
sl@0
|
1231 |
}
|
sl@0
|
1232 |
}
|
sl@0
|
1233 |
DP_OUT();
|
sl@0
|
1234 |
}
|
sl@0
|
1235 |
|
sl@0
|
1236 |
// ---------------------------------------------------------------------------
|
sl@0
|
1237 |
// CLogicalAudioStream::ModeSet
|
sl@0
|
1238 |
// ---------------------------------------------------------------------------
|
sl@0
|
1239 |
void CLogicalAudioStream::ModeSet(TInt aError)
|
sl@0
|
1240 |
{
|
sl@0
|
1241 |
DP_CONTEXT(CLogicalAudioStream::SampleRateSet *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
1242 |
DP_IN();
|
sl@0
|
1243 |
CLogicalAudioCodec* codec = static_cast<CLogicalAudioCodec*>(iCodec);
|
sl@0
|
1244 |
if(codec)
|
sl@0
|
1245 |
{
|
sl@0
|
1246 |
TUint count = codec->iAudioCodecObserver.Count();
|
sl@0
|
1247 |
for ( TUint idx(0); idx < count; idx++ )
|
sl@0
|
1248 |
{
|
sl@0
|
1249 |
codec->iAudioCodecObserver[idx]->ModeSet(aError);
|
sl@0
|
1250 |
}
|
sl@0
|
1251 |
}
|
sl@0
|
1252 |
DP_OUT();
|
sl@0
|
1253 |
}
|
sl@0
|
1254 |
|
sl@0
|
1255 |
// ---------------------------------------------------------------------------
|
sl@0
|
1256 |
// CLogicalAudioStream::GetSupportedSampleRatesComplete
|
sl@0
|
1257 |
// ---------------------------------------------------------------------------
|
sl@0
|
1258 |
void CLogicalAudioStream::GetSupportedSampleRatesComplete (TInt aError)
|
sl@0
|
1259 |
{
|
sl@0
|
1260 |
DP_CONTEXT(CLogicalAudioStream::SampleRateSet *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
1261 |
DP_IN();
|
sl@0
|
1262 |
CLogicalAudioCodec* codec = static_cast<CLogicalAudioCodec*>(iCodec);
|
sl@0
|
1263 |
if(codec)
|
sl@0
|
1264 |
{
|
sl@0
|
1265 |
TUint count = codec->iAudioCodecObserver.Count();
|
sl@0
|
1266 |
for ( TUint idx(0); idx < count; idx++ )
|
sl@0
|
1267 |
{
|
sl@0
|
1268 |
codec->iAudioCodecObserver[idx]->GetSupportedSampleRatesComplete(aError);
|
sl@0
|
1269 |
}
|
sl@0
|
1270 |
}
|
sl@0
|
1271 |
DP_OUT();
|
sl@0
|
1272 |
}
|
sl@0
|
1273 |
|
sl@0
|
1274 |
// ---------------------------------------------------------------------------
|
sl@0
|
1275 |
// CLogicalAudioStream::GetSupportedModesComplete
|
sl@0
|
1276 |
// ---------------------------------------------------------------------------
|
sl@0
|
1277 |
void CLogicalAudioStream::GetSupportedModesComplete (TInt aError)
|
sl@0
|
1278 |
{
|
sl@0
|
1279 |
DP_CONTEXT(CLogicalAudioStream::SampleRateSet *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
1280 |
DP_IN();
|
sl@0
|
1281 |
CLogicalAudioCodec* codec = static_cast<CLogicalAudioCodec*>(iCodec);
|
sl@0
|
1282 |
if(codec)
|
sl@0
|
1283 |
{
|
sl@0
|
1284 |
TUint count = codec->iAudioCodecObserver.Count();
|
sl@0
|
1285 |
for ( TUint idx(0); idx < count; idx++ )
|
sl@0
|
1286 |
{
|
sl@0
|
1287 |
codec->iAudioCodecObserver[idx]->GetSupportedModesComplete(aError);
|
sl@0
|
1288 |
}
|
sl@0
|
1289 |
}
|
sl@0
|
1290 |
DP_OUT();
|
sl@0
|
1291 |
}
|
sl@0
|
1292 |
|
sl@0
|
1293 |
// ---------------------------------------------------------------------------
|
sl@0
|
1294 |
// CLogicalAudioStream::SetParentContext
|
sl@0
|
1295 |
// ---------------------------------------------------------------------------
|
sl@0
|
1296 |
void CLogicalAudioStream::SetParentContext(const CAudioContext& aContext)
|
sl@0
|
1297 |
{
|
sl@0
|
1298 |
iParentContext = const_cast<CAudioContext*>(&aContext);
|
sl@0
|
1299 |
}
|
sl@0
|
1300 |
|
sl@0
|
1301 |
|
sl@0
|
1302 |
// from MA3FBackdoorAccessIf
|
sl@0
|
1303 |
|
sl@0
|
1304 |
MAudioContext* CLogicalAudioStream::AudioContext()
|
sl@0
|
1305 |
{
|
sl@0
|
1306 |
return iParentContext;
|
sl@0
|
1307 |
}
|
sl@0
|
1308 |
|
sl@0
|
1309 |
MAudioStream* CLogicalAudioStream::AudioStream()
|
sl@0
|
1310 |
{
|
sl@0
|
1311 |
return this;
|
sl@0
|
1312 |
}
|
sl@0
|
1313 |
|
sl@0
|
1314 |
MAudioProcessingUnit* CLogicalAudioStream::ProcessingUnit(TUid aType)
|
sl@0
|
1315 |
{
|
sl@0
|
1316 |
// look through our processing units for something of the correct type
|
sl@0
|
1317 |
TInt numProcessingUnits = iAudioProcessingUnits.Count();
|
sl@0
|
1318 |
for (TInt index=0; index < numProcessingUnits; index++)
|
sl@0
|
1319 |
{
|
sl@0
|
1320 |
MAudioProcessingUnit* ptr = iAudioProcessingUnits[index];
|
sl@0
|
1321 |
if (ptr->IsTypeOf(aType))
|
sl@0
|
1322 |
{
|
sl@0
|
1323 |
return ptr;
|
sl@0
|
1324 |
}
|
sl@0
|
1325 |
}
|
sl@0
|
1326 |
return NULL;
|
sl@0
|
1327 |
}
|