|
1 /* |
|
2 * Copyright (c) 2005-2006 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: Class that handles playback of tones in AudioMessage application |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef AUDIOMESSAGEBEEP_H |
|
21 #define AUDIOMESSAGEBEEP_H |
|
22 |
|
23 #include <mdaaudiotoneplayer.h> |
|
24 |
|
25 class CAknKeySoundSystem; |
|
26 class CAknSoundInfo; |
|
27 |
|
28 /** |
|
29 * Class that handles playback of tones in audiomessage application |
|
30 * |
|
31 * @lib audiomessage.exe |
|
32 * @since S60 v3.1 |
|
33 */ |
|
34 NONSHARABLE_CLASS( CAudioMessageBeep ) |
|
35 : public CBase, public MMdaAudioToneObserver |
|
36 { |
|
37 |
|
38 private: |
|
39 enum TVRTonePlayerState |
|
40 { |
|
41 EVRToneIdle, |
|
42 EVRTonePreparing, |
|
43 EVRTonePlaying |
|
44 }; |
|
45 |
|
46 public: |
|
47 |
|
48 /** |
|
49 * Factory function to create this object |
|
50 * |
|
51 * @param aApp Reference to application instance |
|
52 */ |
|
53 static CAudioMessageBeep* NewL(); |
|
54 |
|
55 /** |
|
56 * Destructor |
|
57 */ |
|
58 virtual ~CAudioMessageBeep(); |
|
59 |
|
60 /** |
|
61 * Prepares a tone for playback. This does not guarantee |
|
62 * that preparing is ready after completion. |
|
63 * |
|
64 * @since S60 v3.0 |
|
65 * @param aToneId Predefined id of the tone to be prepared |
|
66 */ |
|
67 void PrepareToneL( TInt aToneId ); |
|
68 |
|
69 /** |
|
70 * Non-leaving method that calls PrepareToneL and ignores all leaves |
|
71 * |
|
72 * @since S60 v3.0 |
|
73 * @param aToneId Predefined id of the tone to be prepared |
|
74 */ |
|
75 void PrepareTone( TInt aToneId ); |
|
76 |
|
77 /** |
|
78 * Starts playback of tone. Playback starts immediately if the tone |
|
79 * specified has been already been prepared. Otherwise the tone |
|
80 * is first prepared. |
|
81 * |
|
82 * @since S60 v3.0 |
|
83 * @param aToneId Predefined id of the tone to be played |
|
84 */ |
|
85 void PlayTone( TInt aToneId ); |
|
86 |
|
87 // from base class MMdaAudioToneObserver |
|
88 |
|
89 /** |
|
90 * From MMdaAudioToneObserver. |
|
91 * Defines required client behaviour when an attempt to configure the |
|
92 * audio tone player utility has completed, successfully or otherwise. |
|
93 * |
|
94 * @param aError KErrNone if successful. One of the system |
|
95 * wide error codes if the attempt failed. The possible |
|
96 * values depend on the EPOC platform. |
|
97 */ |
|
98 void MatoPrepareComplete(TInt aError); |
|
99 |
|
100 /** |
|
101 * From MMdaAudioToneObserver. |
|
102 * Defines required client behaviour when the tone playing operation has |
|
103 * completed, successfully or otherwise. |
|
104 * |
|
105 * @param aError KErrNone if successful. One of the system |
|
106 * wide error codes if the attempt failed. The possible |
|
107 * values depend on the EPOC platform. |
|
108 */ |
|
109 void MatoPlayComplete(TInt aError); |
|
110 |
|
111 private: |
|
112 |
|
113 CAudioMessageBeep(); |
|
114 void ConstructL(); |
|
115 |
|
116 private: // data |
|
117 |
|
118 /** |
|
119 * Instance of the player class. |
|
120 * Own. |
|
121 */ |
|
122 CMdaAudioToneUtility* iPlayer; |
|
123 |
|
124 /** |
|
125 * Pointer to sound system utility that retrieves the sound data. |
|
126 * Not owned. |
|
127 */ |
|
128 CAknKeySoundSystem* iSoundSystem; |
|
129 |
|
130 /** |
|
131 * The id of the tone that is currently prepared |
|
132 */ |
|
133 TInt iPreparedTone; |
|
134 |
|
135 /** |
|
136 * The id of the tone that is in queue |
|
137 */ |
|
138 TInt iQueuedTone; |
|
139 |
|
140 /** |
|
141 * Is a tone currently in preparation? |
|
142 */ |
|
143 TVRTonePlayerState iState; |
|
144 |
|
145 }; |
|
146 |
|
147 #endif // CAudioMessageBeep_H |