|
1 /* |
|
2 * Copyright (c) 2009 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: Telephony Multimedia Service |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <AudioPreference.h> |
|
19 #include <glib.h> |
|
20 #include <S60FourCC.h> |
|
21 #include "tmscsdevsound.h" |
|
22 #include "tmscsdevsoundobserver.h" |
|
23 |
|
24 using namespace TMS; |
|
25 |
|
26 // ----------------------------------------------------------------------------- |
|
27 // TMSCSPDevSound |
|
28 // ----------------------------------------------------------------------------- |
|
29 // |
|
30 TMSCSPDevSound::TMSCSPDevSound(TMSCSPDevSoundObserver& aObserver) : |
|
31 iObserver(aObserver) |
|
32 { |
|
33 } |
|
34 |
|
35 // ----------------------------------------------------------------------------- |
|
36 // ConstructL |
|
37 // ----------------------------------------------------------------------------- |
|
38 // |
|
39 void TMSCSPDevSound::ConstructL(TMMFState aMode, gint aAudioPreference, |
|
40 gint aAudioPriority) |
|
41 { |
|
42 TMMFPrioritySettings audioPriority; |
|
43 TFourCC modemFourCC; |
|
44 modemFourCC.Set(KS60FourCCCodeModem); |
|
45 iDevSound = CMMFDevSound::NewL(); |
|
46 if (iDevSound) |
|
47 { |
|
48 #ifndef __WINSCW__ |
|
49 iDevSound->InitializeL(*this, modemFourCC, aMode); |
|
50 #else //For testing TMS in WINSCW |
|
51 iDevSound->InitializeL(*this, KMMFFourCCCodePCM16, aMode); |
|
52 #endif |
|
53 iStreamType = aAudioPreference; |
|
54 audioPriority.iPriority = aAudioPriority; |
|
55 audioPriority.iPref = aAudioPreference; |
|
56 audioPriority.iState = aMode; |
|
57 iDevSound->SetPrioritySettings(audioPriority); |
|
58 } |
|
59 } |
|
60 |
|
61 // ----------------------------------------------------------------------------- |
|
62 // From class MDevSoundObserver |
|
63 // Not implemented |
|
64 // ----------------------------------------------------------------------------- |
|
65 // |
|
66 TMSCSPDevSound::~TMSCSPDevSound() |
|
67 { |
|
68 delete iDevSound; |
|
69 } |
|
70 |
|
71 // ----------------------------------------------------------------------------- |
|
72 // Tries to activate the audio stream if not active or activating |
|
73 // ----------------------------------------------------------------------------- |
|
74 // |
|
75 void TMSCSPDevSound::Activate() |
|
76 { |
|
77 if (!IsActive() && !IsActivationOngoing()) |
|
78 { |
|
79 iActivationOngoing = ETrue; |
|
80 TRAP_IGNORE(DoActivateL()); |
|
81 } |
|
82 } |
|
83 |
|
84 // ----------------------------------------------------------------------------- |
|
85 // Deactivates the audio device. |
|
86 // ----------------------------------------------------------------------------- |
|
87 // |
|
88 void TMSCSPDevSound::Deactivate() |
|
89 { |
|
90 if (iDevSound && (IsActive() || IsActivationOngoing())) |
|
91 { |
|
92 iDevSound->Stop(); |
|
93 iActive = EFalse; |
|
94 iActivationOngoing = EFalse; |
|
95 } |
|
96 } |
|
97 |
|
98 // ----------------------------------------------------------------------------- |
|
99 // ActivationOngoing |
|
100 // ----------------------------------------------------------------------------- |
|
101 // |
|
102 TBool TMSCSPDevSound::IsActivationOngoing() const |
|
103 { |
|
104 return iActivationOngoing; |
|
105 } |
|
106 |
|
107 // ----------------------------------------------------------------------------- |
|
108 // IsActive |
|
109 // ----------------------------------------------------------------------------- |
|
110 // |
|
111 TBool TMSCSPDevSound::IsActive() const |
|
112 { |
|
113 return iActive; |
|
114 } |
|
115 |
|
116 // ----------------------------------------------------------------------------- |
|
117 // DevSound |
|
118 // ----------------------------------------------------------------------------- |
|
119 // |
|
120 CMMFDevSound& TMSCSPDevSound::DevSound() |
|
121 { |
|
122 return *iDevSound; |
|
123 } |
|
124 |
|
125 // ----------------------------------------------------------------------------- |
|
126 // From class MDevSoundObserver |
|
127 // Not implemented |
|
128 // ----------------------------------------------------------------------------- |
|
129 // |
|
130 void TMSCSPDevSound::InitializeComplete(TInt aError) |
|
131 { |
|
132 if (iStreamType == KAudioPrefCSCallDownlink) |
|
133 { |
|
134 iObserver.DownlinkInitCompleted(aError); |
|
135 } |
|
136 else |
|
137 { |
|
138 iObserver.UplinkInitCompleted(aError); |
|
139 } |
|
140 } |
|
141 |
|
142 // ----------------------------------------------------------------------------- |
|
143 // From class MDevSoundObserver |
|
144 // Not implemented |
|
145 // ----------------------------------------------------------------------------- |
|
146 // |
|
147 void TMSCSPDevSound::BufferToBeFilled(CMMFBuffer* /*aBuffer*/) |
|
148 { |
|
149 } |
|
150 |
|
151 // ----------------------------------------------------------------------------- |
|
152 // From class MDevSoundObserver |
|
153 // Not implemented |
|
154 // ----------------------------------------------------------------------------- |
|
155 // |
|
156 void TMSCSPDevSound::PlayError(TInt /*aError*/) |
|
157 { |
|
158 } |
|
159 |
|
160 // ----------------------------------------------------------------------------- |
|
161 // From class MDevSoundObserver |
|
162 // Not implemented |
|
163 // ----------------------------------------------------------------------------- |
|
164 // |
|
165 void TMSCSPDevSound::ToneFinished(TInt /*aError*/) |
|
166 { |
|
167 } |
|
168 |
|
169 // ----------------------------------------------------------------------------- |
|
170 // From class MDevSoundObserver |
|
171 // Not implemented |
|
172 // ----------------------------------------------------------------------------- |
|
173 // |
|
174 void TMSCSPDevSound::BufferToBeEmptied(CMMFBuffer* /*aBuffer*/) |
|
175 { |
|
176 } |
|
177 |
|
178 // ----------------------------------------------------------------------------- |
|
179 // From class MDevSoundObserver |
|
180 // Not implemented |
|
181 // ----------------------------------------------------------------------------- |
|
182 // |
|
183 void TMSCSPDevSound::RecordError(TInt /*aError*/) |
|
184 { |
|
185 } |
|
186 |
|
187 // ----------------------------------------------------------------------------- |
|
188 // From class MDevSoundObserver |
|
189 // Not implemented |
|
190 // ----------------------------------------------------------------------------- |
|
191 // |
|
192 void TMSCSPDevSound::ConvertError(TInt /*aError*/) |
|
193 { |
|
194 } |
|
195 |
|
196 // ----------------------------------------------------------------------------- |
|
197 // From class MDevSoundObserver |
|
198 // Not implemented |
|
199 // ----------------------------------------------------------------------------- |
|
200 // |
|
201 void TMSCSPDevSound::DeviceMessage(TUid /*aMessageType*/, |
|
202 const TDesC8& /*aMsg*/) |
|
203 { |
|
204 } |
|
205 |
|
206 // End of File |