sl@0
|
1 |
// Copyright (c) 2003-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 __MMF_AUDIOTONECONTROLLER_H__
|
sl@0
|
17 |
#define __MMF_AUDIOTONECONTROLLER_H__
|
sl@0
|
18 |
|
sl@0
|
19 |
// Standard EPOC32 includes required by this header file
|
sl@0
|
20 |
#include <e32base.h>
|
sl@0
|
21 |
#include <e32std.h>
|
sl@0
|
22 |
#include <ecom/implementationproxy.h>
|
sl@0
|
23 |
|
sl@0
|
24 |
// Public Media Server includes
|
sl@0
|
25 |
#include <mmf/common/mmfcontroller.h>
|
sl@0
|
26 |
#include <mmf/server/mmfdatasink.h>
|
sl@0
|
27 |
#include <mmf/server/mmfdatasource.h>
|
sl@0
|
28 |
|
sl@0
|
29 |
#include <mmf/common/mmfstandardcustomcommands.h>
|
sl@0
|
30 |
#include <mmf/server/sounddevice.h>
|
sl@0
|
31 |
|
sl@0
|
32 |
|
sl@0
|
33 |
/**
|
sl@0
|
34 |
Panic category and codes for the Audio Tone Controller
|
sl@0
|
35 |
@internalTechnology
|
sl@0
|
36 |
*/
|
sl@0
|
37 |
_LIT(KMMFAudioToneControllerPanicCategory, "MMFAudioToneController");
|
sl@0
|
38 |
enum TMMFMdaAudioToneControllerPanicCodes
|
sl@0
|
39 |
{
|
sl@0
|
40 |
EMMFMdaAudioToneControllerAlreadyPrepared,
|
sl@0
|
41 |
EMMFMdaAudioToneControllerBadToneConfig,
|
sl@0
|
42 |
EMMFMdaAudioToneControllerBadMixinCall
|
sl@0
|
43 |
};
|
sl@0
|
44 |
|
sl@0
|
45 |
/**
|
sl@0
|
46 |
The public API for clients of the MMFAudioToneController
|
sl@0
|
47 |
@internalTechnology
|
sl@0
|
48 |
*/
|
sl@0
|
49 |
|
sl@0
|
50 |
class CMMFAudioToneController : public CMMFController,
|
sl@0
|
51 |
public MMMFAudioPlayDeviceCustomCommandImplementor,
|
sl@0
|
52 |
public MMMFAudioPlayControllerCustomCommandImplementor,
|
sl@0
|
53 |
public MDevSoundObserver,
|
sl@0
|
54 |
public MMMFAudioPlayControllerSetRepeatsCustomCommandImplementor
|
sl@0
|
55 |
{
|
sl@0
|
56 |
public:
|
sl@0
|
57 |
static CMMFController* NewL();
|
sl@0
|
58 |
virtual ~CMMFAudioToneController();
|
sl@0
|
59 |
|
sl@0
|
60 |
//implement CMMFController ecom plugin interface
|
sl@0
|
61 |
virtual void AddDataSourceL(MDataSource& aDataSource);
|
sl@0
|
62 |
virtual void AddDataSinkL(MDataSink& aDataSink);
|
sl@0
|
63 |
virtual void RemoveDataSourceL(MDataSource& aDataSource);
|
sl@0
|
64 |
virtual void RemoveDataSinkL(MDataSink& aDataSink);
|
sl@0
|
65 |
|
sl@0
|
66 |
virtual void ResetL();
|
sl@0
|
67 |
virtual void PrimeL();
|
sl@0
|
68 |
virtual void PrimeL(TMMFMessage& aMessage);
|
sl@0
|
69 |
virtual void PlayL();
|
sl@0
|
70 |
virtual void PauseL();
|
sl@0
|
71 |
virtual void StopL();
|
sl@0
|
72 |
|
sl@0
|
73 |
virtual TTimeIntervalMicroSeconds PositionL() const {User::Leave(KErrNotSupported); TTimeIntervalMicroSeconds zero(0); return zero;}
|
sl@0
|
74 |
virtual void SetPositionL(const TTimeIntervalMicroSeconds& /*aPosition*/){}
|
sl@0
|
75 |
virtual TTimeIntervalMicroSeconds DurationL() const {TTimeIntervalMicroSeconds zero(0); return zero;}
|
sl@0
|
76 |
virtual void CustomCommand(TMMFMessage& aMessage);
|
sl@0
|
77 |
|
sl@0
|
78 |
virtual void SetPrioritySettings(const TMMFPrioritySettings& aPrioritySettings);
|
sl@0
|
79 |
|
sl@0
|
80 |
virtual void GetNumberOfMetaDataEntriesL(TInt& /*aNumberOfEntries*/){User::Leave(KErrNotSupported);}
|
sl@0
|
81 |
virtual CMMFMetaDataEntry* GetMetaDataEntryL(TInt /*aIndex*/){User::Leave(KErrNotSupported); return NULL;}
|
sl@0
|
82 |
|
sl@0
|
83 |
//from MMMFAudioPlayDeviceCustomCommandImplementor
|
sl@0
|
84 |
virtual void MapdSetVolumeL(TInt aVolume);
|
sl@0
|
85 |
virtual void MapdGetMaxVolumeL(TInt& aMaxVolume);
|
sl@0
|
86 |
virtual void MapdGetVolumeL(TInt& aVolume);
|
sl@0
|
87 |
virtual void MapdSetVolumeRampL(const TTimeIntervalMicroSeconds& aRampDuration);
|
sl@0
|
88 |
virtual void MapdSetBalanceL(TInt aBalance);
|
sl@0
|
89 |
virtual void MapdGetBalanceL(TInt& aBalance);
|
sl@0
|
90 |
|
sl@0
|
91 |
//from MMMFAudioPlayControllerCustomCommandImplementor
|
sl@0
|
92 |
virtual void MapcSetPlaybackWindowL(const TTimeIntervalMicroSeconds& /*aStart*/, const TTimeIntervalMicroSeconds& /*aEnd*/) {User::Leave(KErrNotSupported);}
|
sl@0
|
93 |
virtual void MapcDeletePlaybackWindowL() {User::Leave(KErrNotSupported);}
|
sl@0
|
94 |
virtual void MapcGetLoadingProgressL(TInt& /*aPercentageComplete*/) {User::Leave(KErrNotSupported);}
|
sl@0
|
95 |
|
sl@0
|
96 |
|
sl@0
|
97 |
|
sl@0
|
98 |
// From DevSoundObserver
|
sl@0
|
99 |
void InitializeComplete(TInt aError);
|
sl@0
|
100 |
void ToneFinished(TInt aError);
|
sl@0
|
101 |
void BufferToBeFilled(CMMFBuffer* /*aBuffer*/) {Panic(EMMFMdaAudioToneControllerBadMixinCall);}
|
sl@0
|
102 |
void PlayError(TInt /*aError*/) {Panic(EMMFMdaAudioToneControllerBadMixinCall);}
|
sl@0
|
103 |
void BufferToBeEmptied(CMMFBuffer* /*aBuffer*/) {Panic(EMMFMdaAudioToneControllerBadMixinCall);}
|
sl@0
|
104 |
void RecordError(TInt /*aError*/) {Panic(EMMFMdaAudioToneControllerBadMixinCall);}
|
sl@0
|
105 |
void ConvertError(TInt /*aError*/) {Panic(EMMFMdaAudioToneControllerBadMixinCall);}
|
sl@0
|
106 |
void DeviceMessage(TUid /*aMessageId*/, const TDesC8& /*aMsg*/) {Panic(EMMFMdaAudioToneControllerBadMixinCall);}
|
sl@0
|
107 |
void SendEventToClient(const TMMFEvent& aEvent);
|
sl@0
|
108 |
|
sl@0
|
109 |
//from MMMFAudioPlayControllerSetRepeatsCustomCommandImplementor
|
sl@0
|
110 |
virtual TInt MapcSetRepeats(TInt aRepeatNumberOfTimes, const TTimeIntervalMicroSeconds& aTrailingSilence);
|
sl@0
|
111 |
|
sl@0
|
112 |
|
sl@0
|
113 |
public:
|
sl@0
|
114 |
|
sl@0
|
115 |
/**
|
sl@0
|
116 |
TControllerState is an enumeration within the namespace CMMFAudioToneController
|
sl@0
|
117 |
The enumeration provides a set of control states:
|
sl@0
|
118 |
EStopped is the initial state the controller resides in after it has been loaded
|
sl@0
|
119 |
EPrimed is the state the controller is in when it has been associated with datapaths but is not streaming data
|
sl@0
|
120 |
EPlaying is the state the controller is in when it is streaming data
|
sl@0
|
121 |
*/
|
sl@0
|
122 |
enum TControllerState
|
sl@0
|
123 |
{
|
sl@0
|
124 |
EStopped,
|
sl@0
|
125 |
EPrimed,
|
sl@0
|
126 |
EPriming,
|
sl@0
|
127 |
EPausePlaying,
|
sl@0
|
128 |
EPlaying,
|
sl@0
|
129 |
};
|
sl@0
|
130 |
|
sl@0
|
131 |
protected:
|
sl@0
|
132 |
CMMFAudioToneController();
|
sl@0
|
133 |
protected:
|
sl@0
|
134 |
void ConstructL();
|
sl@0
|
135 |
void NegotiateL();
|
sl@0
|
136 |
|
sl@0
|
137 |
// state accessor functions
|
sl@0
|
138 |
TBool SetState( TControllerState aState );
|
sl@0
|
139 |
TControllerState State() const ;
|
sl@0
|
140 |
TBool IsValidStateTransition( TControllerState aState ) const;
|
sl@0
|
141 |
TBool Invariant() const;
|
sl@0
|
142 |
TBool IsValidState( TControllerState aState ) const ;
|
sl@0
|
143 |
TBool ResetPostCondition() const;
|
sl@0
|
144 |
|
sl@0
|
145 |
void CalculateLeftRightBalance( TInt& aLeft, TInt& aRight, TInt aBalance ) const;
|
sl@0
|
146 |
void CalculateBalance( TInt& aBalance, TInt aLeft, TInt aRight ) const;
|
sl@0
|
147 |
|
sl@0
|
148 |
|
sl@0
|
149 |
void Panic(TInt aPanicCode) const {User::Panic(KMMFAudioToneControllerPanicCategory, aPanicCode);}
|
sl@0
|
150 |
|
sl@0
|
151 |
private:
|
sl@0
|
152 |
/** The data source provided by the Controller Framework, not owned (do not delete) */
|
sl@0
|
153 |
MDataSource* iDataSource;
|
sl@0
|
154 |
|
sl@0
|
155 |
/** buffer that holds the data to be played */
|
sl@0
|
156 |
CMMFDataBuffer* iToneSequenceData;
|
sl@0
|
157 |
|
sl@0
|
158 |
/** the Dev Sound that will be used to play the tone*/
|
sl@0
|
159 |
CMMFDevSound* iMMFDevSound;
|
sl@0
|
160 |
|
sl@0
|
161 |
/** Current state of the controller, see TControllerState*/
|
sl@0
|
162 |
TControllerState iState;
|
sl@0
|
163 |
|
sl@0
|
164 |
/** Priority setting used to controll access the Dev Sound*/
|
sl@0
|
165 |
TMMFPrioritySettings iPrioritySettings;
|
sl@0
|
166 |
|
sl@0
|
167 |
/** Indicates whether both a surce and data sink have been supplied by the Controller Framework*/
|
sl@0
|
168 |
TBool iSourceAndSinkAdded;
|
sl@0
|
169 |
|
sl@0
|
170 |
/** Indicates whether DevSound supports resume for current configuration*/
|
sl@0
|
171 |
TBool iIsResumeSupported;
|
sl@0
|
172 |
|
sl@0
|
173 |
/** Used to store message */
|
sl@0
|
174 |
TMMFMessage* iMessage;
|
sl@0
|
175 |
};
|
sl@0
|
176 |
|
sl@0
|
177 |
|
sl@0
|
178 |
#endif
|