sl@0
|
1 |
// Copyright (c) 2005-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 |
#ifndef AUDIODEVICE_H
|
sl@0
|
17 |
#define AUDIODEVICE_H
|
sl@0
|
18 |
|
sl@0
|
19 |
#include <e32msgqueue.h>
|
sl@0
|
20 |
#include <mdf/mdfprocessingunit.h>
|
sl@0
|
21 |
#include <mdf/mdfinputport.h>
|
sl@0
|
22 |
#include <mdf/mdfoutputport.h>
|
sl@0
|
23 |
#include <mmf/server/mmfhwdevicesetup.h>
|
sl@0
|
24 |
#include <mdf/mdfcommon.h>
|
sl@0
|
25 |
|
sl@0
|
26 |
#ifdef SYMBIAN_MDF_SHAREDCHUNK_SOUNDDRIVER
|
sl@0
|
27 |
#include "mdasoundadapter.h"
|
sl@0
|
28 |
#else
|
sl@0
|
29 |
#include <mdasound.h>
|
sl@0
|
30 |
#endif
|
sl@0
|
31 |
|
sl@0
|
32 |
class CMMFBuffer;
|
sl@0
|
33 |
|
sl@0
|
34 |
/*
|
sl@0
|
35 |
Audio Sink/Source processing unit
|
sl@0
|
36 |
*/
|
sl@0
|
37 |
class CAudioDevice : public CMdfProcessingUnit
|
sl@0
|
38 |
{
|
sl@0
|
39 |
public:
|
sl@0
|
40 |
/*
|
sl@0
|
41 |
Audio Sink/Source input port
|
sl@0
|
42 |
*/
|
sl@0
|
43 |
class CInputPort: public CActive,
|
sl@0
|
44 |
public MMdfInputPort,
|
sl@0
|
45 |
public MPlayCustomInterface
|
sl@0
|
46 |
{
|
sl@0
|
47 |
public:
|
sl@0
|
48 |
static CInputPort* NewL(CAudioDevice& aParent);
|
sl@0
|
49 |
|
sl@0
|
50 |
// from MMdfInputPort
|
sl@0
|
51 |
TInt MipConfigure(const TPuConfig& aConfiguration);
|
sl@0
|
52 |
TInt MipGetConfig(TPuConfig& aConfigurationSetup);
|
sl@0
|
53 |
void MipInitialize();
|
sl@0
|
54 |
void MipSetObserver(const MMdfInputPortObserver& aInputPortObserver);
|
sl@0
|
55 |
CMMFBuffer* MipCreateBuffer(TInt aBufferSize);
|
sl@0
|
56 |
TInt MipUseBuffer(CMMFBuffer& aBuffer);
|
sl@0
|
57 |
TInt MipFreeBuffer(CMMFBuffer* aBuffer);
|
sl@0
|
58 |
TInt MipTunnelRequest(const MMdfOutputPort& aOutputPortToBeConnectedTo,
|
sl@0
|
59 |
TTunnelFlags& aTunnelFlags, TSupplierType& aSupplierType);
|
sl@0
|
60 |
void MipWriteData(CMMFBuffer& aBuffer);
|
sl@0
|
61 |
void MipDisconnectTunnel();
|
sl@0
|
62 |
void MipRestartTunnel();
|
sl@0
|
63 |
TBool MipIsTunnelled() const;
|
sl@0
|
64 |
TInt MipIndex() const;
|
sl@0
|
65 |
TUint32 MipBufferSize() const;
|
sl@0
|
66 |
TInt MipCreateCustomInterface(TUid aUid);
|
sl@0
|
67 |
TAny* MipCustomInterface(TUid aUid);
|
sl@0
|
68 |
|
sl@0
|
69 |
// from MPlayCustomInterface
|
sl@0
|
70 |
void SetVolume(TUint aVolume);
|
sl@0
|
71 |
TUint Volume();
|
sl@0
|
72 |
TUint BytesPlayed();
|
sl@0
|
73 |
void SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration);
|
sl@0
|
74 |
TTimeIntervalMicroSeconds& VolumeRamp();
|
sl@0
|
75 |
TInt SampleRate();
|
sl@0
|
76 |
TInt Channels();
|
sl@0
|
77 |
|
sl@0
|
78 |
// from CActive
|
sl@0
|
79 |
void RunL();
|
sl@0
|
80 |
void DoCancel();
|
sl@0
|
81 |
|
sl@0
|
82 |
// CInputPort
|
sl@0
|
83 |
void Execute();
|
sl@0
|
84 |
void Pause();
|
sl@0
|
85 |
void Stop();
|
sl@0
|
86 |
~CInputPort();
|
sl@0
|
87 |
|
sl@0
|
88 |
private:
|
sl@0
|
89 |
explicit CInputPort(CAudioDevice& aParent);
|
sl@0
|
90 |
void ConstructL();
|
sl@0
|
91 |
private:
|
sl@0
|
92 |
CMMFBuffer* iCurrentBuffer;
|
sl@0
|
93 |
CAudioDevice& iParent;
|
sl@0
|
94 |
MMdfOutputPort* iPortConnectedTo;
|
sl@0
|
95 |
RPointerArray<CMMFBuffer> iBuffers;
|
sl@0
|
96 |
MMdfInputPortObserver* iObserver;
|
sl@0
|
97 |
TInt iSampleRate;
|
sl@0
|
98 |
TInt iChannels;
|
sl@0
|
99 |
TBool iInterleaved;
|
sl@0
|
100 |
TUint iVolume;
|
sl@0
|
101 |
TTimeIntervalMicroSeconds iRampDuration;
|
sl@0
|
102 |
TUint iBytesPlayed;
|
sl@0
|
103 |
TBool iPaused;
|
sl@0
|
104 |
TBool iStopped;
|
sl@0
|
105 |
TUint iBufferSize;
|
sl@0
|
106 |
};
|
sl@0
|
107 |
/*
|
sl@0
|
108 |
Audio Sink/Source output port
|
sl@0
|
109 |
*/
|
sl@0
|
110 |
class COutputPort: public CActive,
|
sl@0
|
111 |
public MMdfOutputPort,
|
sl@0
|
112 |
public MRecordCustomInterface
|
sl@0
|
113 |
{
|
sl@0
|
114 |
public:
|
sl@0
|
115 |
static COutputPort* NewL(CAudioDevice& aParent);
|
sl@0
|
116 |
|
sl@0
|
117 |
// from MMdfOutputPort
|
sl@0
|
118 |
TInt MopConfigure(const TPuConfig& aConfiguration);
|
sl@0
|
119 |
TInt MopGetConfig(TPuConfig& aConfigurationSetup);
|
sl@0
|
120 |
void MopInitialize();
|
sl@0
|
121 |
void MopSetObserver(const MMdfOutputPortObserver& aOutputPortObserver);
|
sl@0
|
122 |
CMMFBuffer* MopCreateBuffer(TInt aBufferSize);
|
sl@0
|
123 |
TInt MopUseBuffer(CMMFBuffer& aBuffer);
|
sl@0
|
124 |
TInt MopFreeBuffer(CMMFBuffer* aBuffer);
|
sl@0
|
125 |
TInt MopTunnelRequest(const MMdfInputPort& aInputPortToBeConnectedTo,
|
sl@0
|
126 |
TTunnelFlags& aTunnelFlags, TSupplierType& aSupplierType);
|
sl@0
|
127 |
void MopReadData(CMMFBuffer& aBuffer);
|
sl@0
|
128 |
void MopDisconnectTunnel();
|
sl@0
|
129 |
void MopRestartTunnel();
|
sl@0
|
130 |
TBool MopIsTunnelled() const;
|
sl@0
|
131 |
TInt MopIndex() const;
|
sl@0
|
132 |
TUint32 MopBufferSize() const;
|
sl@0
|
133 |
TInt MopCreateCustomInterface(TUid aUid);
|
sl@0
|
134 |
TAny* MopCustomInterface(TUid aUid);
|
sl@0
|
135 |
|
sl@0
|
136 |
// from MRecordCustomInterface
|
sl@0
|
137 |
void SetGain(TUint aGain);
|
sl@0
|
138 |
TUint Gain();
|
sl@0
|
139 |
TUint BytesRecorded();
|
sl@0
|
140 |
TInt SampleRate();
|
sl@0
|
141 |
TInt Channels();
|
sl@0
|
142 |
|
sl@0
|
143 |
// from CActive
|
sl@0
|
144 |
void RunL();
|
sl@0
|
145 |
void DoCancel();
|
sl@0
|
146 |
|
sl@0
|
147 |
// COutputPort
|
sl@0
|
148 |
~COutputPort();
|
sl@0
|
149 |
void Execute();
|
sl@0
|
150 |
void Pause();
|
sl@0
|
151 |
void Stop();
|
sl@0
|
152 |
|
sl@0
|
153 |
private:
|
sl@0
|
154 |
explicit COutputPort(CAudioDevice& aParent);
|
sl@0
|
155 |
void ConstructL();
|
sl@0
|
156 |
private:
|
sl@0
|
157 |
CMMFBuffer* iCurrentBuffer;
|
sl@0
|
158 |
CAudioDevice& iParent;
|
sl@0
|
159 |
RPointerArray<CMMFBuffer> iBuffers;
|
sl@0
|
160 |
MMdfOutputPortObserver* iObserver;
|
sl@0
|
161 |
MMdfInputPort* iPortConnectedTo;
|
sl@0
|
162 |
TInt iSampleRate;
|
sl@0
|
163 |
TInt iChannels;
|
sl@0
|
164 |
TBool iInterleaved;
|
sl@0
|
165 |
TUint iGain;
|
sl@0
|
166 |
TUint iBytesRecorded;
|
sl@0
|
167 |
TBool iPaused;
|
sl@0
|
168 |
TUint iBufferSize;
|
sl@0
|
169 |
};
|
sl@0
|
170 |
public:
|
sl@0
|
171 |
static CAudioDevice* NewL();
|
sl@0
|
172 |
// from CMdfProcessingUnit
|
sl@0
|
173 |
TInt Create(const MMdfProcessingUnitObserver& aProcessingUnitObserver);
|
sl@0
|
174 |
TInt GetInputPorts(RPointerArray<MMdfInputPort>& aComponentInputPorts);
|
sl@0
|
175 |
TInt GetOutputPorts(RPointerArray<MMdfOutputPort>& aComponentOutputPorts);
|
sl@0
|
176 |
TInt Configure(const TPuConfig& aConfigurationSetup);
|
sl@0
|
177 |
TInt GetConfig(TPuConfig& aConfigurationSetup);
|
sl@0
|
178 |
void Initialize();
|
sl@0
|
179 |
void Execute ();
|
sl@0
|
180 |
TInt Pause ();
|
sl@0
|
181 |
void Stop ();
|
sl@0
|
182 |
TProcessingUnitState State();
|
sl@0
|
183 |
TInt CreateCustomInterface(TUid aUid);
|
sl@0
|
184 |
TAny* CustomInterface(TUid aUid);
|
sl@0
|
185 |
|
sl@0
|
186 |
// CAudioDevice
|
sl@0
|
187 |
RMdaDevSound& SoundDevice();
|
sl@0
|
188 |
MMdfProcessingUnitObserver* Observer();
|
sl@0
|
189 |
~CAudioDevice();
|
sl@0
|
190 |
|
sl@0
|
191 |
private:
|
sl@0
|
192 |
CAudioDevice();
|
sl@0
|
193 |
void ConstructL();
|
sl@0
|
194 |
private:
|
sl@0
|
195 |
CInputPort* iInputPort;
|
sl@0
|
196 |
COutputPort* iOutputPort;
|
sl@0
|
197 |
RMdaDevSound iSoundDevice;
|
sl@0
|
198 |
MMdfProcessingUnitObserver* iObserver;
|
sl@0
|
199 |
TProcessingUnitState iState;
|
sl@0
|
200 |
};
|
sl@0
|
201 |
|
sl@0
|
202 |
#endif // AUDIODEVICE_H
|