sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2007-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 AUDIOGAINCONTROL_H
|
sl@0
|
21 |
#define AUDIOGAINCONTROL_H
|
sl@0
|
22 |
|
sl@0
|
23 |
#include <e32base.h>
|
sl@0
|
24 |
#include <a3f/a3fbase.h>
|
sl@0
|
25 |
#include <a3f/maudiogaincontrol.h>
|
sl@0
|
26 |
#include <a3f/maudiogaincontrolobserver.h>
|
sl@0
|
27 |
|
sl@0
|
28 |
#include "mgainhelper.h"
|
sl@0
|
29 |
|
sl@0
|
30 |
#include <a3f/a3f_trace_utils.h>
|
sl@0
|
31 |
|
sl@0
|
32 |
|
sl@0
|
33 |
const TUint KDefaultGain = 5;
|
sl@0
|
34 |
const TUint KDefaultMaxGain = 255; // TODO should discover at run time but this is value of current Symbian sound driver adaptor
|
sl@0
|
35 |
const TUint KDefaultNumChannels = 2;
|
sl@0
|
36 |
const TUint KDefaultMaxRampTime = 5;
|
sl@0
|
37 |
|
sl@0
|
38 |
enum TGainControlPanicCode
|
sl@0
|
39 |
{
|
sl@0
|
40 |
EAdaptationOldSetGainCalledPanic,
|
sl@0
|
41 |
};
|
sl@0
|
42 |
|
sl@0
|
43 |
/**
|
sl@0
|
44 |
* Implementation of audio gain control API.
|
sl@0
|
45 |
* ?more_complete_description
|
sl@0
|
46 |
* @lib audiogaincontrol.lib
|
sl@0
|
47 |
*/
|
sl@0
|
48 |
NONSHARABLE_CLASS(CAudioGainControl) : public CBase, public MAudioGainControl
|
sl@0
|
49 |
{
|
sl@0
|
50 |
public:
|
sl@0
|
51 |
|
sl@0
|
52 |
IMPORT_C static CAudioGainControl* NewL();
|
sl@0
|
53 |
/**
|
sl@0
|
54 |
* Destructor.
|
sl@0
|
55 |
*
|
sl@0
|
56 |
* Deletes all objects and releases all resource owned by this instance.
|
sl@0
|
57 |
*/
|
sl@0
|
58 |
virtual ~CAudioGainControl();
|
sl@0
|
59 |
|
sl@0
|
60 |
IMPORT_C void SetHelper(MGainHelper& aHelper);
|
sl@0
|
61 |
|
sl@0
|
62 |
IMPORT_C void IssueGainChangedCallBack(TInt aError);
|
sl@0
|
63 |
|
sl@0
|
64 |
IMPORT_C TInt ConfigureRamp(TUid aRampOperation, const TTimeIntervalMicroSeconds& aRampDuration);
|
sl@0
|
65 |
|
sl@0
|
66 |
void IssueMaxGainChangedCallBack();
|
sl@0
|
67 |
void IssueMaxRampTimeChangedCallBack();
|
sl@0
|
68 |
|
sl@0
|
69 |
// from base class MAudioGainControl
|
sl@0
|
70 |
TInt GetMaxGain(TInt& aMaxGain) const;
|
sl@0
|
71 |
TInt GetMaxRampTime(TTimeIntervalMicroSeconds& aMaxRampTime) const;
|
sl@0
|
72 |
TInt SetGain(RArray<TAudioChannelGain>& aChannels, TUid aRampOperation, const TTimeIntervalMicroSeconds& aRampDuration);
|
sl@0
|
73 |
TInt SetGain(RArray<TAudioChannelGain>& aChannels);
|
sl@0
|
74 |
TInt GetGain(RArray<TAudioChannelGain>& aChannels) const;
|
sl@0
|
75 |
TInt RegisterAudioGainControlObserver(MAudioGainControlObserver& aObserver);
|
sl@0
|
76 |
void UnregisterAudioGainControlObserver(MAudioGainControlObserver& aObserver);
|
sl@0
|
77 |
|
sl@0
|
78 |
private:
|
sl@0
|
79 |
void ConstructL();
|
sl@0
|
80 |
|
sl@0
|
81 |
CAudioGainControl();
|
sl@0
|
82 |
|
sl@0
|
83 |
private: //data
|
sl@0
|
84 |
RArray<TAudioChannelGain> iGains;
|
sl@0
|
85 |
/**
|
sl@0
|
86 |
* Reference to observer instance
|
sl@0
|
87 |
*/
|
sl@0
|
88 |
RPointerArray<MAudioGainControlObserver> iGainObservers;
|
sl@0
|
89 |
|
sl@0
|
90 |
// The gain cannot talk directly with the sound device driver so it needs a helper to request
|
sl@0
|
91 |
MGainHelper* iHelper;
|
sl@0
|
92 |
};
|
sl@0
|
93 |
|
sl@0
|
94 |
#endif // AUDIOGAINCONTROL_H
|