sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2006-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 |
|
sl@0
|
21 |
/**
|
sl@0
|
22 |
@file
|
sl@0
|
23 |
@publishedPartner
|
sl@0
|
24 |
@released
|
sl@0
|
25 |
*/
|
sl@0
|
26 |
|
sl@0
|
27 |
#ifndef MAUDIOGAINCONTROL_H
|
sl@0
|
28 |
#define MAUDIOGAINCONTROL_H
|
sl@0
|
29 |
|
sl@0
|
30 |
#include <e32base.h>
|
sl@0
|
31 |
#include <f32file.h>
|
sl@0
|
32 |
#include <a3f/a3fbase.h>
|
sl@0
|
33 |
#include <a3f/maudioprocessingunit.h>
|
sl@0
|
34 |
|
sl@0
|
35 |
class MAudioGainControlObserver;
|
sl@0
|
36 |
|
sl@0
|
37 |
|
sl@0
|
38 |
/**
|
sl@0
|
39 |
* Interface to gain control processing unit.
|
sl@0
|
40 |
*
|
sl@0
|
41 |
* Gain control is used for controlling volume and gain related settings of an audio stream.
|
sl@0
|
42 |
*/
|
sl@0
|
43 |
class MAudioGainControl
|
sl@0
|
44 |
{
|
sl@0
|
45 |
public:
|
sl@0
|
46 |
|
sl@0
|
47 |
/**
|
sl@0
|
48 |
* Returns the maximum gain the device supports.
|
sl@0
|
49 |
*
|
sl@0
|
50 |
* The maximum gain value depends on the setup of the stream.
|
sl@0
|
51 |
*
|
sl@0
|
52 |
* this is the maximum gain value which can be passed to SetGain().
|
sl@0
|
53 |
* @param aMaxGain On return, contains the maximum gain value, provided that the returned error code is KErrNone.
|
sl@0
|
54 |
* @return An error code. KErrNone if the maximum gain value is available, otherwise one of the system wide error codes.
|
sl@0
|
55 |
*/
|
sl@0
|
56 |
virtual TInt GetMaxGain(TInt& aMaxGain) const= 0 ;
|
sl@0
|
57 |
|
sl@0
|
58 |
/**
|
sl@0
|
59 |
* Returns the maximum ramp time that is supported for the associated stream.
|
sl@0
|
60 |
*
|
sl@0
|
61 |
* The maximum ramp time may be different in playback and recording modes,
|
sl@0
|
62 |
* so the value should be checked before setting the ramptime. this function
|
sl@0
|
63 |
* also does not take into account any possible ongoing ramp.
|
sl@0
|
64 |
*
|
sl@0
|
65 |
* this is the maximum ramp time value which can be passed to SetGain().
|
sl@0
|
66 |
* @param aMaxRampTime On return contains the maximum ramp time.
|
sl@0
|
67 |
* The value is platform and stream setup dependent but is always greater than or equal to zero.
|
sl@0
|
68 |
* @return An error code. KErrNone on success, otherwise one of the system wide error codes.
|
sl@0
|
69 |
*/
|
sl@0
|
70 |
virtual TInt GetMaxRampTime(TTimeIntervalMicroSeconds& aMaxRampTime) const= 0;
|
sl@0
|
71 |
|
sl@0
|
72 |
/**
|
sl@0
|
73 |
* Requests changes to the audio gain on a channel-by-channel basis.
|
sl@0
|
74 |
|
sl@0
|
75 |
* Note that the values for each channel are independent of each other.
|
sl@0
|
76 |
* The call is asynchronous in nature, resulting in a GainChanged()
|
sl@0
|
77 |
* callback, and the request is only applied following a successful
|
sl@0
|
78 |
* Commit() cycle.
|
sl@0
|
79 |
* The callback signals the receipt of the SetGain() call from the
|
sl@0
|
80 |
* underlying adaptation, and not (say) the completion of a ramp operation.
|
sl@0
|
81 |
* The actual gains will only change once the associated Audio Stream becomes EActive.
|
sl@0
|
82 |
* If the associated Audio Stream is already EActive
|
sl@0
|
83 |
* then the change will start immediately following the next successful Commit() cycle.
|
sl@0
|
84 |
* MMRC may choose to modify or ignore the requested gains.
|
sl@0
|
85 |
|
sl@0
|
86 |
* @param aChannels Contains the channels for which the gain should be set and the gain value for those channels.
|
sl@0
|
87 |
* @param aRampOperation How aRampDuration is to be interpreted.(see below)
|
sl@0
|
88 |
* @param aRampDuration Duration in microseconds.
|
sl@0
|
89 |
* @return KErrNone if initially successful.
|
sl@0
|
90 |
* KErrNotSupported if the SetGain() call referred to non-existent channels.
|
sl@0
|
91 |
* KErrArgument if aGain of less than 0 or larger than max gain, the same channel is specified multiple times,
|
sl@0
|
92 |
* or aRampDuration is less than 0 or greater than max ramp duration.
|
sl@0
|
93 |
* KErrA3fUnsupportedRamp if the ramp operation requested is not supported, or the Uid value supplies is unknown.
|
sl@0
|
94 |
* Other system-wide error codes are also possible.
|
sl@0
|
95 |
* These errors could instead by returned as part of the subsequent GainChanged() callback – depending on the a3f adaptation.
|
sl@0
|
96 |
* Also note: the requested parameters are specific to the associated stream.
|
sl@0
|
97 |
* If more than one stream is concurrently active to the same device,
|
sl@0
|
98 |
* it is up to the adaptation to arrange both the device gains the mixer and splitter gains to achieve a similar effect to the several streams being played through separate devices and mixed post-amplification.
|
sl@0
|
99 |
*/
|
sl@0
|
100 |
virtual TInt SetGain(RArray<TAudioChannelGain>& aChannels, TUid aRampOperation, const TTimeIntervalMicroSeconds& aRampDuration)=0;
|
sl@0
|
101 |
|
sl@0
|
102 |
/**
|
sl@0
|
103 |
* Sets the audio channel gain.
|
sl@0
|
104 |
*
|
sl@0
|
105 |
* By default all channels are set to use same gain value. Note that the
|
sl@0
|
106 |
* values for each channel are independent of each other, meaning that
|
sl@0
|
107 |
* they only control the gain level on which the particular channel is
|
sl@0
|
108 |
* being used and there is no limitation requiring the sum of all channels to be 100.
|
sl@0
|
109 |
*
|
sl@0
|
110 |
* The gain values will be applied once the associated stream is active.
|
sl@0
|
111 |
* if the stream is active while this function is called, then the values
|
sl@0
|
112 |
* are applied immediately.
|
sl@0
|
113 |
*
|
sl@0
|
114 |
* @param aChannels Contains the channels for which the gain should be set and the gain value for those channels.
|
sl@0
|
115 |
* @return An error code. KErrNone on success.
|
sl@0
|
116 |
* KErrNotSupported if gain for unsupported channels is tried to be set.
|
sl@0
|
117 |
* KErrArgument if a value of less than 0 or larger than max gain is tried to be set as gain.
|
sl@0
|
118 |
* Other system wide error codes are also possible.
|
sl@0
|
119 |
*/
|
sl@0
|
120 |
virtual TInt SetGain(RArray<TAudioChannelGain>& aChannels)=0;
|
sl@0
|
121 |
|
sl@0
|
122 |
/**
|
sl@0
|
123 |
* Returns channel specific gain settings.
|
sl@0
|
124 |
*
|
sl@0
|
125 |
* @param aChannels On return contains current gain settings for each audio channel.
|
sl@0
|
126 |
* @return An error code. KErrNone on success.
|
sl@0
|
127 |
* KErrArgument if the array passed in as a parameter is not empty.
|
sl@0
|
128 |
* KErrOutOfMemory in case of memory exhaustion.
|
sl@0
|
129 |
* Other system wide error codes are also possible.
|
sl@0
|
130 |
*/
|
sl@0
|
131 |
virtual TInt GetGain(RArray<TAudioChannelGain>& aChannels) const= 0;
|
sl@0
|
132 |
|
sl@0
|
133 |
/**
|
sl@0
|
134 |
* Registers an observer for receiving callbacks.
|
sl@0
|
135 |
*
|
sl@0
|
136 |
* @param aObserver a reference to the observer to register.
|
sl@0
|
137 |
* @return An error code. KErrNone on success, otherwise one of the system wide error codes.
|
sl@0
|
138 |
*/
|
sl@0
|
139 |
virtual TInt RegisterAudioGainControlObserver(MAudioGainControlObserver& aObserver)=0;
|
sl@0
|
140 |
|
sl@0
|
141 |
/**
|
sl@0
|
142 |
* Unregisters an observer.
|
sl@0
|
143 |
*
|
sl@0
|
144 |
* @param aObserver a reference to observer to unregister.
|
sl@0
|
145 |
*/
|
sl@0
|
146 |
virtual void UnregisterAudioGainControlObserver(MAudioGainControlObserver& aObserver)=0;
|
sl@0
|
147 |
|
sl@0
|
148 |
};
|
sl@0
|
149 |
|
sl@0
|
150 |
#endif // MAUDIOGAINCONTROL_H
|