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