sl@0
|
1 |
// Copyright (c) 2001-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 __SOUNDDEVICEBODY__H__
|
sl@0
|
17 |
#define __SOUNDDEVICEBODY__H__
|
sl@0
|
18 |
|
sl@0
|
19 |
#include "MmfDevSoundCallbackHandler.h"
|
sl@0
|
20 |
#include <mmf/plugin/devsoundplugin.h>
|
sl@0
|
21 |
#include <mmf/server/mmfdevsoundcustominterfacesupport.h>
|
sl@0
|
22 |
#include <mmf/server/mmfdevsoundcustominterface.h>
|
sl@0
|
23 |
#include "MmfDevSoundCIMuxUtility.h"
|
sl@0
|
24 |
|
sl@0
|
25 |
|
sl@0
|
26 |
/*
|
sl@0
|
27 |
*
|
sl@0
|
28 |
* Class Name: CMMFDevSoundClientImp
|
sl@0
|
29 |
*
|
sl@0
|
30 |
* Reference internals for CMMFDevSound
|
sl@0
|
31 |
* @internalComponent
|
sl@0
|
32 |
*
|
sl@0
|
33 |
*/
|
sl@0
|
34 |
class CMMFDevSoundClientImp : public CBase,
|
sl@0
|
35 |
public MMMFDevSoundPlugin,
|
sl@0
|
36 |
public MAudioClientThreadInfo,
|
sl@0
|
37 |
public MAutoPauseResumeSupport,
|
sl@0
|
38 |
public MMMFDevSoundCustomInterfaceChannel,
|
sl@0
|
39 |
public MMMFDevSoundEmptyBuffers,
|
sl@0
|
40 |
public MMMFDevSoundCustomInterfaceObserver,
|
sl@0
|
41 |
public MMMFDevSoundTimePlayed
|
sl@0
|
42 |
|
sl@0
|
43 |
{
|
sl@0
|
44 |
public:
|
sl@0
|
45 |
static CMMFDevSoundClientImp* NewL();
|
sl@0
|
46 |
~CMMFDevSoundClientImp();
|
sl@0
|
47 |
|
sl@0
|
48 |
// Initializes to raw audio data PCM16 and Sampling Rate of 8 KHz.
|
sl@0
|
49 |
void InitializeL(MDevSoundObserver& aDevSoundObserver, TMMFState aMode);
|
sl@0
|
50 |
// Initializes with hardware device and mode (play, record, convert)
|
sl@0
|
51 |
void InitializeL(MDevSoundObserver& aDevSoundObserver, TUid aHWDev, TMMFState aMode);
|
sl@0
|
52 |
// Initializes with hardware device associated with specific FourCC code
|
sl@0
|
53 |
// and desired mode (play, record, convert)
|
sl@0
|
54 |
void InitializeL(MDevSoundObserver& aDevSoundObserver, TFourCC aDesiredFourCC, TMMFState aMode);
|
sl@0
|
55 |
|
sl@0
|
56 |
// Returns device capabilities
|
sl@0
|
57 |
TMMFCapabilities Capabilities();
|
sl@0
|
58 |
// Returns device configuration
|
sl@0
|
59 |
TMMFCapabilities Config() const;
|
sl@0
|
60 |
// Sets device configuration
|
sl@0
|
61 |
void SetConfigL(const TMMFCapabilities& aCaps);
|
sl@0
|
62 |
|
sl@0
|
63 |
// Returns maximum play volume device supports
|
sl@0
|
64 |
TInt MaxVolume();
|
sl@0
|
65 |
// Returns play volume device is configured to
|
sl@0
|
66 |
TInt Volume();
|
sl@0
|
67 |
// Sets device play volume
|
sl@0
|
68 |
void SetVolume(TInt aVolume);
|
sl@0
|
69 |
|
sl@0
|
70 |
// Returns maximum record gain device supports
|
sl@0
|
71 |
TInt MaxGain();
|
sl@0
|
72 |
// Returns record gain device is configured to
|
sl@0
|
73 |
TInt Gain();
|
sl@0
|
74 |
// Sets device record gain
|
sl@0
|
75 |
void SetGain(TInt aGain);
|
sl@0
|
76 |
|
sl@0
|
77 |
// Returns play balance
|
sl@0
|
78 |
void GetPlayBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage);
|
sl@0
|
79 |
// Sets play balance
|
sl@0
|
80 |
void SetPlayBalanceL(TInt aLeftPercentage, TInt aRightPercentage);
|
sl@0
|
81 |
|
sl@0
|
82 |
// Returns record balance
|
sl@0
|
83 |
void GetRecordBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage);
|
sl@0
|
84 |
// Sets record balance
|
sl@0
|
85 |
void SetRecordBalanceL(TInt aLeftPercentage, TInt aRightPercentage);
|
sl@0
|
86 |
|
sl@0
|
87 |
// Initializes audio device and start play process
|
sl@0
|
88 |
void PlayInitL();
|
sl@0
|
89 |
// Initializes audio device and start record process
|
sl@0
|
90 |
void RecordInitL();
|
sl@0
|
91 |
// Plays the data in the buffer
|
sl@0
|
92 |
void PlayData();
|
sl@0
|
93 |
// Records data into buffer
|
sl@0
|
94 |
void RecordData();
|
sl@0
|
95 |
// Stops the ongoing operation
|
sl@0
|
96 |
void Stop();
|
sl@0
|
97 |
// Tempororily Stops the ongoing operation
|
sl@0
|
98 |
void Pause();
|
sl@0
|
99 |
|
sl@0
|
100 |
// Returns the Sample recorded so far
|
sl@0
|
101 |
TInt SamplesRecorded();
|
sl@0
|
102 |
// Returns the Sample played so far
|
sl@0
|
103 |
TInt SamplesPlayed();
|
sl@0
|
104 |
|
sl@0
|
105 |
// Initializes device and start playing tone
|
sl@0
|
106 |
void PlayToneL(TInt aFrequency, const TTimeIntervalMicroSeconds& aDuration);
|
sl@0
|
107 |
// Initializes device and start playing dual tone
|
sl@0
|
108 |
void PlayDualToneL(TInt aFrequencyOne, TInt aFrequencyTwo, const TTimeIntervalMicroSeconds& aDuration);
|
sl@0
|
109 |
// Initializes device and start playing DTMF String
|
sl@0
|
110 |
void PlayDTMFStringL(const TDesC& aDTMFString);
|
sl@0
|
111 |
// Initializes device and start playing tone sequence
|
sl@0
|
112 |
void PlayToneSequenceL(const TDesC8& aData);
|
sl@0
|
113 |
// Initializes device and start playing fixed sequence
|
sl@0
|
114 |
void PlayFixedSequenceL(TInt aSequenceNumber);
|
sl@0
|
115 |
|
sl@0
|
116 |
// Sets tone repeat attributes
|
sl@0
|
117 |
void SetToneRepeats(TInt aRepeatCount,
|
sl@0
|
118 |
const TTimeIntervalMicroSeconds& aRepeatTrailingSilence);
|
sl@0
|
119 |
// Sets DTMF tone attributes
|
sl@0
|
120 |
void SetDTMFLengths(TTimeIntervalMicroSeconds32& aToneOnLength,
|
sl@0
|
121 |
TTimeIntervalMicroSeconds32& aToneOffLength,
|
sl@0
|
122 |
TTimeIntervalMicroSeconds32& aPauseLength);
|
sl@0
|
123 |
// Sets volume ramp for playing
|
sl@0
|
124 |
void SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration);
|
sl@0
|
125 |
// Sets priority settings
|
sl@0
|
126 |
void SetPrioritySettings(const TMMFPrioritySettings& aPrioritySettings);
|
sl@0
|
127 |
|
sl@0
|
128 |
// Provides interface for sending custom commands for the audio device
|
sl@0
|
129 |
TAny* CustomInterface(TUid aInterfaceId);
|
sl@0
|
130 |
|
sl@0
|
131 |
// Provides interface for querying fixed sequence count
|
sl@0
|
132 |
TInt FixedSequenceCount();
|
sl@0
|
133 |
// Provides interface for querying fixed sequence name
|
sl@0
|
134 |
const TDesC& FixedSequenceName(TInt aSequenceNumber);
|
sl@0
|
135 |
// Gets the supported input datatypes
|
sl@0
|
136 |
void GetSupportedInputDataTypesL(RArray<TFourCC>& aSupportedDataTypesconst, const TMMFPrioritySettings& aPrioritySettings) const;
|
sl@0
|
137 |
// Gets the supported output datatypes
|
sl@0
|
138 |
void GetSupportedOutputDataTypesL(RArray<TFourCC>& aSupportedDataTypes, const TMMFPrioritySettings& aPrioritySettings) const;
|
sl@0
|
139 |
// Set the real client thread with thread Id
|
sl@0
|
140 |
TInt SetClientThreadInfo(TThreadId aTid);
|
sl@0
|
141 |
|
sl@0
|
142 |
// Registers the client for notification
|
sl@0
|
143 |
TInt RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData = KNullDesC8);
|
sl@0
|
144 |
//cancels the registered notification
|
sl@0
|
145 |
TInt CancelRegisterAsClient(TUid aEventType);
|
sl@0
|
146 |
//get the notification data to resume
|
sl@0
|
147 |
TInt GetResourceNotificationData(TUid aEventType,TDes8& aNotificationData);
|
sl@0
|
148 |
//if client need more than the default timeout period
|
sl@0
|
149 |
TInt WillResumePlay();
|
sl@0
|
150 |
|
sl@0
|
151 |
// from MMMFDevSoundEmptyBuffers
|
sl@0
|
152 |
//Empties the buffers below DevSound without causing the codec to be deleted.
|
sl@0
|
153 |
TInt EmptyBuffers();
|
sl@0
|
154 |
|
sl@0
|
155 |
// added to support custom command passing through DevSound
|
sl@0
|
156 |
TInt SyncCustomCommand(TUid aUid, const TDesC8& aParam1, const TDesC8& aParam2, TDes8* aOutParam);
|
sl@0
|
157 |
void AsyncCustomCommand(TUid aUid, TRequestStatus& aStatus, const TDesC8& aParam1, const TDesC8& aParam2, TDes8* aOutParam);
|
sl@0
|
158 |
|
sl@0
|
159 |
//from MMMFDevSoundCustomInterfaceObserver
|
sl@0
|
160 |
void CloseCustomInterface(TInt aIndex);
|
sl@0
|
161 |
|
sl@0
|
162 |
//from MMMFDevSoundTimePlayed
|
sl@0
|
163 |
TInt GetTimePlayed(TTimeIntervalMicroSeconds& aTime);
|
sl@0
|
164 |
private:
|
sl@0
|
165 |
// So that nobody can extend
|
sl@0
|
166 |
CMMFDevSoundClientImp();
|
sl@0
|
167 |
// Second phase constructor
|
sl@0
|
168 |
void ConstructL();
|
sl@0
|
169 |
|
sl@0
|
170 |
TInt FindCustomInterface(TUid aInterfaceId);
|
sl@0
|
171 |
private:
|
sl@0
|
172 |
// custom interface storage
|
sl@0
|
173 |
RArray<TMMFDevSoundCustomInterfaceData> iCustomInterfaceArray;
|
sl@0
|
174 |
CMMFDevSoundCIMuxUtility* iMuxUtility;
|
sl@0
|
175 |
|
sl@0
|
176 |
RMMFDevSoundProxy* iDevSoundProxy;
|
sl@0
|
177 |
MDevSoundObserver* iDevSoundObserver;
|
sl@0
|
178 |
|
sl@0
|
179 |
RMsgQueue<TMMFDevSoundQueueItem> iMsgQueue;
|
sl@0
|
180 |
CMsgQueueHandler* iMsgQueueHandler;
|
sl@0
|
181 |
};
|
sl@0
|
182 |
|
sl@0
|
183 |
#include "SoundDeviceBody.inl"
|
sl@0
|
184 |
|
sl@0
|
185 |
#endif // __SOUNDDEVICEBODY__H__
|