sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
*
|
sl@0
|
16 |
*/
|
sl@0
|
17 |
|
sl@0
|
18 |
|
sl@0
|
19 |
|
sl@0
|
20 |
#ifndef LOGICALAUDIOSTREAM_H
|
sl@0
|
21 |
#define LOGICALAUDIOSTREAM_H
|
sl@0
|
22 |
|
sl@0
|
23 |
#include <e32base.h>
|
sl@0
|
24 |
#include <a3f/a3f_trace_utils.h>
|
sl@0
|
25 |
#include <a3f/audioprocessingunittypeuids.h>
|
sl@0
|
26 |
#include <a3f/a3fbase.h>
|
sl@0
|
27 |
|
sl@0
|
28 |
#include <a3f/maudioprocessingunitobserver.h>
|
sl@0
|
29 |
#include <a3f/maudiostreamobserver.h>
|
sl@0
|
30 |
|
sl@0
|
31 |
#include "componentparameters.h"
|
sl@0
|
32 |
#include "audiostreammanager.h"
|
sl@0
|
33 |
|
sl@0
|
34 |
#include <a3f/msynccisupport.h>
|
sl@0
|
35 |
#include "../shared/a3fbackdooraccess.h"
|
sl@0
|
36 |
#include "../audiocontext/audiocontext.h"
|
sl@0
|
37 |
|
sl@0
|
38 |
// TO BE REMOVED WHEN MMRC SERVER IS READY
|
sl@0
|
39 |
#include "mlogicalchain.h"
|
sl@0
|
40 |
#include "maudiostreamadaptationobserver.h"
|
sl@0
|
41 |
#include "maudiocodecadaptationobserver.h"
|
sl@0
|
42 |
|
sl@0
|
43 |
#include <a3f/maudiocodecobserver.h>
|
sl@0
|
44 |
|
sl@0
|
45 |
#include "mstreambuffercontrol.h"
|
sl@0
|
46 |
|
sl@0
|
47 |
|
sl@0
|
48 |
class MLogicalSettingObserver;
|
sl@0
|
49 |
class CLogicalAudioCodec;
|
sl@0
|
50 |
class CLogicalAudioGainControl;
|
sl@0
|
51 |
class CLogicalBufferSource;
|
sl@0
|
52 |
class CLogicalBufferSink;
|
sl@0
|
53 |
class CLogicalAudioDeviceSink;
|
sl@0
|
54 |
class CLogicalAudioDeviceSource;
|
sl@0
|
55 |
|
sl@0
|
56 |
|
sl@0
|
57 |
/**
|
sl@0
|
58 |
This is the implementation of audio stream API.
|
sl@0
|
59 |
@see MAudioStream
|
sl@0
|
60 |
*/
|
sl@0
|
61 |
|
sl@0
|
62 |
NONSHARABLE_CLASS(CLogicalAudioStream) : public CAudioStreamManager,
|
sl@0
|
63 |
public MCustomInterfaceSupport,
|
sl@0
|
64 |
public MCustomInterfaceSupportObserver,
|
sl@0
|
65 |
public MAudioStreamAdaptationObserver,
|
sl@0
|
66 |
public MLogicalChain,
|
sl@0
|
67 |
public MAudioCodecObserver,
|
sl@0
|
68 |
public MA3FBackdoorAccessIf
|
sl@0
|
69 |
{
|
sl@0
|
70 |
friend class CAudioContext;
|
sl@0
|
71 |
|
sl@0
|
72 |
public:
|
sl@0
|
73 |
/**
|
sl@0
|
74 |
Destructor.
|
sl@0
|
75 |
|
sl@0
|
76 |
Deletes all objects and releases all resource owned by this instance.
|
sl@0
|
77 |
*/
|
sl@0
|
78 |
virtual ~CLogicalAudioStream();
|
sl@0
|
79 |
|
sl@0
|
80 |
// from MAudioStream
|
sl@0
|
81 |
virtual TInt Initialize();
|
sl@0
|
82 |
virtual TInt Load();
|
sl@0
|
83 |
virtual TInt Activate();
|
sl@0
|
84 |
virtual TInt Stop();
|
sl@0
|
85 |
virtual TInt Unload();
|
sl@0
|
86 |
virtual TInt Uninitialize();
|
sl@0
|
87 |
virtual TInt Prime();
|
sl@0
|
88 |
virtual TInt Flush();
|
sl@0
|
89 |
|
sl@0
|
90 |
virtual TInt AddSource(MAudioProcessingUnit* aSource);
|
sl@0
|
91 |
virtual TInt AddSink(MAudioProcessingUnit* aSink);
|
sl@0
|
92 |
virtual TInt AddAudioCodec(MAudioProcessingUnit* aCodec);
|
sl@0
|
93 |
virtual TInt AddGainControl(MAudioProcessingUnit* aGainControl);
|
sl@0
|
94 |
virtual TInt RemoveProcessingUnit(MAudioProcessingUnit* aProcessingUnit);
|
sl@0
|
95 |
virtual TInt ResetStreamTime();
|
sl@0
|
96 |
virtual TInt GetStreamTime(TTimeIntervalMicroSeconds& aStreamTime);
|
sl@0
|
97 |
virtual TAny* Interface(TUid aType);
|
sl@0
|
98 |
|
sl@0
|
99 |
// from MCustomInterfaceSupport
|
sl@0
|
100 |
virtual TInt RequestCustomInterface(TUid aUid, TAny*& aPtr);
|
sl@0
|
101 |
virtual TInt RegisterObserver(MCustomInterfaceSupportObserver& aObserver);
|
sl@0
|
102 |
virtual void UnRegisterObserver(MCustomInterfaceSupportObserver& aObserver);
|
sl@0
|
103 |
|
sl@0
|
104 |
// from MCustomInterfaceSupportObserver
|
sl@0
|
105 |
virtual void CustomInterfaceRemoval(TUid aInterfaceUid, TAny* aPtr);
|
sl@0
|
106 |
|
sl@0
|
107 |
// from MAudioStreamAdaptationObserver
|
sl@0
|
108 |
void PhysicalAdaptationEvent(TPhysicalEvent aEvent, TInt aError);
|
sl@0
|
109 |
void StateEvent(TInt aReason, TAudioState aNewState);
|
sl@0
|
110 |
void AddProcessingUnitComplete(TUid aType, TInt aError);
|
sl@0
|
111 |
void RemoveProcessingUnitComplete(TUid aType, TInt aError);
|
sl@0
|
112 |
void ProcessingFinished ();
|
sl@0
|
113 |
void FlushComplete (TInt aError);
|
sl@0
|
114 |
|
sl@0
|
115 |
// from MLogicalChain
|
sl@0
|
116 |
void SetMessageType(TMMRCMessageType aMessageType);
|
sl@0
|
117 |
void ResetMessage();
|
sl@0
|
118 |
TUint MessageType();
|
sl@0
|
119 |
TUid AudioProcessingUnitUid(TInt aIndex);
|
sl@0
|
120 |
TInt AudioProcessingUnitsCount();
|
sl@0
|
121 |
TAudioState StreamState();
|
sl@0
|
122 |
void SetStreamState(TAudioState aState);
|
sl@0
|
123 |
TUid CodecFormat();
|
sl@0
|
124 |
TInt GetSampleRate();
|
sl@0
|
125 |
TUid GetMode();
|
sl@0
|
126 |
TInt Priority();
|
sl@0
|
127 |
void GetVolumeRampParameters(TUid& aRampOperation, TTimeIntervalMicroSeconds& aRampDuration);
|
sl@0
|
128 |
MLogicalChain* CloneL();
|
sl@0
|
129 |
void Release();
|
sl@0
|
130 |
TAny* GetComponent(TUid aType);
|
sl@0
|
131 |
|
sl@0
|
132 |
void CopySettings(const MLogicalChain& aChain);
|
sl@0
|
133 |
void SetAdaptationSource(MMMFBufferSource& aSource);
|
sl@0
|
134 |
void SetAdaptationSink(MMMFBufferSink& aSink);
|
sl@0
|
135 |
void SetAdaptationGainControl(MAudioGainControl& aGain);
|
sl@0
|
136 |
void SetStreamPositionControl(MStreamPositionControl& aControl );
|
sl@0
|
137 |
void SetCustomInterfaceProvider(MCustomInterfaceSupport& aControl);
|
sl@0
|
138 |
void SetCodecConfiguration(RArray<TInt> aSampleRate, RArray<TUid> aMode);
|
sl@0
|
139 |
void SetAdaptationStream(MConfigurationHelper& aStream);
|
sl@0
|
140 |
void SetStreamBufferControl(MStreamBufferControl& aStreamBufferControl);
|
sl@0
|
141 |
|
sl@0
|
142 |
// from MAudioCodecObserver
|
sl@0
|
143 |
void SampleRateSet(TInt aError);
|
sl@0
|
144 |
void ModeSet(TInt aError);
|
sl@0
|
145 |
void GetSupportedSampleRatesComplete (TInt aError);
|
sl@0
|
146 |
void GetSupportedModesComplete (TInt aError);
|
sl@0
|
147 |
|
sl@0
|
148 |
// from MA3FBackdoorAccessIf
|
sl@0
|
149 |
MAudioContext* AudioContext();
|
sl@0
|
150 |
MAudioStream* AudioStream();
|
sl@0
|
151 |
MAudioProcessingUnit* ProcessingUnit(TUid aType);
|
sl@0
|
152 |
|
sl@0
|
153 |
/**
|
sl@0
|
154 |
Create a new instance.
|
sl@0
|
155 |
|
sl@0
|
156 |
@param aStream the stream implementation. Ownership of the pointer is transferred to the
|
sl@0
|
157 |
create CAudioStream object instance.
|
sl@0
|
158 |
@return CAudioStreamComponent* a pointer to the created instance.
|
sl@0
|
159 |
*/
|
sl@0
|
160 |
static CLogicalAudioStream* NewL(TUid aTypeId);
|
sl@0
|
161 |
|
sl@0
|
162 |
//Get functions for configuration
|
sl@0
|
163 |
void GetSupportedSampleRates(RArray<TInt>& aSupportedRates);
|
sl@0
|
164 |
void GetSupportedModes(RArray<TUid>& aSupportedModes);
|
sl@0
|
165 |
|
sl@0
|
166 |
virtual void SetParentContext(const CAudioContext& aContext);
|
sl@0
|
167 |
|
sl@0
|
168 |
protected:
|
sl@0
|
169 |
// Internal method
|
sl@0
|
170 |
void MapUidToProcessingUnit(TUid aType, MAudioProcessingUnit*& aInstance);
|
sl@0
|
171 |
|
sl@0
|
172 |
void CopyStreamSettings(const MLogicalChain& aChain);
|
sl@0
|
173 |
void CopyCodecSettings(const MLogicalChain& aChain);
|
sl@0
|
174 |
void CopyGainSettings(const MLogicalChain& aChain);
|
sl@0
|
175 |
|
sl@0
|
176 |
private:
|
sl@0
|
177 |
|
sl@0
|
178 |
void ConstructL();
|
sl@0
|
179 |
CLogicalAudioStream();
|
sl@0
|
180 |
TInt DoAddProcessingUnit(MAudioProcessingUnit* aUnit);
|
sl@0
|
181 |
|
sl@0
|
182 |
private:
|
sl@0
|
183 |
// Time processed
|
sl@0
|
184 |
TTimeIntervalMicroSeconds iTimeProcessed;
|
sl@0
|
185 |
|
sl@0
|
186 |
// Audio processing units at this context
|
sl@0
|
187 |
RPointerArray<MAudioProcessingUnit> iAudioProcessingUnits;
|
sl@0
|
188 |
|
sl@0
|
189 |
// CI observers
|
sl@0
|
190 |
RPointerArray<MCustomInterfaceSupportObserver> iCISupportObservers;
|
sl@0
|
191 |
|
sl@0
|
192 |
// Stream state
|
sl@0
|
193 |
TAudioState iCurrentState;
|
sl@0
|
194 |
|
sl@0
|
195 |
TAudioState iRequestState;
|
sl@0
|
196 |
|
sl@0
|
197 |
// MLogical chain variables
|
sl@0
|
198 |
MAudioProcessingUnit* iCodec;
|
sl@0
|
199 |
|
sl@0
|
200 |
MAudioProcessingUnit* iGain;
|
sl@0
|
201 |
|
sl@0
|
202 |
// General pointer, useful to manage all the audioprocessingunit
|
sl@0
|
203 |
// never keeps specific information
|
sl@0
|
204 |
MAudioProcessingUnit* iAudioProcessingUnit;
|
sl@0
|
205 |
|
sl@0
|
206 |
// Adaptation interfaces
|
sl@0
|
207 |
MStreamPositionControl* iPositionControl;
|
sl@0
|
208 |
MStreamBufferControl* iStreamBufferControl;
|
sl@0
|
209 |
|
sl@0
|
210 |
MCustomInterfaceSupport* iInterfaceProvider;
|
sl@0
|
211 |
|
sl@0
|
212 |
// Message type
|
sl@0
|
213 |
TUint iMessageType;
|
sl@0
|
214 |
|
sl@0
|
215 |
TInt iContextPriority;
|
sl@0
|
216 |
|
sl@0
|
217 |
// handle back to parent context
|
sl@0
|
218 |
CAudioContext* iParentContext;
|
sl@0
|
219 |
};
|
sl@0
|
220 |
|
sl@0
|
221 |
#endif // LOGICALAUDIOSTREAM_H
|