1 /* |
|
2 * Copyright (c) 2006-2008 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: Wrapper for CMMFDevSound |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CSPDEVSOUND_H |
|
19 #define CSPDEVSOUND_H |
|
20 |
|
21 #include <sounddevice.h> |
|
22 |
|
23 class MCSPDevSoundObserver; |
|
24 |
|
25 /** |
|
26 * Wrapper for CMMFDevSound |
|
27 * |
|
28 */ |
|
29 NONSHARABLE_CLASS( CSPDevSound ): |
|
30 public CBase, |
|
31 public MDevSoundObserver |
|
32 { |
|
33 public: |
|
34 |
|
35 /** |
|
36 * Destructor. |
|
37 */ |
|
38 virtual ~CSPDevSound(); |
|
39 |
|
40 /** |
|
41 * Activates the dev sound stream. MCSPDevSoundObserver methods are called |
|
42 * when activation goes ok or fails. If the stream is already active or |
|
43 * activating then nothing is done. |
|
44 */ |
|
45 virtual void Activate(); |
|
46 |
|
47 /** |
|
48 * Deactivates the devsound stream. If stream is not active or |
|
49 * activation is not ongoing then nothing is done. |
|
50 */ |
|
51 virtual void Deactivate(); |
|
52 |
|
53 /** |
|
54 * Indicates that activation is ongoing, |
|
55 * but the result of the activation is still unknown. |
|
56 * @return ETrue - activation ongoing, EFalse - activation not ongoing. |
|
57 */ |
|
58 TBool IsActivationOngoing() const; |
|
59 |
|
60 /** |
|
61 * Determines wether the devsound stream is active or not. |
|
62 * @return ETrue - Stream is active, EFalse - Stream not active. |
|
63 */ |
|
64 TBool IsActive() const; |
|
65 |
|
66 CMMFDevSound& DevSound(); |
|
67 |
|
68 // from base class MDevSoundObserver |
|
69 |
|
70 /** |
|
71 * From MDevSoundObserver |
|
72 * Empty implementation |
|
73 */ |
|
74 void InitializeComplete( TInt aError ); |
|
75 |
|
76 /** |
|
77 * From MDevSoundObserver |
|
78 * Empty implementation |
|
79 */ |
|
80 void BufferToBeFilled( CMMFBuffer* aBuffer ); |
|
81 |
|
82 /** |
|
83 * From MDevSoundObserver |
|
84 * Empty implementation |
|
85 */ |
|
86 void PlayError( TInt aError ); |
|
87 |
|
88 /** |
|
89 * From MDevSoundObserver |
|
90 * Empty implementation |
|
91 */ |
|
92 void ToneFinished( TInt aError ); |
|
93 |
|
94 /** |
|
95 * From MDevSoundObserver |
|
96 * Empty implementation |
|
97 */ |
|
98 void BufferToBeEmptied( CMMFBuffer* aBuffer ); |
|
99 |
|
100 /** |
|
101 * From MDevSoundObserver |
|
102 * Empty implementation |
|
103 */ |
|
104 void RecordError( TInt aError ); |
|
105 |
|
106 /** |
|
107 * From MDevSoundObserver |
|
108 * Empty implementation |
|
109 */ |
|
110 void ConvertError( TInt aError ); |
|
111 |
|
112 /** |
|
113 * From MDevSoundObserver |
|
114 * Empty implementation |
|
115 */ |
|
116 void DeviceMessage( TUid aMessageType, const TDesC8& aMsg ); |
|
117 |
|
118 protected: |
|
119 |
|
120 CSPDevSound( MCSPDevSoundObserver& aObserver ); |
|
121 |
|
122 void ConstructL( |
|
123 TMMFState aMode, TUint aAudioPreference, TUint aAudioPriority ); |
|
124 |
|
125 private: |
|
126 |
|
127 /** |
|
128 * Derived class has to activate the stream here. |
|
129 */ |
|
130 virtual void DoActivateL() = 0; |
|
131 |
|
132 protected: // Data |
|
133 |
|
134 /** |
|
135 * Indication if device is activated. Derived class has to update this. |
|
136 */ |
|
137 TBool iActive; |
|
138 |
|
139 /** |
|
140 * Indication if activation is ongoing. |
|
141 * Derived class has to update this. |
|
142 */ |
|
143 TBool iActivationOngoing; |
|
144 |
|
145 /** |
|
146 * Devsound instance |
|
147 * Own. |
|
148 */ |
|
149 CMMFDevSound* iDevSound; |
|
150 |
|
151 /** |
|
152 * Observer for successfull activation. |
|
153 * Not own. |
|
154 */ |
|
155 MCSPDevSoundObserver& iObserver; |
|
156 |
|
157 /** |
|
158 * Audio priority settings for Devsound. |
|
159 */ |
|
160 TMMFPrioritySettings iPrioritySettings; |
|
161 |
|
162 |
|
163 }; |
|
164 |
|
165 #endif // CSPDEVSOUND_H |
|