|
1 /* |
|
2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef AUDIOGAINCONTROL_H |
|
21 #define AUDIOGAINCONTROL_H |
|
22 |
|
23 #include <e32base.h> |
|
24 #include <a3f/a3fbase.h> |
|
25 #include <a3f/maudiogaincontrol.h> |
|
26 #include <a3f/maudiogaincontrolobserver.h> |
|
27 |
|
28 #include "mgainhelper.h" |
|
29 |
|
30 #include <a3f/a3f_trace_utils.h> |
|
31 |
|
32 |
|
33 const TUint KDefaultGain = 5; |
|
34 const TUint KDefaultMaxGain = 255; // TODO should discover at run time but this is value of current Symbian sound driver adaptor |
|
35 const TUint KDefaultNumChannels = 2; |
|
36 const TUint KDefaultMaxRampTime = 5; |
|
37 |
|
38 enum TGainControlPanicCode |
|
39 { |
|
40 EAdaptationOldSetGainCalledPanic, |
|
41 }; |
|
42 |
|
43 /** |
|
44 * Implementation of audio gain control API. |
|
45 * ?more_complete_description |
|
46 * @lib audiogaincontrol.lib |
|
47 */ |
|
48 NONSHARABLE_CLASS(CAudioGainControl) : public CBase, public MAudioGainControl |
|
49 { |
|
50 public: |
|
51 |
|
52 IMPORT_C static CAudioGainControl* NewL(); |
|
53 /** |
|
54 * Destructor. |
|
55 * |
|
56 * Deletes all objects and releases all resource owned by this instance. |
|
57 */ |
|
58 virtual ~CAudioGainControl(); |
|
59 |
|
60 IMPORT_C void SetHelper(MGainHelper& aHelper); |
|
61 |
|
62 IMPORT_C void IssueGainChangedCallBack(TInt aError); |
|
63 |
|
64 IMPORT_C TInt ConfigureRamp(TUid aRampOperation, const TTimeIntervalMicroSeconds& aRampDuration); |
|
65 |
|
66 void IssueMaxGainChangedCallBack(); |
|
67 void IssueMaxRampTimeChangedCallBack(); |
|
68 |
|
69 // from base class MAudioGainControl |
|
70 TInt GetMaxGain(TInt& aMaxGain) const; |
|
71 TInt GetMaxRampTime(TTimeIntervalMicroSeconds& aMaxRampTime) const; |
|
72 TInt SetGain(RArray<TAudioChannelGain>& aChannels, TUid aRampOperation, const TTimeIntervalMicroSeconds& aRampDuration); |
|
73 TInt SetGain(RArray<TAudioChannelGain>& aChannels); |
|
74 TInt GetGain(RArray<TAudioChannelGain>& aChannels) const; |
|
75 TInt RegisterAudioGainControlObserver(MAudioGainControlObserver& aObserver); |
|
76 void UnregisterAudioGainControlObserver(MAudioGainControlObserver& aObserver); |
|
77 |
|
78 private: |
|
79 void ConstructL(); |
|
80 |
|
81 CAudioGainControl(); |
|
82 |
|
83 private: //data |
|
84 RArray<TAudioChannelGain> iGains; |
|
85 /** |
|
86 * Reference to observer instance |
|
87 */ |
|
88 RPointerArray<MAudioGainControlObserver> iGainObservers; |
|
89 |
|
90 // The gain cannot talk directly with the sound device driver so it needs a helper to request |
|
91 MGainHelper* iHelper; |
|
92 }; |
|
93 |
|
94 #endif // AUDIOGAINCONTROL_H |