22 using namespace TMS; |
22 using namespace TMS; |
23 |
23 |
24 // Mute value |
24 // Mute value |
25 const gint KSetMuteToDevSound = 0; |
25 const gint KSetMuteToDevSound = 0; |
26 |
26 |
27 // --------------------------------------------------------------------------- |
27 // ----------------------------------------------------------------------------- |
28 // Static constructor. |
28 // Static constructor. |
29 // --------------------------------------------------------------------------- |
29 // ----------------------------------------------------------------------------- |
30 // |
30 // |
31 CSUplink* CSUplink::NewL(MCSPDevSoundObserver& aObserver) |
31 TMSCSUplink* TMSCSUplink::NewL(TMSCSPDevSoundObserver& aObserver) |
32 { |
32 { |
33 CSUplink* self = new (ELeave) CSUplink(aObserver); |
33 TMSCSUplink* self = new (ELeave) TMSCSUplink(aObserver); |
34 CleanupStack::PushL(self); |
34 CleanupStack::PushL(self); |
35 self->ConstructL(); |
35 self->ConstructL(); |
36 CleanupStack::Pop(self); |
36 CleanupStack::Pop(self); |
37 return self; |
37 return self; |
38 } |
38 } |
39 |
39 |
40 // --------------------------------------------------------------------------- |
40 // ----------------------------------------------------------------------------- |
41 // Destructor |
41 // Destructor |
42 // --------------------------------------------------------------------------- |
42 // ----------------------------------------------------------------------------- |
43 // |
43 // |
44 CSUplink::~CSUplink() |
44 TMSCSUplink::~TMSCSUplink() |
45 { |
45 { |
46 } |
46 } |
47 |
47 |
48 // --------------------------------------------------------------------------- |
48 // ----------------------------------------------------------------------------- |
49 // Gives mic mute state |
49 // Gives mic mute state |
50 // --------------------------------------------------------------------------- |
50 // ----------------------------------------------------------------------------- |
51 // |
51 // |
52 TBool CSUplink::IsMuted() |
52 TBool TMSCSUplink::IsMuted() |
53 { |
53 { |
54 TBool isMuted = EFalse; |
54 TBool isMuted = EFalse; |
55 gint gain = 0; |
55 gint gain = 0; |
56 if (iDevSound) |
56 if (iDevSound) |
57 { |
57 { |
60 if (!gain) |
60 if (!gain) |
61 { |
61 { |
62 // Mute is on |
62 // Mute is on |
63 isMuted = ETrue; |
63 isMuted = ETrue; |
64 } |
64 } |
65 // CSPLOGSTRING( CSPINT, "CSUplink::IsMuted" ); |
65 // CSPLOGSTRING( CSPINT, "TMSCSUplink::IsMuted" ); |
66 return isMuted; |
66 return isMuted; |
67 } |
67 } |
68 |
68 |
69 // --------------------------------------------------------------------------- |
69 // ----------------------------------------------------------------------------- |
70 // Set mic muted. |
70 // Set mic muted. |
71 // --------------------------------------------------------------------------- |
71 // ----------------------------------------------------------------------------- |
72 // |
72 // |
73 void CSUplink::SetMuted() |
73 void TMSCSUplink::SetMuted() |
74 { |
74 { |
75 if (iDevSound) |
75 if (iDevSound) |
76 { |
76 { |
77 iDevSound->SetGain(KSetMuteToDevSound); |
77 iDevSound->SetGain(KSetMuteToDevSound); |
78 } |
78 } |
79 } |
79 } |
80 |
80 |
81 // --------------------------------------------------------------------------- |
81 // ----------------------------------------------------------------------------- |
82 // Set mic unmuted |
82 // Set mic unmuted |
83 // --------------------------------------------------------------------------- |
83 // ----------------------------------------------------------------------------- |
84 // |
84 // |
85 void CSUplink::SetUnmuted() |
85 void TMSCSUplink::SetUnmuted() |
86 { |
86 { |
87 if (iDevSound) |
87 if (iDevSound) |
88 { |
88 { |
89 iDevSound->SetGain(iDevSound->MaxGain()); |
89 iDevSound->SetGain(iDevSound->MaxGain()); |
90 } |
90 } |
91 } |
91 } |
92 |
92 |
93 // --------------------------------------------------------------------------- |
93 // ----------------------------------------------------------------------------- |
94 // Sets gain |
94 // Sets gain |
95 // --------------------------------------------------------------------------- |
95 // ----------------------------------------------------------------------------- |
96 // |
96 // |
97 void CSUplink::SetGain(gint aGain) |
97 void TMSCSUplink::SetGain(gint aGain) |
98 { |
98 { |
99 if (iDevSound) |
99 if (iDevSound) |
100 { |
100 { |
101 iDevSound->SetGain(aGain); |
101 iDevSound->SetGain(aGain); |
102 } |
102 } |
103 } |
103 } |
104 |
104 |
105 // --------------------------------------------------------------------------- |
105 // ----------------------------------------------------------------------------- |
106 // Gives volume |
106 // Gives volume |
107 // --------------------------------------------------------------------------- |
107 // ----------------------------------------------------------------------------- |
108 // |
108 // |
109 gint CSUplink::Gain() |
109 gint TMSCSUplink::Gain() |
110 { |
110 { |
111 gint gain = 0; |
111 gint gain = 0; |
112 if (iDevSound) |
112 if (iDevSound) |
113 { |
113 { |
114 gain = iDevSound->Gain(); |
114 gain = iDevSound->Gain(); |
115 } |
115 } |
116 return gain; |
116 return gain; |
117 } |
117 } |
118 |
118 |
119 // --------------------------------------------------------------------------- |
119 // ----------------------------------------------------------------------------- |
120 // Gives max gain |
120 // Gives max gain |
121 // --------------------------------------------------------------------------- |
121 // ----------------------------------------------------------------------------- |
122 // |
122 // |
123 gint CSUplink::MaxGain() |
123 gint TMSCSUplink::MaxGain() |
124 { |
124 { |
125 gint gain = 0; |
125 gint gain = 0; |
126 if (iDevSound) |
126 if (iDevSound) |
127 { |
127 { |
128 gain = iDevSound->MaxGain(); |
128 gain = iDevSound->MaxGain(); |
129 } |
129 } |
130 return gain; |
130 return gain; |
131 } |
131 } |
132 |
132 |
133 // --------------------------------------------------------------------------- |
133 // ----------------------------------------------------------------------------- |
134 // From class MDevSoundObserver |
134 // From class MDevSoundObserver |
135 // Activation was successfull. |
135 // Activation was successfull. |
136 // --------------------------------------------------------------------------- |
136 // ----------------------------------------------------------------------------- |
137 // |
137 // |
138 void CSUplink::BufferToBeEmptied(CMMFBuffer* /*aBuffer*/) |
138 void TMSCSUplink::BufferToBeEmptied(CMMFBuffer* /*aBuffer*/) |
139 { |
139 { |
140 // CSPLOGSTRING( CSPINT, "CSUplink::BufferToBeEmptied" ); |
140 // CSPLOGSTRING( CSPINT, "TMSCSUplink::BufferToBeEmptied" ); |
141 |
141 |
142 // We dont react to devsound messages unless we are activating. |
142 // We dont react to devsound messages unless we are activating. |
143 if (IsActivationOngoing()) |
143 if (IsActivationOngoing()) |
144 { |
144 { |
145 iActive = ETrue; |
145 iActive = ETrue; |
146 iActivationOngoing = EFalse; |
146 iActivationOngoing = EFalse; |
147 iObserver.UplinkActivatedSuccessfully(); |
147 iObserver.UplinkActivatedSuccessfully(); |
148 } |
148 } |
149 } |
149 } |
150 |
150 |
151 // --------------------------------------------------------------------------- |
151 // ----------------------------------------------------------------------------- |
152 // From class MDevSoundObserver |
152 // From class MDevSoundObserver |
153 // Activation feiled |
153 // Activation feiled |
154 // --------------------------------------------------------------------------- |
154 // ----------------------------------------------------------------------------- |
155 // |
155 // |
156 void CSUplink::RecordError(TInt aError) |
156 void TMSCSUplink::RecordError(TInt aError) |
157 { |
157 { |
158 // CSPLOGSTRING( CSPINT, "CSUplink::RecordError" ); |
158 // CSPLOGSTRING( CSPINT, "TMSCSUplink::RecordError" ); |
159 |
159 |
160 // We dont react to devsound messages unless we are activating. |
160 // We dont react to devsound messages unless we are activating. |
161 if (IsActivationOngoing()) |
161 if (IsActivationOngoing()) |
162 { |
162 { |
163 if (aError == KErrAccessDenied) |
163 if (aError == KErrAccessDenied) |
166 iObserver.UplinkActivationFailed(); |
166 iObserver.UplinkActivationFailed(); |
167 } |
167 } |
168 } |
168 } |
169 } |
169 } |
170 |
170 |
171 // --------------------------------------------------------------------------- |
171 // ----------------------------------------------------------------------------- |
172 // From class CSPDevSound |
172 // From class TMSCSPDevSound |
173 // Tries to activate mic stream. Stream becomes active when BufferToBeFilled |
173 // Tries to activate mic stream. Stream becomes active when BufferToBeFilled |
174 // gets called. |
174 // gets called. |
175 // --------------------------------------------------------------------------- |
175 // ----------------------------------------------------------------------------- |
176 // |
176 // |
177 void CSUplink::DoActivateL() |
177 void TMSCSUplink::DoActivateL() |
178 { |
178 { |
179 if (iDevSound) |
179 if (iDevSound) |
180 { |
180 { |
181 iDevSound->RecordInitL(); |
181 iDevSound->RecordInitL(); |
182 } |
182 } |
183 } |
183 } |
184 |
184 |
185 // --------------------------------------------------------------------------- |
185 // ----------------------------------------------------------------------------- |
186 // Constructor |
186 // Constructor |
187 // --------------------------------------------------------------------------- |
187 // ----------------------------------------------------------------------------- |
188 // |
188 // |
189 CSUplink::CSUplink(MCSPDevSoundObserver& aObserver) : |
189 TMSCSUplink::TMSCSUplink(TMSCSPDevSoundObserver& aObserver) : |
190 CSPDevSound(aObserver) |
190 TMSCSPDevSound(aObserver) |
191 { |
191 { |
192 } |
192 } |
193 |
193 |
194 // --------------------------------------------------------------------------- |
194 // ----------------------------------------------------------------------------- |
195 // Second phase constructor |
195 // Second phase constructor |
196 // --------------------------------------------------------------------------- |
196 // ----------------------------------------------------------------------------- |
197 // |
197 // |
198 void CSUplink::ConstructL() |
198 void TMSCSUplink::ConstructL() |
199 { |
199 { |
200 CSPDevSound::ConstructL(EMMFStateRecording, KAudioPrefCSCallUplink, |
200 TMSCSPDevSound::ConstructL(EMMFStateRecording, KAudioPrefCSCallUplink, |
201 KAudioPriorityCSCallUplink); |
201 KAudioPriorityCSCallUplink); |
202 } |
202 } |
203 |
203 |
204 // End of File |
204 // End of File |