sl@0
|
1 |
//audiostream.cpp
|
sl@0
|
2 |
|
sl@0
|
3 |
// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
4 |
// All rights reserved.
|
sl@0
|
5 |
// This component and the accompanying materials are made available
|
sl@0
|
6 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
7 |
// which accompanies this distribution, and is available
|
sl@0
|
8 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
9 |
//
|
sl@0
|
10 |
// Initial Contributors:
|
sl@0
|
11 |
// Nokia Corporation - initial contribution.
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Contributors:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
// Description:
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
|
sl@0
|
19 |
|
sl@0
|
20 |
|
sl@0
|
21 |
#include <a3f/a3fbase.h>
|
sl@0
|
22 |
#include <a3f/audioprocessingunittypeuids.h>
|
sl@0
|
23 |
#include <a3f/a3ffourcclookup.h>
|
sl@0
|
24 |
|
sl@0
|
25 |
#include "audiostream.h"
|
sl@0
|
26 |
|
sl@0
|
27 |
// PHYSICAL COMPONENTS
|
sl@0
|
28 |
#include "audiocodec.h"
|
sl@0
|
29 |
#include "audiostream.h"
|
sl@0
|
30 |
#include "buffersource.h"
|
sl@0
|
31 |
#include "buffersink.h"
|
sl@0
|
32 |
#include "audiodevicesource.h"
|
sl@0
|
33 |
#include "audiodevicesink.h"
|
sl@0
|
34 |
#include "audiogaincontrol.h"
|
sl@0
|
35 |
#include "maudiostreamadaptationobserver.h"
|
sl@0
|
36 |
|
sl@0
|
37 |
#include <a3f/maudiodatasupplier.h>
|
sl@0
|
38 |
#include <a3f/maudiodataconsumer.h>
|
sl@0
|
39 |
|
sl@0
|
40 |
#include "minputport.h"
|
sl@0
|
41 |
#include "moutputport.h"
|
sl@0
|
42 |
#include "audiocontext.h"
|
sl@0
|
43 |
|
sl@0
|
44 |
#include <ecom/implementationproxy.h>
|
sl@0
|
45 |
|
sl@0
|
46 |
|
sl@0
|
47 |
|
sl@0
|
48 |
const TInt KSampleRate8000Hz = 8000;
|
sl@0
|
49 |
|
sl@0
|
50 |
// Map the interface implementation UIDs to implementation factory functions
|
sl@0
|
51 |
const TImplementationProxy ImplementationTable[] =
|
sl@0
|
52 |
{
|
sl@0
|
53 |
IMPLEMENTATION_PROXY_ENTRY(0x10283461, CAudioStream::NewL),
|
sl@0
|
54 |
};
|
sl@0
|
55 |
|
sl@0
|
56 |
|
sl@0
|
57 |
EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
|
sl@0
|
58 |
{
|
sl@0
|
59 |
aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
|
sl@0
|
60 |
return ImplementationTable;
|
sl@0
|
61 |
}
|
sl@0
|
62 |
|
sl@0
|
63 |
// ---------------------------------------------------------------------------
|
sl@0
|
64 |
// Constructor
|
sl@0
|
65 |
// ---------------------------------------------------------------------------
|
sl@0
|
66 |
//
|
sl@0
|
67 |
CAudioStream::CAudioStream()
|
sl@0
|
68 |
: iCurrentStreamState(EUninitialized),
|
sl@0
|
69 |
iDesiredStreamState(EUninitialized)
|
sl@0
|
70 |
{
|
sl@0
|
71 |
TRACE_CREATE();
|
sl@0
|
72 |
DP_CONTEXT(CAudioStream::CAudioStream *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
73 |
DP_IN();
|
sl@0
|
74 |
// Some init config values
|
sl@0
|
75 |
iSampleRateConfig = KSampleRate8000Hz;
|
sl@0
|
76 |
iModeConfig = KA3FModeMono;
|
sl@0
|
77 |
|
sl@0
|
78 |
DP_OUT();
|
sl@0
|
79 |
}
|
sl@0
|
80 |
|
sl@0
|
81 |
// ---------------------------------------------------------------------------
|
sl@0
|
82 |
// Factory method
|
sl@0
|
83 |
// ---------------------------------------------------------------------------
|
sl@0
|
84 |
//
|
sl@0
|
85 |
CAudioStream* CAudioStream::NewL()
|
sl@0
|
86 |
{
|
sl@0
|
87 |
DP_STATIC_CONTEXT(CAudioStream::NewL *CD0*, CtxDevSound, DPLOCAL);
|
sl@0
|
88 |
DP_IN();
|
sl@0
|
89 |
CAudioStream* self = new(ELeave)CAudioStream();
|
sl@0
|
90 |
CleanupStack::PushL(self);
|
sl@0
|
91 |
self->ConstructL();
|
sl@0
|
92 |
CleanupStack::Pop(self);
|
sl@0
|
93 |
DP0_RET(self, "0x%x");
|
sl@0
|
94 |
}
|
sl@0
|
95 |
|
sl@0
|
96 |
// ---------------------------------------------------------------------------
|
sl@0
|
97 |
// Second phase constructor
|
sl@0
|
98 |
// ---------------------------------------------------------------------------
|
sl@0
|
99 |
//
|
sl@0
|
100 |
void CAudioStream::ConstructL()
|
sl@0
|
101 |
{
|
sl@0
|
102 |
DP_CONTEXT(CAudioStream::ConstructL *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
103 |
DP_IN();
|
sl@0
|
104 |
DP_OUT();
|
sl@0
|
105 |
}
|
sl@0
|
106 |
|
sl@0
|
107 |
// ---------------------------------------------------------------------------
|
sl@0
|
108 |
// Destructor
|
sl@0
|
109 |
// ---------------------------------------------------------------------------
|
sl@0
|
110 |
//
|
sl@0
|
111 |
CAudioStream::~CAudioStream()
|
sl@0
|
112 |
{
|
sl@0
|
113 |
DP_CONTEXT(CAudioStream::~CAudioStream *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
114 |
DP_IN();
|
sl@0
|
115 |
|
sl@0
|
116 |
iAudioStreamObservers.Close();
|
sl@0
|
117 |
iAudioCodecObservers.Close();
|
sl@0
|
118 |
// Just for now
|
sl@0
|
119 |
DeletePhysicalComponents();
|
sl@0
|
120 |
REComSession::FinalClose();
|
sl@0
|
121 |
DP_OUT();
|
sl@0
|
122 |
}
|
sl@0
|
123 |
|
sl@0
|
124 |
// ---------------------------------------------------------------------------
|
sl@0
|
125 |
// CAudioStream::RegisterAudioStreamObserver
|
sl@0
|
126 |
// ---------------------------------------------------------------------------
|
sl@0
|
127 |
//
|
sl@0
|
128 |
TInt CAudioStream::RegisterAudioStreamObserver(MAudioStreamAdaptationObserver& aObserver)
|
sl@0
|
129 |
{
|
sl@0
|
130 |
DP_CONTEXT(CAudioStream::RegisterAudioStreamObserver *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
131 |
DP_IN();
|
sl@0
|
132 |
TInt err = iAudioStreamObservers.Find(&aObserver);
|
sl@0
|
133 |
if(err == KErrNotFound)
|
sl@0
|
134 |
{
|
sl@0
|
135 |
err = iAudioStreamObservers.Append(&aObserver);
|
sl@0
|
136 |
}
|
sl@0
|
137 |
else
|
sl@0
|
138 |
{
|
sl@0
|
139 |
err = KErrAlreadyExists;
|
sl@0
|
140 |
}
|
sl@0
|
141 |
DP0_RET(err, "%d");
|
sl@0
|
142 |
}
|
sl@0
|
143 |
|
sl@0
|
144 |
// ---------------------------------------------------------------------------
|
sl@0
|
145 |
// CAudioStream::UnregisterAudioStreamObserver
|
sl@0
|
146 |
// ---------------------------------------------------------------------------
|
sl@0
|
147 |
//
|
sl@0
|
148 |
void CAudioStream::UnregisterAudioStreamObserver(MAudioStreamAdaptationObserver& aObserver)
|
sl@0
|
149 |
{
|
sl@0
|
150 |
DP_CONTEXT(CAudioStream::UnregisterAudioStreamObserver *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
151 |
DP_IN();
|
sl@0
|
152 |
TInt idxOrErr = iAudioStreamObservers.Find(&aObserver);
|
sl@0
|
153 |
if( idxOrErr != KErrNotFound )
|
sl@0
|
154 |
{
|
sl@0
|
155 |
iAudioStreamObservers.Remove(idxOrErr);
|
sl@0
|
156 |
}
|
sl@0
|
157 |
DP_OUT();
|
sl@0
|
158 |
}
|
sl@0
|
159 |
|
sl@0
|
160 |
|
sl@0
|
161 |
// ---------------------------------------------------------------------------
|
sl@0
|
162 |
// CAudioStream::SetFourCC
|
sl@0
|
163 |
// ---------------------------------------------------------------------------
|
sl@0
|
164 |
//
|
sl@0
|
165 |
void CAudioStream::SetFourCC(const CFourCCConvertor& aFourCCConvertor)
|
sl@0
|
166 |
{
|
sl@0
|
167 |
DP_CONTEXT(CAudioStream::SetFourCC *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
168 |
DP_IN();
|
sl@0
|
169 |
CFourCCConvertor& ref = const_cast<CFourCCConvertor&>(aFourCCConvertor);
|
sl@0
|
170 |
iFourCCConvertor = static_cast<CFourCCConvertor*>(static_cast<TAny*>(&ref));
|
sl@0
|
171 |
DP_OUT();
|
sl@0
|
172 |
}
|
sl@0
|
173 |
|
sl@0
|
174 |
|
sl@0
|
175 |
// ---------------------------------------------------------------------------
|
sl@0
|
176 |
// CAudioStream::UnregisterAudioStreamObserver
|
sl@0
|
177 |
// ---------------------------------------------------------------------------
|
sl@0
|
178 |
//
|
sl@0
|
179 |
void CAudioStream::UnregisterAllAudioStreamObserver()
|
sl@0
|
180 |
{
|
sl@0
|
181 |
DP_CONTEXT(CAudioStream::UnregisterAudioStreamObserver *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
182 |
DP_IN();
|
sl@0
|
183 |
|
sl@0
|
184 |
iAudioStreamObservers.Reset();
|
sl@0
|
185 |
|
sl@0
|
186 |
DP_OUT();
|
sl@0
|
187 |
}
|
sl@0
|
188 |
|
sl@0
|
189 |
|
sl@0
|
190 |
// ---------------------------------------------------------------------------
|
sl@0
|
191 |
// MMRC extension mechanism
|
sl@0
|
192 |
// ---------------------------------------------------------------------------
|
sl@0
|
193 |
TAny* CAudioStream::GetComponent(TUid aType)
|
sl@0
|
194 |
{
|
sl@0
|
195 |
TAny* ptr = NULL;
|
sl@0
|
196 |
MLogicalChain* clientDesiredChain = NULL;
|
sl@0
|
197 |
CAudioContext* context = static_cast<CAudioContext*>(iAudioContext);
|
sl@0
|
198 |
if(context)
|
sl@0
|
199 |
{
|
sl@0
|
200 |
clientDesiredChain = context->GetLogicalChain(0);
|
sl@0
|
201 |
}
|
sl@0
|
202 |
if (clientDesiredChain)
|
sl@0
|
203 |
{
|
sl@0
|
204 |
ptr = clientDesiredChain->GetComponent(aType);
|
sl@0
|
205 |
}
|
sl@0
|
206 |
return ptr;
|
sl@0
|
207 |
}
|
sl@0
|
208 |
|
sl@0
|
209 |
// ---------------------------------------------------------------------------
|
sl@0
|
210 |
// CAudioStream::Message
|
sl@0
|
211 |
// ---------------------------------------------------------------------------
|
sl@0
|
212 |
TInt CAudioStream::Message(MLogicalChain& aCurrentChain, MLogicalChain& aDesiredChain, MAudioContext& aContext, TInt aFlags)
|
sl@0
|
213 |
{
|
sl@0
|
214 |
DP_CONTEXT(CAudioStream::Message *CD0*, CtxDevSound, DPLOCAL);
|
sl@0
|
215 |
DP_IN();
|
sl@0
|
216 |
TInt err = KErrNone;
|
sl@0
|
217 |
|
sl@0
|
218 |
iCurrentChain = &aCurrentChain;
|
sl@0
|
219 |
iDesiredChain = &aDesiredChain;
|
sl@0
|
220 |
|
sl@0
|
221 |
TUint messageType = aDesiredChain.MessageType();
|
sl@0
|
222 |
|
sl@0
|
223 |
iAudioContext = &aContext;
|
sl@0
|
224 |
|
sl@0
|
225 |
CAudioContext* audioContext = static_cast<CAudioContext*> (iAudioContext);
|
sl@0
|
226 |
// TO NOTIFY DIRECTLY CONTEXT
|
sl@0
|
227 |
MMultimediaResourceControlObserver* mmrcObserver = static_cast<MMultimediaResourceControlObserver*>(audioContext);
|
sl@0
|
228 |
|
sl@0
|
229 |
// Register stream observer
|
sl@0
|
230 |
if (messageType & ERegisterStreamObserver != 0)
|
sl@0
|
231 |
{
|
sl@0
|
232 |
// Use MMRC extension mechanism
|
sl@0
|
233 |
TAny* ptr = GetComponent(KUidAudioStreamAdaptationObserver);
|
sl@0
|
234 |
MAudioStreamAdaptationObserver* observer = static_cast<MAudioStreamAdaptationObserver*>(ptr);
|
sl@0
|
235 |
if(observer)
|
sl@0
|
236 |
{
|
sl@0
|
237 |
err = RegisterAudioStreamObserver(*observer);
|
sl@0
|
238 |
}
|
sl@0
|
239 |
}
|
sl@0
|
240 |
|
sl@0
|
241 |
// Register codec observer
|
sl@0
|
242 |
if (messageType & ERegisterCodecObserver != 0)
|
sl@0
|
243 |
{
|
sl@0
|
244 |
// Use MMRC extension mechanism
|
sl@0
|
245 |
TAny* ptr = GetComponent(KUidAudioCodecObserver);
|
sl@0
|
246 |
MAudioCodecObserver* observer = static_cast<MAudioCodecObserver*>(ptr);
|
sl@0
|
247 |
if (observer)
|
sl@0
|
248 |
{
|
sl@0
|
249 |
err = RegisterAudioCodecObserver(*observer);
|
sl@0
|
250 |
}
|
sl@0
|
251 |
}
|
sl@0
|
252 |
|
sl@0
|
253 |
// Component creation
|
sl@0
|
254 |
TUint bit = messageType & EComponentCreation;
|
sl@0
|
255 |
if( (err == KErrNone) && (bit != 0) )
|
sl@0
|
256 |
{
|
sl@0
|
257 |
CAudioContext* context = static_cast<CAudioContext*>(iAudioContext);
|
sl@0
|
258 |
MLogicalChain* clientDesiredChain = context->GetLogicalChain(0);
|
sl@0
|
259 |
err = CreatePhysicalComponents(*clientDesiredChain);
|
sl@0
|
260 |
|
sl@0
|
261 |
// For Configuration
|
sl@0
|
262 |
if (err==KErrNone)
|
sl@0
|
263 |
{
|
sl@0
|
264 |
clientDesiredChain->SetAdaptationStream(*this);
|
sl@0
|
265 |
clientDesiredChain->SetStreamBufferControl(*this);
|
sl@0
|
266 |
}
|
sl@0
|
267 |
}
|
sl@0
|
268 |
|
sl@0
|
269 |
// Component alteration
|
sl@0
|
270 |
// Changes that must be applied before stream state transition
|
sl@0
|
271 |
TBool configCodec = EFalse;
|
sl@0
|
272 |
bit = messageType & EComponentAlterationCodec;
|
sl@0
|
273 |
if( (err == KErrNone) && (bit != 0) )
|
sl@0
|
274 |
{
|
sl@0
|
275 |
// Set Format
|
sl@0
|
276 |
if(iCodec)
|
sl@0
|
277 |
{
|
sl@0
|
278 |
TUid desiredCodecFormat = iDesiredChain->CodecFormat();
|
sl@0
|
279 |
err = iCodec->SetFormat( desiredCodecFormat );
|
sl@0
|
280 |
}
|
sl@0
|
281 |
|
sl@0
|
282 |
if(err == KErrNone)
|
sl@0
|
283 |
{
|
sl@0
|
284 |
//if samplerate or mode has changed, update value and trigger callbacks at appropriate point
|
sl@0
|
285 |
if ((iDesiredChain->GetSampleRate() > 0) && (iDesiredChain->GetSampleRate() != iSampleRateConfig))
|
sl@0
|
286 |
{
|
sl@0
|
287 |
iSampleRateConfig = iDesiredChain->GetSampleRate();
|
sl@0
|
288 |
configCodec = ETrue;
|
sl@0
|
289 |
}
|
sl@0
|
290 |
if ((iDesiredChain->GetMode() != KNullUid) && (iDesiredChain->GetMode() != iModeConfig))
|
sl@0
|
291 |
{
|
sl@0
|
292 |
iModeConfig = iDesiredChain->GetMode();
|
sl@0
|
293 |
configCodec = ETrue;
|
sl@0
|
294 |
}
|
sl@0
|
295 |
}
|
sl@0
|
296 |
}
|
sl@0
|
297 |
|
sl@0
|
298 |
|
sl@0
|
299 |
bit = messageType & EComponentAlterationGain;
|
sl@0
|
300 |
if( (err == KErrNone) && (bit != 0) )
|
sl@0
|
301 |
{
|
sl@0
|
302 |
// Apply volume ramp
|
sl@0
|
303 |
// Note that ramp operation and gain now are applied separately because current tone arquitecture
|
sl@0
|
304 |
// need the volume ramp to be set before start the tonehwdevice
|
sl@0
|
305 |
TTimeIntervalMicroSeconds currentRampTimeValue = 0;
|
sl@0
|
306 |
TUid currentRampTimeOperation(KNullUid);
|
sl@0
|
307 |
TTimeIntervalMicroSeconds desiredRampTimeValue = 0;
|
sl@0
|
308 |
TUid desiredRampTimeOperation(KNullUid);
|
sl@0
|
309 |
iCurrentChain->GetVolumeRampParameters(currentRampTimeOperation, currentRampTimeValue);
|
sl@0
|
310 |
iDesiredChain->GetVolumeRampParameters(desiredRampTimeOperation, desiredRampTimeValue);
|
sl@0
|
311 |
|
sl@0
|
312 |
if(currentRampTimeOperation != desiredRampTimeOperation ||
|
sl@0
|
313 |
currentRampTimeValue.Int64() != desiredRampTimeValue.Int64() )
|
sl@0
|
314 |
{
|
sl@0
|
315 |
if (iGainControl)
|
sl@0
|
316 |
{
|
sl@0
|
317 |
err = iGainControl->ConfigureRamp(desiredRampTimeOperation, desiredRampTimeValue);
|
sl@0
|
318 |
}
|
sl@0
|
319 |
}
|
sl@0
|
320 |
}
|
sl@0
|
321 |
|
sl@0
|
322 |
//Configuration request
|
sl@0
|
323 |
// Stream state
|
sl@0
|
324 |
TBool invokeStateEventCallback = EFalse;
|
sl@0
|
325 |
iDesiredStreamState = iDesiredChain->StreamState();
|
sl@0
|
326 |
if( (err == KErrNone) && (iCurrentStreamState != iDesiredStreamState) )
|
sl@0
|
327 |
{
|
sl@0
|
328 |
err = ChangeState(iCurrentStreamState, iDesiredStreamState);
|
sl@0
|
329 |
if (err == KErrNone)
|
sl@0
|
330 |
{
|
sl@0
|
331 |
iCurrentStreamState = iDesiredStreamState;
|
sl@0
|
332 |
}
|
sl@0
|
333 |
invokeStateEventCallback = ETrue;
|
sl@0
|
334 |
}
|
sl@0
|
335 |
|
sl@0
|
336 |
// Component alteration
|
sl@0
|
337 |
// Changes that must be applied after stream state transition
|
sl@0
|
338 |
TBool gainUpdated = EFalse;
|
sl@0
|
339 |
bit = messageType & EComponentAlterationGain;
|
sl@0
|
340 |
if( (err == KErrNone) && (bit != 0) )
|
sl@0
|
341 |
{
|
sl@0
|
342 |
TAny* ptr = GetComponent(KUidAudioGainControl);
|
sl@0
|
343 |
MAudioGainControl* gaincontrol = static_cast<MAudioGainControl*>(ptr);
|
sl@0
|
344 |
if (iGainControl && gaincontrol)
|
sl@0
|
345 |
{
|
sl@0
|
346 |
RArray<TAudioChannelGain> channels;
|
sl@0
|
347 |
TInt err = gaincontrol->GetGain(channels);
|
sl@0
|
348 |
if (channels.Count() != 0 )
|
sl@0
|
349 |
{
|
sl@0
|
350 |
err = iGainControl->SetGain(channels);
|
sl@0
|
351 |
gainUpdated = ETrue;
|
sl@0
|
352 |
}
|
sl@0
|
353 |
channels.Close();
|
sl@0
|
354 |
}
|
sl@0
|
355 |
}
|
sl@0
|
356 |
|
sl@0
|
357 |
TBool invokeCodecCallbacks = EFalse;
|
sl@0
|
358 |
bit = messageType & EComponentAlterationCodec;
|
sl@0
|
359 |
if ( (err == KErrNone) && (bit != 0) && configCodec && (iCurrentStreamState == EInitialized) )
|
sl@0
|
360 |
{
|
sl@0
|
361 |
//codec loading actually configures sample rate and mode
|
sl@0
|
362 |
ASSERT(iCodec);
|
sl@0
|
363 |
err = iCodec->Load(iSampleRateConfig, iModeConfig);
|
sl@0
|
364 |
iIsCodecConfig = (err == KErrNone);
|
sl@0
|
365 |
invokeCodecCallbacks = ETrue;
|
sl@0
|
366 |
if ( err != KErrNone )
|
sl@0
|
367 |
{
|
sl@0
|
368 |
//get back to previous values in case of error
|
sl@0
|
369 |
iSampleRateConfig = iCurrentChain->GetSampleRate();
|
sl@0
|
370 |
iModeConfig = iCurrentChain->GetMode();
|
sl@0
|
371 |
}
|
sl@0
|
372 |
}
|
sl@0
|
373 |
|
sl@0
|
374 |
// Component destruction
|
sl@0
|
375 |
bit = messageType & EComponentDestruction;
|
sl@0
|
376 |
if( (err == KErrNone) && (bit != 0) )
|
sl@0
|
377 |
{
|
sl@0
|
378 |
DeletePhysicalComponents();
|
sl@0
|
379 |
}
|
sl@0
|
380 |
|
sl@0
|
381 |
TUint isStopping = aFlags & KServerStopping;
|
sl@0
|
382 |
TUint preemptionRequest = aFlags & KPreemptionRequest;
|
sl@0
|
383 |
|
sl@0
|
384 |
// HERE WE CAN GUARANTEE THAT THE REQUEST IS SUCCESFUL
|
sl@0
|
385 |
// Notify context
|
sl@0
|
386 |
// 1ST CALLBACK
|
sl@0
|
387 |
if(!preemptionRequest)
|
sl@0
|
388 |
{
|
sl@0
|
389 |
mmrcObserver->ReceiveResourceUpdate(&aDesiredChain, KErrNone);
|
sl@0
|
390 |
}
|
sl@0
|
391 |
else
|
sl@0
|
392 |
{
|
sl@0
|
393 |
mmrcObserver->ReceivePreemptionUpdate(&aDesiredChain, err);
|
sl@0
|
394 |
}
|
sl@0
|
395 |
|
sl@0
|
396 |
// Processing unit callbacks
|
sl@0
|
397 |
// Gain control
|
sl@0
|
398 |
// Note that due to error checking before applying any change
|
sl@0
|
399 |
// this callback always returned the error obtained by calling SetGain
|
sl@0
|
400 |
// or KErrNone
|
sl@0
|
401 |
if(gainUpdated)
|
sl@0
|
402 |
{
|
sl@0
|
403 |
if (iGainControl)
|
sl@0
|
404 |
{
|
sl@0
|
405 |
iGainControl->IssueGainChangedCallBack(err);
|
sl@0
|
406 |
}
|
sl@0
|
407 |
}
|
sl@0
|
408 |
|
sl@0
|
409 |
// Stream
|
sl@0
|
410 |
if(invokeStateEventCallback)
|
sl@0
|
411 |
{
|
sl@0
|
412 |
invokeStateEventCallback = EFalse;
|
sl@0
|
413 |
for ( TUint idx(0); idx < iAudioStreamObservers.Count(); idx++ )
|
sl@0
|
414 |
{
|
sl@0
|
415 |
if ( !isStopping )
|
sl@0
|
416 |
{
|
sl@0
|
417 |
iAudioStreamObservers[idx]->StateEvent(err, iCurrentStreamState);
|
sl@0
|
418 |
}
|
sl@0
|
419 |
}
|
sl@0
|
420 |
}
|
sl@0
|
421 |
if( invokeCodecCallbacks && (iCurrentStreamState == EInitialized) )
|
sl@0
|
422 |
{
|
sl@0
|
423 |
TInt count = iAudioCodecObservers.Count();
|
sl@0
|
424 |
for ( TInt idx = 0; idx < count; idx++ )
|
sl@0
|
425 |
{
|
sl@0
|
426 |
//TODO replace this functionality with the new mmrc
|
sl@0
|
427 |
iAudioCodecObservers[idx]->SampleRateSet(err);
|
sl@0
|
428 |
iAudioCodecObservers[idx]->ModeSet(err);
|
sl@0
|
429 |
}
|
sl@0
|
430 |
}
|
sl@0
|
431 |
|
sl@0
|
432 |
// Now has no effect on context
|
sl@0
|
433 |
// But it's needed to let the MMRC know about the operation being completed
|
sl@0
|
434 |
// and in such way let it to know that
|
sl@0
|
435 |
for ( TUint idx(0); idx < iAudioStreamObservers.Count(); idx++ )
|
sl@0
|
436 |
{
|
sl@0
|
437 |
if ( !isStopping )
|
sl@0
|
438 |
{
|
sl@0
|
439 |
iAudioStreamObservers[idx]->PhysicalAdaptationEvent(EOperationComplete, err);
|
sl@0
|
440 |
}
|
sl@0
|
441 |
}
|
sl@0
|
442 |
|
sl@0
|
443 |
// Don't need to send last callback sync
|
sl@0
|
444 |
// Let MMRC do it
|
sl@0
|
445 |
|
sl@0
|
446 |
DP0_RET(err, "%d");
|
sl@0
|
447 |
}
|
sl@0
|
448 |
|
sl@0
|
449 |
// ---------------------------------------------------------------------------
|
sl@0
|
450 |
// CAudioStream::DeletePhysicalComponents
|
sl@0
|
451 |
// ---------------------------------------------------------------------------
|
sl@0
|
452 |
void CAudioStream::DeletePhysicalComponents()
|
sl@0
|
453 |
{
|
sl@0
|
454 |
DP_CONTEXT(CAudioStream::DeletePhysicalComponents *CD0*, CtxDevSound, DPLOCAL);
|
sl@0
|
455 |
DP_IN();
|
sl@0
|
456 |
if(iBufferSource)
|
sl@0
|
457 |
{
|
sl@0
|
458 |
delete iBufferSource;
|
sl@0
|
459 |
iBufferSource = NULL;
|
sl@0
|
460 |
}
|
sl@0
|
461 |
if(iBufferSink)
|
sl@0
|
462 |
{
|
sl@0
|
463 |
delete iBufferSink;
|
sl@0
|
464 |
iBufferSink = NULL;
|
sl@0
|
465 |
}
|
sl@0
|
466 |
if(iCodec)
|
sl@0
|
467 |
{
|
sl@0
|
468 |
delete iCodec;
|
sl@0
|
469 |
iCodec = NULL;
|
sl@0
|
470 |
iIsCodecConfig = EFalse;
|
sl@0
|
471 |
}
|
sl@0
|
472 |
if(iGainControl)
|
sl@0
|
473 |
{
|
sl@0
|
474 |
delete iGainControl;
|
sl@0
|
475 |
iGainControl = NULL;
|
sl@0
|
476 |
}
|
sl@0
|
477 |
if(iDeviceSource)
|
sl@0
|
478 |
{
|
sl@0
|
479 |
delete iDeviceSource;
|
sl@0
|
480 |
iDeviceSource = NULL;
|
sl@0
|
481 |
}
|
sl@0
|
482 |
if(iDeviceSink)
|
sl@0
|
483 |
{
|
sl@0
|
484 |
delete iDeviceSink;
|
sl@0
|
485 |
iDeviceSink= NULL;
|
sl@0
|
486 |
}
|
sl@0
|
487 |
DP_OUT();
|
sl@0
|
488 |
}
|
sl@0
|
489 |
|
sl@0
|
490 |
|
sl@0
|
491 |
// ---------------------------------------------------------------------------
|
sl@0
|
492 |
// CAudioStream::CreatePhysicalComponents
|
sl@0
|
493 |
// ---------------------------------------------------------------------------
|
sl@0
|
494 |
TInt CAudioStream::CreatePhysicalComponents(MLogicalChain& aDesiredChain)
|
sl@0
|
495 |
{
|
sl@0
|
496 |
DP_CONTEXT(CAudioStream::CreatePhysicalComponents *CD0*, CtxDevSound, DPLOCAL);
|
sl@0
|
497 |
DP_IN();
|
sl@0
|
498 |
|
sl@0
|
499 |
TInt err = KErrNone;
|
sl@0
|
500 |
TInt units = aDesiredChain.AudioProcessingUnitsCount();
|
sl@0
|
501 |
TInt index=0;
|
sl@0
|
502 |
TUid typeId;
|
sl@0
|
503 |
|
sl@0
|
504 |
for (index=0; index < units ; index++)
|
sl@0
|
505 |
{
|
sl@0
|
506 |
typeId = aDesiredChain.AudioProcessingUnitUid(index);
|
sl@0
|
507 |
|
sl@0
|
508 |
// By the moment all components
|
sl@0
|
509 |
if (err == KErrNone)
|
sl@0
|
510 |
{
|
sl@0
|
511 |
if (typeId == KUidAudioDecoder || typeId == KUidAudioEncoder )
|
sl@0
|
512 |
{
|
sl@0
|
513 |
if(!iCodec)
|
sl@0
|
514 |
{
|
sl@0
|
515 |
TRAP(err, iCodec = CAudioCodec::NewL(typeId, *iFourCCConvertor ));
|
sl@0
|
516 |
iIsCodecConfig = EFalse;
|
sl@0
|
517 |
iCodec->RegisterAudioCodecObserver(*this);
|
sl@0
|
518 |
TAny* ptr = GetComponent(KUidAudioCodecAdaptationObserver);
|
sl@0
|
519 |
MAudioCodecAdaptationObserver* observer = static_cast<MAudioCodecAdaptationObserver*>(ptr);
|
sl@0
|
520 |
if(observer)
|
sl@0
|
521 |
{
|
sl@0
|
522 |
iCodec->RegisterAudioCodecObserver(*observer);
|
sl@0
|
523 |
}
|
sl@0
|
524 |
// For HW custom interface
|
sl@0
|
525 |
aDesiredChain.SetCustomInterfaceProvider(*iCodec);
|
sl@0
|
526 |
}
|
sl@0
|
527 |
if(iGainControl)
|
sl@0
|
528 |
{
|
sl@0
|
529 |
iGainControl->SetHelper(*iCodec);
|
sl@0
|
530 |
}
|
sl@0
|
531 |
// This mechanism is temporary and must be replaced
|
sl@0
|
532 |
// with the Extension mechanism when the MMRC server
|
sl@0
|
533 |
aDesiredChain.SetStreamPositionControl(*iCodec);
|
sl@0
|
534 |
}
|
sl@0
|
535 |
else if (typeId == KUidMmfBufferSource)
|
sl@0
|
536 |
{
|
sl@0
|
537 |
if(!iBufferSource)
|
sl@0
|
538 |
{
|
sl@0
|
539 |
TRAP(err,iBufferSource = CBufferSource::NewL());
|
sl@0
|
540 |
// This mechanism is temporary and must be replaced
|
sl@0
|
541 |
// with the Extension mechanism when the MMRC server
|
sl@0
|
542 |
aDesiredChain.SetAdaptationSource(*iBufferSource);
|
sl@0
|
543 |
/*
|
sl@0
|
544 |
TAny* ptr = aDesiredChain.GetComponent(KUidMmfBufferSource);
|
sl@0
|
545 |
MMMFAudioDataSupplier* supplier = static_cast<MMMFAudioDataSupplier*>(ptr);
|
sl@0
|
546 |
if(supplier)
|
sl@0
|
547 |
{
|
sl@0
|
548 |
iBufferSource->SetDataSupplier(*supplier);
|
sl@0
|
549 |
}
|
sl@0
|
550 |
*/
|
sl@0
|
551 |
}
|
sl@0
|
552 |
}
|
sl@0
|
553 |
else if (typeId == KUidMmfBufferSink)
|
sl@0
|
554 |
{
|
sl@0
|
555 |
if(!iBufferSink)
|
sl@0
|
556 |
{
|
sl@0
|
557 |
TRAP(err, iBufferSink = CBufferSink::NewL());
|
sl@0
|
558 |
// This mechanism is temporary and must be replaced
|
sl@0
|
559 |
// with the Extension mechanism when the MMRC server
|
sl@0
|
560 |
aDesiredChain.SetAdaptationSink(*iBufferSink);
|
sl@0
|
561 |
}
|
sl@0
|
562 |
}
|
sl@0
|
563 |
else if (typeId == KUidAudioGainControl)
|
sl@0
|
564 |
{
|
sl@0
|
565 |
if(!iGainControl)
|
sl@0
|
566 |
{
|
sl@0
|
567 |
// This mechanism is temporary and must be replaced
|
sl@0
|
568 |
// with the Extension mechanism when the MMRC server
|
sl@0
|
569 |
TRAP(err, iGainControl = CAudioGainControl::NewL());
|
sl@0
|
570 |
aDesiredChain.SetAdaptationGainControl(*iGainControl);
|
sl@0
|
571 |
}
|
sl@0
|
572 |
}
|
sl@0
|
573 |
else if (typeId == KUidAudioDeviceSink)
|
sl@0
|
574 |
{
|
sl@0
|
575 |
if(!iDeviceSink)
|
sl@0
|
576 |
{
|
sl@0
|
577 |
TRAP(err, iDeviceSink = CAudioDeviceSink::NewL());
|
sl@0
|
578 |
}
|
sl@0
|
579 |
}
|
sl@0
|
580 |
else if (typeId == KUidAudioDeviceSource)
|
sl@0
|
581 |
{
|
sl@0
|
582 |
if(!iDeviceSource)
|
sl@0
|
583 |
{
|
sl@0
|
584 |
TRAP(err, iDeviceSource = CAudioDeviceSource::NewL());
|
sl@0
|
585 |
}
|
sl@0
|
586 |
}
|
sl@0
|
587 |
else
|
sl@0
|
588 |
{
|
sl@0
|
589 |
err = KErrNotSupported;
|
sl@0
|
590 |
}
|
sl@0
|
591 |
}
|
sl@0
|
592 |
|
sl@0
|
593 |
// Notify the observers
|
sl@0
|
594 |
for ( TUint idx(0); idx < iAudioStreamObservers.Count(); idx++ )
|
sl@0
|
595 |
{
|
sl@0
|
596 |
iAudioStreamObservers[idx]->AddProcessingUnitComplete(typeId, err);
|
sl@0
|
597 |
}
|
sl@0
|
598 |
}
|
sl@0
|
599 |
DP0_RET(err, "%d");
|
sl@0
|
600 |
}
|
sl@0
|
601 |
|
sl@0
|
602 |
// ---------------------------------------------------------------------------
|
sl@0
|
603 |
// CAudioStream::CreateDataPath
|
sl@0
|
604 |
// ---------------------------------------------------------------------------
|
sl@0
|
605 |
TInt CAudioStream::CreateDataPath()
|
sl@0
|
606 |
{
|
sl@0
|
607 |
DP_CONTEXT(CAudioStream::CreateDataPath *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
608 |
DP_IN();
|
sl@0
|
609 |
TInt err(KErrNotReady);
|
sl@0
|
610 |
|
sl@0
|
611 |
if(iBufferSource && iCodec) // && iSink && iGain)
|
sl@0
|
612 |
{
|
sl@0
|
613 |
// TMode == Decode
|
sl@0
|
614 |
if(KErrNone == iBufferSource->GetOutputPort(iOutputport) && KErrNone == iCodec->GetInputPort(iInputport))
|
sl@0
|
615 |
{
|
sl@0
|
616 |
iOutputport->SetInput(iInputport);
|
sl@0
|
617 |
iInputport->SetOutput(iOutputport);
|
sl@0
|
618 |
err = KErrNone;
|
sl@0
|
619 |
}
|
sl@0
|
620 |
}
|
sl@0
|
621 |
else if(iBufferSink && iCodec) // && iSink && iGain)
|
sl@0
|
622 |
{
|
sl@0
|
623 |
//TMode == Encode
|
sl@0
|
624 |
if(KErrNone == iCodec->GetOutputPort(iOutputport) && KErrNone == iBufferSink->GetInputPort(iInputport))
|
sl@0
|
625 |
{
|
sl@0
|
626 |
iOutputport->SetInput(iInputport);
|
sl@0
|
627 |
iInputport->SetOutput(iOutputport);
|
sl@0
|
628 |
err = KErrNone;
|
sl@0
|
629 |
}
|
sl@0
|
630 |
}
|
sl@0
|
631 |
DP0_RET(err, "%d");
|
sl@0
|
632 |
}
|
sl@0
|
633 |
|
sl@0
|
634 |
// ---------------------------------------------------------------------------
|
sl@0
|
635 |
// CAudioStream::DemolishDataPath
|
sl@0
|
636 |
// ---------------------------------------------------------------------------
|
sl@0
|
637 |
//
|
sl@0
|
638 |
TInt CAudioStream::DemolishDataPath()
|
sl@0
|
639 |
{
|
sl@0
|
640 |
DP_CONTEXT(CAudioStream::DemolishDataPath *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
641 |
DP_IN();
|
sl@0
|
642 |
iOutputport->RemoveInput(iInputport);
|
sl@0
|
643 |
iInputport->RemoveOutput(iOutputport);
|
sl@0
|
644 |
DP0_RET(KErrNone, "%d");
|
sl@0
|
645 |
}
|
sl@0
|
646 |
|
sl@0
|
647 |
// ---------------------------------------------------------------------------
|
sl@0
|
648 |
// CAudioStream::ChangeState
|
sl@0
|
649 |
// ---------------------------------------------------------------------------
|
sl@0
|
650 |
TInt CAudioStream::ChangeState(TAudioState aPreviousState, TAudioState aDesiredState)
|
sl@0
|
651 |
{
|
sl@0
|
652 |
DP_CONTEXT(CAudioStream::ChangeState *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
653 |
DP_IN();
|
sl@0
|
654 |
TInt err(KErrNone);
|
sl@0
|
655 |
iCurrentStreamState = aPreviousState;
|
sl@0
|
656 |
iDesiredStreamState = aDesiredState;
|
sl@0
|
657 |
|
sl@0
|
658 |
// Ensure that there is no dereference of a NULL pointer
|
sl@0
|
659 |
ASSERT(iDesiredStreamState < EInitialized || iDesiredStreamState > EActive || iCodec);
|
sl@0
|
660 |
|
sl@0
|
661 |
switch (iDesiredStreamState)
|
sl@0
|
662 |
{
|
sl@0
|
663 |
case EInitialized:
|
sl@0
|
664 |
{
|
sl@0
|
665 |
if (iCurrentStreamState == EUninitialized) //Initialize
|
sl@0
|
666 |
{
|
sl@0
|
667 |
err = CreateDataPath();
|
sl@0
|
668 |
if(err == KErrNone)
|
sl@0
|
669 |
{
|
sl@0
|
670 |
err = iCodec->Initialize();
|
sl@0
|
671 |
}
|
sl@0
|
672 |
}
|
sl@0
|
673 |
else if( iCurrentStreamState == EIdle ) //codec unload (actually, unconfig)
|
sl@0
|
674 |
{
|
sl@0
|
675 |
iIsCodecConfig = EFalse;
|
sl@0
|
676 |
err = KErrNone;
|
sl@0
|
677 |
}
|
sl@0
|
678 |
// Preemption
|
sl@0
|
679 |
// This A3F adaptation allows going from Active/Primed directly to initialised
|
sl@0
|
680 |
// otherwise reference MMRC would need to handle those transitions separately
|
sl@0
|
681 |
else if(iCurrentStreamState == EActive || iCurrentStreamState == EPrimed)
|
sl@0
|
682 |
{
|
sl@0
|
683 |
// To Idle
|
sl@0
|
684 |
err = iCodec->Stop();
|
sl@0
|
685 |
// To Initilised
|
sl@0
|
686 |
iIsCodecConfig = EFalse;
|
sl@0
|
687 |
}
|
sl@0
|
688 |
|
sl@0
|
689 |
if(err == KErrNone)
|
sl@0
|
690 |
{
|
sl@0
|
691 |
iCurrentStreamState = EInitialized;
|
sl@0
|
692 |
}
|
sl@0
|
693 |
break;
|
sl@0
|
694 |
}
|
sl@0
|
695 |
case EIdle:
|
sl@0
|
696 |
{
|
sl@0
|
697 |
if ( (iCurrentStreamState == EInitialized) && !iIsCodecConfig )
|
sl@0
|
698 |
{
|
sl@0
|
699 |
//codec loading actually configures sample rate and mode
|
sl@0
|
700 |
err = iCodec->Load(iSampleRateConfig, iModeConfig);
|
sl@0
|
701 |
iIsCodecConfig = (err == KErrNone);
|
sl@0
|
702 |
}
|
sl@0
|
703 |
else if (iCurrentStreamState == EActive)
|
sl@0
|
704 |
{
|
sl@0
|
705 |
err = iCodec->Stop();
|
sl@0
|
706 |
}
|
sl@0
|
707 |
else if (iCurrentStreamState == EPrimed)
|
sl@0
|
708 |
{
|
sl@0
|
709 |
err = iCodec->Stop();
|
sl@0
|
710 |
}
|
sl@0
|
711 |
|
sl@0
|
712 |
if(err == KErrNone)
|
sl@0
|
713 |
{
|
sl@0
|
714 |
iTimeProcessed = 0;
|
sl@0
|
715 |
iCurrentStreamState = EIdle;
|
sl@0
|
716 |
}
|
sl@0
|
717 |
break;
|
sl@0
|
718 |
}
|
sl@0
|
719 |
case EPrimed:
|
sl@0
|
720 |
{
|
sl@0
|
721 |
if (iCurrentStreamState == EIdle)
|
sl@0
|
722 |
{
|
sl@0
|
723 |
DP0(DLINFO,"============== Stream is going from EIdle -> PRIMED");
|
sl@0
|
724 |
DP0(DLINFO,"Nothing to be done");
|
sl@0
|
725 |
}
|
sl@0
|
726 |
else if (iCurrentStreamState == EActive)
|
sl@0
|
727 |
{
|
sl@0
|
728 |
DP0(DLINFO,"============== Stream is going from EActive -> PRIMED");
|
sl@0
|
729 |
err = iCodec->Pause();
|
sl@0
|
730 |
}
|
sl@0
|
731 |
if(err == KErrNone)
|
sl@0
|
732 |
{
|
sl@0
|
733 |
iCurrentStreamState = EPrimed;
|
sl@0
|
734 |
}
|
sl@0
|
735 |
break;
|
sl@0
|
736 |
}
|
sl@0
|
737 |
case EActive:
|
sl@0
|
738 |
{
|
sl@0
|
739 |
if (iCurrentStreamState == EPrimed) //Activate from Primed
|
sl@0
|
740 |
{
|
sl@0
|
741 |
// Reusing AudioCodec::Start for resuming
|
sl@0
|
742 |
DP0(DLINFO,"============== Stream is going from EPrimed -> ACTIVE");
|
sl@0
|
743 |
err = iCodec->Start();
|
sl@0
|
744 |
}
|
sl@0
|
745 |
else if(iCurrentStreamState == EIdle) //Activate from Idle
|
sl@0
|
746 |
{
|
sl@0
|
747 |
DP0(DLINFO,"============== Stream is going from EIdle -> ACTIVATE");
|
sl@0
|
748 |
err = iCodec->Start();
|
sl@0
|
749 |
}
|
sl@0
|
750 |
|
sl@0
|
751 |
if(err == KErrNone)
|
sl@0
|
752 |
{
|
sl@0
|
753 |
iCurrentStreamState = EActive;
|
sl@0
|
754 |
}
|
sl@0
|
755 |
break;
|
sl@0
|
756 |
}
|
sl@0
|
757 |
case EUninitialized:
|
sl@0
|
758 |
{
|
sl@0
|
759 |
err = DemolishDataPath();
|
sl@0
|
760 |
if(err == KErrNone)
|
sl@0
|
761 |
{
|
sl@0
|
762 |
iCurrentStreamState = EUninitialized;
|
sl@0
|
763 |
}
|
sl@0
|
764 |
break;
|
sl@0
|
765 |
}
|
sl@0
|
766 |
case EDead:
|
sl@0
|
767 |
{
|
sl@0
|
768 |
err = DemolishDataPath();
|
sl@0
|
769 |
if(err == KErrNone)
|
sl@0
|
770 |
{
|
sl@0
|
771 |
iCurrentStreamState = EDead;
|
sl@0
|
772 |
}
|
sl@0
|
773 |
break;
|
sl@0
|
774 |
}
|
sl@0
|
775 |
default:
|
sl@0
|
776 |
err = KErrNotSupported;
|
sl@0
|
777 |
DP1(DLINFO,"CAudioStream::ChangeState Unknown state! %d", iDesiredStreamState);
|
sl@0
|
778 |
break;
|
sl@0
|
779 |
}
|
sl@0
|
780 |
DP0_RET(err, "%d");
|
sl@0
|
781 |
}
|
sl@0
|
782 |
|
sl@0
|
783 |
TInt CAudioStream::FlushBuffers()
|
sl@0
|
784 |
{
|
sl@0
|
785 |
DP_CONTEXT(CAudioStream::FlushBuffers *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
786 |
DP_IN();
|
sl@0
|
787 |
|
sl@0
|
788 |
TInt err = KErrNone;
|
sl@0
|
789 |
|
sl@0
|
790 |
MOutputPort* outPort= static_cast<MOutputPort*>(iCodec);
|
sl@0
|
791 |
if(outPort)
|
sl@0
|
792 |
{
|
sl@0
|
793 |
outPort->FlushBuffer(this);
|
sl@0
|
794 |
}
|
sl@0
|
795 |
else
|
sl@0
|
796 |
{
|
sl@0
|
797 |
err = KErrNotReady;
|
sl@0
|
798 |
}
|
sl@0
|
799 |
err = KErrNone;
|
sl@0
|
800 |
DP0_RET(err, "%d");
|
sl@0
|
801 |
}
|
sl@0
|
802 |
|
sl@0
|
803 |
|
sl@0
|
804 |
void CAudioStream::FlushComplete(TInt aError)
|
sl@0
|
805 |
{
|
sl@0
|
806 |
DP_CONTEXT(CAudioStream::FlushComplete *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
807 |
DP_IN();
|
sl@0
|
808 |
TUint count = iAudioStreamObservers.Count();
|
sl@0
|
809 |
for ( TUint i(0); i < count; i++ )
|
sl@0
|
810 |
{
|
sl@0
|
811 |
iAudioStreamObservers[i]->FlushComplete(aError);
|
sl@0
|
812 |
}
|
sl@0
|
813 |
DP_OUT();
|
sl@0
|
814 |
}
|
sl@0
|
815 |
|
sl@0
|
816 |
void CAudioStream::AllBuffersProcessed()
|
sl@0
|
817 |
{
|
sl@0
|
818 |
DP_CONTEXT(CAudioStream::AllBuffersProcessed *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
819 |
DP_IN();
|
sl@0
|
820 |
TUint count = iAudioStreamObservers.Count();
|
sl@0
|
821 |
for ( TUint i(0); i < count; i++ )
|
sl@0
|
822 |
{
|
sl@0
|
823 |
iAudioStreamObservers[i]->ProcessingFinished();
|
sl@0
|
824 |
}
|
sl@0
|
825 |
DP_OUT();
|
sl@0
|
826 |
}
|
sl@0
|
827 |
|
sl@0
|
828 |
void CAudioStream::ProcessingUnitError(TInt /*aError*/)
|
sl@0
|
829 |
{
|
sl@0
|
830 |
DP_CONTEXT(CAudioStream::ProcessingUnitError *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
831 |
DP_IN();
|
sl@0
|
832 |
DP_OUT();
|
sl@0
|
833 |
}
|
sl@0
|
834 |
|
sl@0
|
835 |
// ---------------------------------------------------------------------------
|
sl@0
|
836 |
// CAudioStream::RegisterAudioCodecObserver
|
sl@0
|
837 |
// ---------------------------------------------------------------------------
|
sl@0
|
838 |
TInt CAudioStream::RegisterAudioCodecObserver(MAudioCodecObserver& aObserver)
|
sl@0
|
839 |
{
|
sl@0
|
840 |
DP_CONTEXT(CAudioStream::RegisterAudioCodecObserver *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
841 |
DP_IN();
|
sl@0
|
842 |
TInt err = iAudioCodecObservers.Find(&aObserver);
|
sl@0
|
843 |
if(err == KErrNotFound)
|
sl@0
|
844 |
{
|
sl@0
|
845 |
err = iAudioCodecObservers.Append(&aObserver);
|
sl@0
|
846 |
}
|
sl@0
|
847 |
else
|
sl@0
|
848 |
{
|
sl@0
|
849 |
err = KErrAlreadyExists;
|
sl@0
|
850 |
}
|
sl@0
|
851 |
DP0_RET(err, "%d");
|
sl@0
|
852 |
}
|
sl@0
|
853 |
|
sl@0
|
854 |
// ---------------------------------------------------------------------------
|
sl@0
|
855 |
// CAudioStream::UnregisterAudioCodecObserver
|
sl@0
|
856 |
// ---------------------------------------------------------------------------
|
sl@0
|
857 |
void CAudioStream::UnregisterAudioCodecObserver(MAudioCodecObserver& aObserver)
|
sl@0
|
858 |
{
|
sl@0
|
859 |
DP_CONTEXT(CAudioStream::UnregisterAudioCodecObserver *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
860 |
DP_IN();
|
sl@0
|
861 |
TInt idxOrErr = iAudioCodecObservers.Find(&aObserver);
|
sl@0
|
862 |
if( idxOrErr != KErrNotFound )
|
sl@0
|
863 |
{
|
sl@0
|
864 |
iAudioCodecObservers.Remove(idxOrErr);
|
sl@0
|
865 |
}
|
sl@0
|
866 |
DP_OUT();
|
sl@0
|
867 |
}
|
sl@0
|
868 |
|
sl@0
|
869 |
void CAudioStream::GetSupportedAModesComplete(TInt /*aError*/)
|
sl@0
|
870 |
{
|
sl@0
|
871 |
DP_CONTEXT(CAudioStream::GetSupportedAModesComplete *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
872 |
DP_IN();
|
sl@0
|
873 |
DP_OUT();
|
sl@0
|
874 |
}
|
sl@0
|
875 |
|
sl@0
|
876 |
void CAudioStream::GetSupportedARatesComplete(TInt /*aError*/)
|
sl@0
|
877 |
{
|
sl@0
|
878 |
DP_CONTEXT(CAudioStream::GetSupportedARatesComplete *CD1*, CtxDevSound, DPLOCAL);
|
sl@0
|
879 |
DP_IN();
|
sl@0
|
880 |
DP_OUT();
|
sl@0
|
881 |
}
|
sl@0
|
882 |
|
sl@0
|
883 |
// ---------------------------------------------------------------------------
|
sl@0
|
884 |
// CAudioStream::GetSupportedSampleRates
|
sl@0
|
885 |
// ---------------------------------------------------------------------------
|
sl@0
|
886 |
TInt CAudioStream::GetSupportedSampleRates(RArray<TInt>& aSupportedRates)
|
sl@0
|
887 |
{
|
sl@0
|
888 |
TInt err = (KErrNotReady);
|
sl@0
|
889 |
err = iCodec->SupportedRates(aSupportedRates);
|
sl@0
|
890 |
return err;
|
sl@0
|
891 |
}
|
sl@0
|
892 |
|
sl@0
|
893 |
// ---------------------------------------------------------------------------
|
sl@0
|
894 |
// CAudioStream::GetSupportedModes
|
sl@0
|
895 |
// ---------------------------------------------------------------------------
|
sl@0
|
896 |
TInt CAudioStream::GetSupportedModes(RArray<TUid>& aSupportedModes)
|
sl@0
|
897 |
{
|
sl@0
|
898 |
TInt err = (KErrNotReady);
|
sl@0
|
899 |
err = iCodec->SupportedModes(aSupportedModes);
|
sl@0
|
900 |
return err;
|
sl@0
|
901 |
}
|
sl@0
|
902 |
|
sl@0
|
903 |
// end of file
|