1 /* |
|
2 * Copyright (c) 2002 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 * CFLDRingingTonePlayer is used to play sound files. It takes into account |
|
16 * the current volume and ringing type settings. |
|
17 * |
|
18 * |
|
19 */ |
|
20 |
|
21 |
|
22 #ifndef __CFLDRINGINGTONEPLAYER_H__ |
|
23 #define __CFLDRINGINGTONEPLAYER_H__ |
|
24 |
|
25 // INTERNAL INCLUDES |
|
26 //#include "MFLDFileProcessor.h" |
|
27 #include "CFLDPlayerBase.h" |
|
28 |
|
29 // EXTERNAL INCLUDES |
|
30 #include <e32def.h> |
|
31 #include <e32property.h> |
|
32 #include <DrmAudioSamplePlayer.h> |
|
33 #include <mdaaudiotoneplayer.h> |
|
34 |
|
35 |
|
36 // FORWARD DECLARATIONS |
|
37 class C3DRingingToneInterface; |
|
38 |
|
39 // CLASS DECLARATION |
|
40 |
|
41 /** |
|
42 * CFLDRingingTonePlayer is used to play sound files. It takes into account the current |
|
43 * volume and ringing type settings. |
|
44 * |
|
45 * @lib filelist.lib |
|
46 * @since 2.1 |
|
47 */ |
|
48 NONSHARABLE_CLASS( CFLDRingingTonePlayer ) |
|
49 : public CFLDPlayerBase, |
|
50 public MDrmAudioPlayerCallback, |
|
51 public MMdaAudioToneObserver |
|
52 { |
|
53 private: // Enumerations |
|
54 |
|
55 enum TAudioPlayerStatus |
|
56 { |
|
57 EAudioPlayerNotCreated, |
|
58 EAudioPlayerInitializing, |
|
59 EAudioPlayerReady, |
|
60 EAudioPlayerPlaying, |
|
61 EAudioPlayerInitialized, |
|
62 EAudioPlayerPlayingWith3DEffect |
|
63 }; |
|
64 |
|
65 // These match with the ones in Profile Engine |
|
66 enum TRingingTypes |
|
67 { |
|
68 ERingingTypeRinging = 0, |
|
69 ERingingTypeAscending, |
|
70 ERingingTypeRingOnce, |
|
71 ERingingTypeBeepOnce, |
|
72 ERingingTypeSilent |
|
73 }; |
|
74 |
|
75 enum TFLAllowScreenSaver |
|
76 { |
|
77 EFLScreenSaverAllowed = 0, |
|
78 EFLScreenSaverNotAllowed |
|
79 }; |
|
80 |
|
81 public: // Constructors and destructors |
|
82 |
|
83 /** |
|
84 * Two-phase static constructor |
|
85 * @param aShowErrorMsgs Show an error note if the file format is not supported |
|
86 * @return A pointer to a fully constructed CFLDRingingTonePlayer instance |
|
87 */ |
|
88 static CFLDRingingTonePlayer* NewL( TBool aShowErrorMsgs = ETrue ); |
|
89 |
|
90 /** |
|
91 * Destructor |
|
92 */ |
|
93 virtual ~CFLDRingingTonePlayer(); |
|
94 |
|
95 private: // Constructors and destructors |
|
96 |
|
97 /** |
|
98 * Constructor |
|
99 * @param aShowErrorMsgs Show an error note if the file format is not supported |
|
100 */ |
|
101 CFLDRingingTonePlayer( TBool aShowErrorMsgs ); |
|
102 |
|
103 /** |
|
104 * Second phase constructor |
|
105 */ |
|
106 void ConstructL(); |
|
107 |
|
108 public: // From MFLDFileProcessor |
|
109 |
|
110 /** |
|
111 * Derived from MFLDFileProcessor. Starts playing the sound file |
|
112 */ |
|
113 void ProcessFileL( const TDesC& aFileName, RWindow* aWindow ); |
|
114 |
|
115 /** |
|
116 * Derived from MFLDFileProcessor. Stops playing the file. |
|
117 */ |
|
118 void Cancel(); |
|
119 |
|
120 public: |
|
121 /** |
|
122 * Enables/disables 3D effects. |
|
123 * @param a3dEffects. |
|
124 * @return None. |
|
125 */ |
|
126 void Set3dEffects( TBool a3dEffects ); |
|
127 |
|
128 |
|
129 |
|
130 private: // New methods |
|
131 |
|
132 /** When audioplayer is ready, set its ringing type |
|
133 * @param aRingingType The ringing type (see enum TRingingTypes) |
|
134 */ |
|
135 void DoSetRingingType( TInt aRingingType ); |
|
136 |
|
137 /** |
|
138 * Converts volume from 1 to 10 to audio driver understandable value. |
|
139 * @param aVolume Volume level to be converted. |
|
140 * @return Returns converted volume level |
|
141 */ |
|
142 TInt ConvertVolume( TInt aVolume ); |
|
143 |
|
144 private: // Methods derived from MDrmAudioPlayerCallback |
|
145 |
|
146 /** |
|
147 * Derived from MDrmAudioPlayerCallback |
|
148 * This method is called when the audio player initialisation is ready |
|
149 */ |
|
150 void MdapcInitComplete( TInt aError, const TTimeIntervalMicroSeconds& aDuration ); |
|
151 |
|
152 /** |
|
153 * Derived from MDrmAudioPlayerCallback |
|
154 * This method is called when the audio player has finished playing |
|
155 */ |
|
156 void MdapcPlayComplete( TInt aError ); |
|
157 |
|
158 private: // Methods derived from MMdaAudioToneObserver |
|
159 |
|
160 virtual void MatoPrepareComplete( TInt aError ); |
|
161 virtual void MatoPlayComplete( TInt aError ); |
|
162 |
|
163 private: // Data |
|
164 |
|
165 /// Own: Pointer to audioplayer |
|
166 CDrmPlayerUtility* iAudioPlayer; |
|
167 /// Audioplayer status |
|
168 TAudioPlayerStatus iAudioPlayerStatus; |
|
169 /// Own: Pointer to toneplayer |
|
170 CMdaAudioToneUtility* iTonePlayer; |
|
171 /// Toneplayer status |
|
172 TAudioPlayerStatus iTonePlayerStatus; |
|
173 |
|
174 /** |
|
175 * Pub&Sub property. |
|
176 * For setting the state of the screen saver. |
|
177 */ |
|
178 RProperty iPropScreenSaver; |
|
179 |
|
180 // 3D effect |
|
181 TInt i3DEffect; |
|
182 // 3D effect |
|
183 TInt i3DEcho; |
|
184 |
|
185 // plugin for playing 3D effects |
|
186 C3DRingingToneInterface* i3dRingingTonePlugin; |
|
187 |
|
188 |
|
189 }; |
|
190 |
|
191 #endif // __CFLDRINGINGTONEPLAYER_H__ |
|
192 |
|
193 // End of File |
|