37
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-2010 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: This module contains the implementation of AudioData class
|
|
15 |
* member functions
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
// INCLUDE FILES
|
|
20 |
#include "cpeaudiodata.h"
|
|
21 |
|
|
22 |
#include <AudioPreference.h>
|
|
23 |
#include <mpephonemodelinternal.h>
|
|
24 |
#include <mpedatastore.h>
|
|
25 |
#include <mpeexternaldatahandler.h>
|
|
26 |
#include <talogger.h>
|
|
27 |
#include <telmicmutestatuspskeys.h>
|
|
28 |
#include <PSVariables.h>
|
|
29 |
#include <tms.h>
|
|
30 |
#include <tmseffectobsrvr.h>
|
|
31 |
#include <tmsglobalvoleffect.h>
|
|
32 |
#include "pepanic.pan"
|
|
33 |
#include "cpeaudiodtmftoneplayer.h"
|
|
34 |
#include "cpeaudioroutingmonitor.h"
|
|
35 |
#include "cpecallaudioroutinghandler.h"
|
|
36 |
#include "cpeaudiofactory.h"
|
|
37 |
#include "cpeaudioeffect.h"
|
|
38 |
|
|
39 |
#include <telinternalpskeys.h>
|
|
40 |
|
|
41 |
// CONSTANTS
|
|
42 |
//Mute Value for volume
|
|
43 |
const TInt KPEMaxVolume = 10;
|
|
44 |
|
|
45 |
// ================= MEMBER FUNCTIONS =======================
|
|
46 |
|
|
47 |
// -----------------------------------------------------------------------------
|
|
48 |
// CPEAudioData::CPEAudioData
|
|
49 |
// C++ default constructor can NOT contain any code, that
|
|
50 |
// might leave.
|
|
51 |
// -----------------------------------------------------------------------------
|
|
52 |
//
|
|
53 |
CPEAudioData::CPEAudioData(MPEPhoneModelInternal& aPhoneModel) :
|
|
54 |
iPhoneModel(aPhoneModel)
|
|
55 |
{
|
|
56 |
iRouteInitialized = EFalse;
|
|
57 |
}
|
|
58 |
|
|
59 |
// -----------------------------------------------------------------------------
|
|
60 |
// CPEAudioData::ConstructL
|
|
61 |
// Symbian 2nd phase constructor can leave
|
|
62 |
// -----------------------------------------------------------------------------
|
|
63 |
//
|
|
64 |
void CPEAudioData::ConstructL(CPEAudioFactory& aAudioFactory)
|
|
65 |
{
|
|
66 |
TEFLOGSTRING( KTAOBJECT, "AUD CPEAudioData::ConstructL start" );
|
|
67 |
iAudioRoutingMonitor = CPEAudioRoutingMonitor::NewL(*this);
|
|
68 |
iAudioRouting = aAudioFactory.CreateTelephonyAudioRoutingL(
|
|
69 |
*iAudioRoutingMonitor);
|
|
70 |
iAudioRoutingHandler = CPECallAudioRoutingHandler::NewL(*this);
|
|
71 |
iAudioEffect = CPEAudioEffect::NewL(*this);
|
|
72 |
|
|
73 |
InitializeAudioVolume();
|
|
74 |
|
|
75 |
TEFLOGSTRING( KTAINT, "AUD CPEAudioData::ConstructL complete" );
|
|
76 |
}
|
|
77 |
|
|
78 |
// Destructor
|
|
79 |
EXPORT_C CPEAudioData::~CPEAudioData()
|
|
80 |
{
|
|
81 |
TEFLOGSTRING( KTAOBJECT, "AUD CPEAudioData::~CPEAudioData" );
|
|
82 |
|
|
83 |
delete iAudioRouting;
|
|
84 |
delete iAudioRoutingMonitor;
|
|
85 |
delete iAudioRoutingHandler;
|
|
86 |
|
|
87 |
iPEavailableOutputs.Close();
|
|
88 |
|
|
89 |
delete iAudioEffect;
|
|
90 |
}
|
|
91 |
|
|
92 |
// -----------------------------------------------------------------------------
|
|
93 |
// CPEAudioData::InitializeAudioVolume
|
|
94 |
// Gets audio volume value
|
|
95 |
// -----------------------------------------------------------------------------
|
|
96 |
//
|
|
97 |
void CPEAudioData::InitializeAudioVolume()
|
|
98 |
{
|
|
99 |
TInt volume = iAudioEffect->Volume();
|
|
100 |
iPhoneModel.DataStore()->SetAudioVolume(volume);
|
|
101 |
|
|
102 |
TEFLOGSTRING2( KTAINT,
|
|
103 |
"AUD CPEAudioData::InitializeAudioVolumes, volume = %d",
|
|
104 |
volume );
|
|
105 |
}
|
|
106 |
|
|
107 |
// -----------------------------------------------------------------------------
|
|
108 |
// CPEAudioData::GetAudioMuteSync
|
|
109 |
// Creates synchronous request to get Audio Mute value.
|
|
110 |
// (other items were commented in a header).
|
|
111 |
// -----------------------------------------------------------------------------
|
|
112 |
//
|
|
113 |
EXPORT_C void CPEAudioData::GetAudioMuteSync(TBool& aAudioMute) const
|
|
114 |
{
|
|
115 |
aAudioMute = iAudioEffect->MuteState();
|
|
116 |
TEFLOGSTRING2(
|
|
117 |
KTAREQIN,
|
|
118 |
"AUD CPEAudioData::GetAudioMuteSync: value = %d",
|
|
119 |
aAudioMute);
|
|
120 |
|
|
121 |
}
|
|
122 |
|
|
123 |
// -----------------------------------------------------------------------------
|
|
124 |
// CPEAudioData::GetAudioVolumeSync
|
|
125 |
// Creates synchronous request to get audio volume.
|
|
126 |
// -----------------------------------------------------------------------------
|
|
127 |
//
|
|
128 |
EXPORT_C void CPEAudioData::GetAudioVolumeSync(TInt& aAudioVolume) const
|
|
129 |
{
|
|
130 |
TEFLOGSTRING( KTAINT, "AUD CPEAudioData::GetAudioVolumeSync" );
|
|
131 |
aAudioVolume = iAudioEffect->Volume();
|
|
132 |
}
|
|
133 |
|
|
134 |
// -----------------------------------------------------------------------------
|
|
135 |
// CPEAudioData::SendErrorMessage
|
|
136 |
// Saves errorcode to member variable and sends error notification to PhoneEngine.
|
|
137 |
// -----------------------------------------------------------------------------
|
|
138 |
//
|
|
139 |
void CPEAudioData::SendErrorMessage(const TInt aErrorCode)
|
|
140 |
{
|
|
141 |
iPhoneModel.DataStore()->SetErrorCode(aErrorCode);
|
|
142 |
TEFLOGSTRING(
|
|
143 |
KTAREQOUT,
|
|
144 |
"AUD CPEAudioData::SendErrorMessage: iPhoneModel.SendMessage( MEngineMonitor::EPEMessageAudioHandlingError )" );
|
|
145 |
iPhoneModel.SendMessage(MEngineMonitor::EPEMessageAudioHandlingError);
|
|
146 |
}
|
|
147 |
|
|
148 |
// -----------------------------------------------------------------------------
|
|
149 |
// CPEAudioData::SendMessage
|
|
150 |
// Forwards message to PhoneEngine.
|
|
151 |
// -----------------------------------------------------------------------------
|
|
152 |
//
|
|
153 |
void CPEAudioData::SendMessage(
|
|
154 |
const MEngineMonitor::TPEMessagesFromPhoneEngine aMessage)
|
|
155 |
{
|
|
156 |
TEFLOGSTRING2( KTAREQIN,
|
|
157 |
"AUD CPEAudioData::SendMessage: aMessage = %d", aMessage );
|
|
158 |
|
|
159 |
if (aMessage == MEngineMonitor::EPEMessageAudioVolumeChanged)
|
|
160 |
{
|
|
161 |
// update volume
|
|
162 |
TInt volume = iPhoneModel.DataStore()->AudioVolume();
|
|
163 |
TEFLOGSTRING2( KTAINT,
|
|
164 |
"AUD CPEAudioData::SendMessage: volume = %d",
|
|
165 |
volume );
|
|
166 |
}
|
|
167 |
|
|
168 |
iPhoneModel.SendMessage(aMessage);
|
|
169 |
}
|
|
170 |
|
|
171 |
// -----------------------------------------------------------------------------
|
|
172 |
// CPEAudioData::SendMessage
|
|
173 |
// Forwards message to PhoneEngine. Output mode is saved.
|
|
174 |
// -----------------------------------------------------------------------------
|
|
175 |
//
|
|
176 |
void CPEAudioData::SendMessage(
|
|
177 |
const MEngineMonitor::TPEMessagesFromPhoneEngine aMessage,
|
|
178 |
const CTelephonyAudioRouting::TAudioOutput aOutput)
|
|
179 |
{
|
|
180 |
TEFLOGSTRING3(
|
|
181 |
KTAREQIN,
|
|
182 |
"AUD CPEAudioData::SendMessage: aMessage = %d, aOutput = %d",
|
|
183 |
aMessage, aOutput );
|
|
184 |
|
|
185 |
// BT long key press requires manual re-route to handset or loudspeaker
|
|
186 |
if (aOutput == CTelephonyAudioRouting::ENone
|
|
187 |
&& iAudioRouting->PreviousOutput()
|
|
188 |
== CTelephonyAudioRouting::EBTAudioAccessory)
|
|
189 |
{
|
|
190 |
SetRoutePreference(ETrue);
|
|
191 |
}
|
|
192 |
else
|
|
193 |
{
|
|
194 |
// update the audio values in engineinfo
|
|
195 |
TBool status;
|
|
196 |
iAudioRouting->GetShowNote(status);
|
|
197 |
iPhoneModel.DataStore()->SetAudioOutput(ConvertToPE(aOutput),
|
|
198 |
ConvertToPE(PreviousOutput()), status);
|
|
199 |
iPhoneModel.SendMessage(aMessage);
|
|
200 |
}
|
|
201 |
}
|
|
202 |
|
|
203 |
// -----------------------------------------------------------------------------
|
|
204 |
// CPEAudioData::SendMessage
|
|
205 |
// Forwards message to PhoneEngine.
|
|
206 |
// -----------------------------------------------------------------------------
|
|
207 |
//
|
|
208 |
void CPEAudioData::SendMessage(
|
|
209 |
const MEngineMonitor::TPEMessagesFromPhoneEngine aMessage,
|
|
210 |
CTelephonyAudioRouting& aTelephonyAudioRouting)
|
|
211 |
{
|
|
212 |
TEFLOGSTRING2(
|
|
213 |
KTAREQIN,
|
|
214 |
"AUD CPEAudioData::SendMessage: aMessage = %d, available outputs changed ", aMessage );
|
|
215 |
iPhoneModel.DataStore()->SetAvailableAudioOutputs(GetAvailableOutputs(
|
|
216 |
aTelephonyAudioRouting));
|
|
217 |
|
|
218 |
if (iRouteInitialized && aMessage
|
|
219 |
== MEngineMonitor::EPEMessageAvailableAudioOutputsChanged)
|
|
220 |
{
|
|
221 |
iAudioRoutingHandler->HandleAudioRoutingAvailableChanged();
|
|
222 |
}
|
|
223 |
|
|
224 |
iPhoneModel.SendMessage(aMessage);
|
|
225 |
}
|
|
226 |
|
|
227 |
// -----------------------------------------------------------------------------
|
|
228 |
// CPEAudioData::SetAudioMuteSync
|
|
229 |
// Creates synchronous request to set audio mute.
|
|
230 |
// EPEMessageAudioMuteChanged message is sent when gain is changed
|
|
231 |
// -----------------------------------------------------------------------------
|
|
232 |
//
|
|
233 |
EXPORT_C void CPEAudioData::SetAudioMuteSync(const TBool aAudioMute) // Mute value to be set
|
|
234 |
{
|
|
235 |
TEFLOGSTRING( KTAINT, "AUD CPEAudioData::SetAudioMuteSync" );
|
|
236 |
|
|
237 |
if (aAudioMute)
|
|
238 |
{
|
|
239 |
iPhoneModel.DataStore()->SetAudioMute(aAudioMute);
|
|
240 |
SendMessage(MEngineMonitor::EPEMessageAudioMuteChanged);
|
|
241 |
TInt err = iAudioEffect->SetMuteState(ETrue);
|
|
242 |
TEFLOGSTRING2(
|
|
243 |
KTAREQOUT,
|
|
244 |
"AUD CPEAudioData::SetAudioMuteSync: error = %d",
|
|
245 |
err );
|
|
246 |
}
|
|
247 |
else
|
|
248 |
{
|
|
249 |
iPhoneModel.DataStore()->SetAudioMute(aAudioMute);
|
|
250 |
SendMessage(MEngineMonitor::EPEMessageAudioMuteChanged);
|
|
251 |
TInt err = iAudioEffect->SetMuteState(EFalse);
|
|
252 |
TEFLOGSTRING2(
|
|
253 |
KTAREQOUT,
|
|
254 |
"AUD CPEAudioData::SetAudioMuteSync: error = %d",
|
|
255 |
err );
|
|
256 |
}
|
|
257 |
}
|
|
258 |
|
|
259 |
// -----------------------------------------------------------------------------
|
|
260 |
// CPEAudioData::SetAudioVolumeSync
|
|
261 |
// Creates synchronous request to set audio volume.
|
|
262 |
// -----------------------------------------------------------------------------
|
|
263 |
//
|
|
264 |
EXPORT_C void CPEAudioData::SetAudioVolumeSync(const TInt aAudioVolume) // Volume to be set
|
|
265 |
{
|
|
266 |
TEFLOGSTRING2(
|
|
267 |
KTAREQIN,
|
|
268 |
"AUD CPEAudioData::SetAudioVolumeSync, aAudioVolume = %d",
|
|
269 |
aAudioVolume );
|
|
270 |
|
|
271 |
if (aAudioVolume <= KPEMaxVolume)
|
|
272 |
{
|
|
273 |
TEFLOGSTRING2( KTAINT,
|
|
274 |
"AUD CPEAudioData::SetAudioVolumeSync, aAudioVolume = %d",
|
|
275 |
aAudioVolume );
|
|
276 |
|
|
277 |
iAudioEffect->SetVolume(aAudioVolume);
|
|
278 |
}
|
|
279 |
DoHandleVolumeChange(aAudioVolume, ETrue);
|
|
280 |
}
|
|
281 |
|
|
282 |
// -----------------------------------------------------------------------------
|
|
283 |
// CPEAudioData::SetAudioOutput
|
|
284 |
// Makes request to Telephony Audio Routing to set audio output path
|
|
285 |
// -----------------------------------------------------------------------------
|
|
286 |
//
|
|
287 |
EXPORT_C TInt CPEAudioData::SetAudioOutput(const TPEAudioOutput aOutput,
|
|
288 |
TBool aShowNote)
|
|
289 |
{
|
|
290 |
TEFLOGSTRING2(
|
|
291 |
KTAREQIN,
|
|
292 |
"AUD CPEAudioData::SetAudioOutput: aOutput = %d",
|
|
293 |
aOutput );
|
|
294 |
|
|
295 |
TInt error(KErrNone);
|
|
296 |
|
|
297 |
TEFLOGSTRING2( KTAERROR,
|
|
298 |
"AUD CPEAudioData::SetAudioOutput: iRouteInitialized (%d)"
|
|
299 |
, iRouteInitialized );
|
|
300 |
|
|
301 |
if (iRouteInitialized && iPhoneModel.DataStore()->AudioOutputAvailable(
|
|
302 |
aOutput))
|
|
303 |
{
|
|
304 |
SetTAROutput(ConvertToTAR(aOutput), aShowNote);
|
|
305 |
}
|
|
306 |
else
|
|
307 |
{
|
|
308 |
if (aOutput == EPEHandset)
|
|
309 |
{
|
|
310 |
iAudioRoutingHandler->SetAnswerToHandset(ETrue);
|
|
311 |
}
|
|
312 |
else
|
|
313 |
{
|
|
314 |
TEFLOGSTRING2( KTAERROR,
|
|
315 |
"AUD CPEAudioData::SetAudioOutput: Requested audio path not available (%d)"
|
|
316 |
, aOutput );
|
|
317 |
error = KErrArgument;
|
|
318 |
}
|
|
319 |
}
|
|
320 |
|
|
321 |
return error;
|
|
322 |
}
|
|
323 |
|
|
324 |
// -----------------------------------------------------------------------------
|
|
325 |
// CPEAudioData::SetTAROutput
|
|
326 |
// -----------------------------------------------------------------------------
|
|
327 |
//
|
|
328 |
void CPEAudioData::SetTAROutput(CTelephonyAudioRouting::TAudioOutput aOutput,
|
|
329 |
TBool aShowNote)
|
|
330 |
{
|
|
331 |
TEFLOGSTRING2(
|
|
332 |
KTAREQIN,
|
|
333 |
"AUD CPEAudioData::SetTAROutput: aOutput = %d",
|
|
334 |
aOutput );
|
|
335 |
|
|
336 |
#if defined(__WINSCW__ ) && !defined(UNIT_TESTING)
|
|
337 |
iAudioRouting->SetShowNote(aShowNote);
|
|
338 |
SendMessage(MEngineMonitor::EPEMessageAudioOutputChanged, aOutput);
|
|
339 |
#else
|
|
340 |
CTelephonyAudioRouting::TAudioOutput output = iAudioRouting->Output();
|
|
341 |
|
|
342 |
if ( output == aOutput )
|
|
343 |
{
|
|
344 |
// audio routing cannot changed
|
|
345 |
TEFLOGSTRING2( KTAERROR,
|
|
346 |
"AUD CPEAudioData::SetTAROutput: audio path already (%d)"
|
|
347 |
, aOutput );
|
|
348 |
return;
|
|
349 |
}
|
|
350 |
iAudioRouting->SetShowNote( aShowNote );
|
|
351 |
TRAPD( err, iAudioRouting->SetOutputL( aOutput ) );
|
|
352 |
|
|
353 |
if( err )
|
|
354 |
{
|
|
355 |
TEFLOGSTRING2( KTAERROR,
|
|
356 |
"AUD CPEAudioData::SetTAROutput:Leave.1 (%d)", err );
|
|
357 |
switch ( aOutput )
|
|
358 |
{
|
|
359 |
case CTelephonyAudioRouting::ELoudspeaker:
|
|
360 |
case CTelephonyAudioRouting::EWiredAudioAccessory:
|
|
361 |
case CTelephonyAudioRouting::EBTAudioAccessory:
|
|
362 |
// if leave try handset
|
|
363 |
TRAPD( err2, iAudioRouting->SetOutputL( CTelephonyAudioRouting::EHandset ) );
|
|
364 |
if( err2 )
|
|
365 |
{
|
|
366 |
TEFLOGSTRING2( KTAERROR,
|
|
367 |
"AUD CPEAudioData::SetTAROutput:Leave.2 (%d)", err );
|
|
368 |
}
|
|
369 |
break;
|
|
370 |
default:
|
|
371 |
// None
|
|
372 |
break;
|
|
373 |
}
|
|
374 |
}
|
|
375 |
#endif
|
|
376 |
}
|
|
377 |
|
|
378 |
// -----------------------------------------------------------------------------
|
|
379 |
// CPEAudioData::StartUp
|
|
380 |
// Gets initial values and inializes TAR
|
|
381 |
// StartUpL methods.
|
|
382 |
// -----------------------------------------------------------------------------
|
|
383 |
//
|
|
384 |
EXPORT_C void CPEAudioData::StartUp()
|
|
385 |
{
|
|
386 |
TEFLOGSTRING( KTAREQIN, "AUD CPEAudioData::StartUp" );
|
|
387 |
// get available audio output paths and current audio output
|
|
388 |
iPhoneModel.DataStore()->SetAvailableAudioOutputs(GetAvailableOutputs(
|
|
389 |
*iAudioRouting));
|
|
390 |
iPhoneModel.DataStore()->SetAudioOutput(ConvertToPE(
|
|
391 |
iAudioRouting->Output()), ConvertToPE(
|
|
392 |
iAudioRouting->PreviousOutput()), EFalse);
|
|
393 |
}
|
|
394 |
|
|
395 |
// -----------------------------------------------------------------------------
|
|
396 |
// CPEAudioData::GetAvailableOutputs
|
|
397 |
// Gets Available Outputs from Audio routing framework
|
|
398 |
// Return list of available outputs
|
|
399 |
// -----------------------------------------------------------------------------
|
|
400 |
//
|
|
401 |
TArray<TPEAudioOutput> CPEAudioData::GetAvailableOutputs(
|
|
402 |
CTelephonyAudioRouting& aTelephonyAudioRouting)
|
|
403 |
{
|
|
404 |
TEFLOGSTRING( KTAREQOUT,
|
|
405 |
"AUD CPEAudioData::GetAvailableOutputs > CTelephonyAudioRouting::AvailableOutputs()" );
|
|
406 |
TArray<CTelephonyAudioRouting::TAudioOutput> availableOutputs =
|
|
407 |
aTelephonyAudioRouting.AvailableOutputs();
|
|
408 |
|
|
409 |
iPEavailableOutputs.Reset();
|
|
410 |
|
|
411 |
for (TInt j = 0; j < availableOutputs.Count(); j++)
|
|
412 |
{
|
|
413 |
iPEavailableOutputs.Append(ConvertToPE(availableOutputs[j]));
|
|
414 |
TEFLOGSTRING3( KTAINT,
|
|
415 |
"AUD CPEAudioData::GetAvailableOutputs, index: %d, available: %d",
|
|
416 |
j,
|
|
417 |
availableOutputs[j] );
|
|
418 |
}
|
|
419 |
|
|
420 |
return iPEavailableOutputs.Array();
|
|
421 |
}
|
|
422 |
|
|
423 |
// -----------------------------------------------------------------------------
|
|
424 |
// CPEAudioData::HandleCallStarting
|
|
425 |
// -----------------------------------------------------------------------------
|
|
426 |
//
|
|
427 |
EXPORT_C TInt CPEAudioData::HandleCallStarting(TBool aVideoCall)
|
|
428 |
{
|
|
429 |
TEFLOGSTRING( KTAMESINT, "AUD CPEAudioData::HandleCallStarting()" );
|
|
430 |
TInt ret(KErrNone);
|
|
431 |
|
|
432 |
if (!iRouteInitialized) // if route not already initialized
|
|
433 |
{ // Not new route init for multi calls
|
|
434 |
iRouteInitialized = ETrue;
|
|
435 |
ret = iAudioRoutingHandler->HandleAudioRoutingCallInit(aVideoCall);
|
|
436 |
}
|
|
437 |
|
|
438 |
return ret;
|
|
439 |
}
|
|
440 |
|
|
441 |
// -----------------------------------------------------------------------------
|
|
442 |
// CPEAudioData::HandleEnergencyCallStarting
|
|
443 |
// Can be called, if new call is created before previous call is idle state
|
|
444 |
// One used situation is that emergency call is dialed during the video call or
|
|
445 |
// voice call. Audio routing have to initialized when emergency is dialing state
|
|
446 |
// even previous call(voice or video) haven't got idle yet.
|
|
447 |
// -----------------------------------------------------------------------------
|
|
448 |
//
|
|
449 |
EXPORT_C TInt CPEAudioData::HandleEnergencyCallStarting()
|
|
450 |
{
|
|
451 |
TEFLOGSTRING( KTAMESINT, "AUD CPEAudioData::HandleCallSwitching()" );
|
|
452 |
TInt ret(KErrNone);
|
|
453 |
|
|
454 |
// Always new route init
|
|
455 |
ret = iAudioRoutingHandler->HandleAudioRoutingCallInit(EFalse);
|
|
456 |
iRouteInitialized = ETrue;
|
|
457 |
|
|
458 |
return ret;
|
|
459 |
}
|
|
460 |
|
|
461 |
// -----------------------------------------------------------------------------
|
|
462 |
// CPEAudioData::HandleCallEnding()
|
|
463 |
// -----------------------------------------------------------------------------
|
|
464 |
//
|
|
465 |
EXPORT_C void CPEAudioData::HandleCallEnding()
|
|
466 |
{
|
|
467 |
TEFLOGSTRING( KTAMESINT, "AUD CPEAudioData::HandleCallEnding()" );
|
|
468 |
|
|
469 |
if (iRouteInitialized)
|
|
470 |
{
|
|
471 |
iRouteInitialized = EFalse;
|
|
472 |
TEFLOGSTRING( KTAMESINT,
|
|
473 |
"AUD CPEAudioData::HandleCallEnding() > CTelephonyAudioRouting::ENotActive" );
|
|
474 |
SetTAROutput(CTelephonyAudioRouting::ENotActive, EFalse);
|
|
475 |
}
|
|
476 |
}
|
|
477 |
|
|
478 |
// -----------------------------------------------------------------------------
|
|
479 |
// CPEAudioData::CallAudioRoutePreferenceChanged()
|
|
480 |
//
|
|
481 |
// -----------------------------------------------------------------------------
|
|
482 |
//
|
|
483 |
EXPORT_C TInt CPEAudioData::CallAudioRoutePreferenceChanged()
|
|
484 |
{
|
|
485 |
TEFLOGSTRING( KTAMESINT, "AUD CPEAudioData::CallAudioRoutePreferenceChanged()" );
|
|
486 |
if (iRouteInitialized)
|
|
487 |
{
|
|
488 |
return iAudioRoutingHandler->HandleAudioRoutePreferenceChanged();
|
|
489 |
}
|
|
490 |
return KErrNotReady;
|
|
491 |
}
|
|
492 |
|
|
493 |
// -----------------------------------------------------------------------------
|
|
494 |
// CPEAudioData::PreviousOutput
|
|
495 |
// -----------------------------------------------------------------------------
|
|
496 |
//
|
|
497 |
CTelephonyAudioRouting::TAudioOutput CPEAudioData::PreviousOutput()
|
|
498 |
{
|
|
499 |
return iAudioRouting->PreviousOutput();
|
|
500 |
}
|
|
501 |
|
|
502 |
// -----------------------------------------------------------------------------
|
|
503 |
// CPEAudioData::Output
|
|
504 |
// -----------------------------------------------------------------------------
|
|
505 |
//
|
|
506 |
CTelephonyAudioRouting::TAudioOutput CPEAudioData::Output()
|
|
507 |
{
|
|
508 |
return iAudioRouting->Output();
|
|
509 |
}
|
|
510 |
|
|
511 |
// -----------------------------------------------------------------------------
|
|
512 |
// CPEAudioData::SetRoutePreference
|
|
513 |
// -----------------------------------------------------------------------------
|
|
514 |
//
|
|
515 |
void CPEAudioData::SetRoutePreference(TBool aShowNote)
|
|
516 |
{
|
|
517 |
TEFLOGSTRING( KTAMESINT, "AUD CPEAudioData::SetRoutePreference()" );
|
|
518 |
CTelephonyAudioRouting::TAudioOutput output =
|
|
519 |
CTelephonyAudioRouting::EHandset;
|
|
520 |
|
|
521 |
const TInt outputPreference =
|
|
522 |
iPhoneModel.DataStore()->AudioOutputPreference();
|
|
523 |
if (outputPreference == EPSAudioPublic)
|
|
524 |
{
|
|
525 |
output = CTelephonyAudioRouting::ELoudspeaker;
|
|
526 |
}
|
|
527 |
TInt error;
|
|
528 |
iAudioRouting->SetShowNote(aShowNote);
|
|
529 |
TRAP( error, iAudioRouting->SetOutputL( output ) );
|
|
530 |
TEFLOGSTRING2( KTAMESINT, "AUD CPEAudioData::SetRoutePreference() err %d", error );
|
|
531 |
}
|
|
532 |
|
|
533 |
// -----------------------------------------------------------------------------
|
|
534 |
// CPEAudioData::RoutePreference
|
|
535 |
// -----------------------------------------------------------------------------
|
|
536 |
//
|
|
537 |
CTelephonyAudioRouting::TAudioOutput CPEAudioData::RoutePreference()
|
|
538 |
{
|
|
539 |
CTelephonyAudioRouting::TAudioOutput output =
|
|
540 |
CTelephonyAudioRouting::EHandset;
|
|
541 |
|
|
542 |
const TInt outputPreference =
|
|
543 |
iPhoneModel.DataStore()->AudioOutputPreference();
|
|
544 |
if (outputPreference == EPSAudioPublic)
|
|
545 |
{
|
|
546 |
output = CTelephonyAudioRouting::ELoudspeaker;
|
|
547 |
}
|
|
548 |
TEFLOGSTRING2( KTAMESINT, "AUD CPEAudioData::RoutePreference() output %d", output );
|
|
549 |
return output;
|
|
550 |
}
|
|
551 |
// -----------------------------------------------------------------------------
|
|
552 |
// CPEAudioData::IsWiredAvailable
|
|
553 |
// -----------------------------------------------------------------------------
|
|
554 |
//
|
|
555 |
TBool CPEAudioData::IsWiredAvailable()
|
|
556 |
{
|
|
557 |
return iPhoneModel.DataStore()->AudioOutputAvailable(
|
|
558 |
EPEWiredAudioAccessory);
|
|
559 |
}
|
|
560 |
|
|
561 |
// -----------------------------------------------------------------------------
|
|
562 |
// CPEAudioData::IsBTAvailable
|
|
563 |
// -----------------------------------------------------------------------------
|
|
564 |
//
|
|
565 |
TBool CPEAudioData::IsBTAvailable()
|
|
566 |
{
|
|
567 |
return iPhoneModel.DataStore()->AudioOutputAvailable(EPEBTAudioAccessory);
|
|
568 |
}
|
|
569 |
|
|
570 |
// -----------------------------------------------------------------------------
|
|
571 |
// CPEAudioData::IsTTYAvailable
|
|
572 |
// -----------------------------------------------------------------------------
|
|
573 |
//
|
|
574 |
TBool CPEAudioData::IsTTYAvailable()
|
|
575 |
{
|
|
576 |
return iPhoneModel.DataStore()->AudioOutputAvailable(EPETTY);
|
|
577 |
}
|
|
578 |
|
|
579 |
// -----------------------------------------------------------------------------
|
|
580 |
// CPEAudioData::ConvertToPE
|
|
581 |
// -----------------------------------------------------------------------------
|
|
582 |
//
|
|
583 |
TPEAudioOutput CPEAudioData::ConvertToPE(
|
|
584 |
CTelephonyAudioRouting::TAudioOutput aOutput)
|
|
585 |
{
|
|
586 |
TEFLOGSTRING2( KTAMESINT, "AUD CPEAudioData::ConvertToPE, aOutput %d", aOutput );
|
|
587 |
TPEAudioOutput newOutput(EPENotActive);
|
|
588 |
|
|
589 |
switch (aOutput)
|
|
590 |
{
|
|
591 |
case CTelephonyAudioRouting::ENotActive:
|
|
592 |
newOutput = EPENotActive;
|
|
593 |
break;
|
|
594 |
case CTelephonyAudioRouting::EHandset:
|
|
595 |
newOutput = EPEHandset;
|
|
596 |
break;
|
|
597 |
case CTelephonyAudioRouting::ELoudspeaker:
|
|
598 |
newOutput = EPELoudspeaker;
|
|
599 |
break;
|
|
600 |
case CTelephonyAudioRouting::EWiredAudioAccessory:
|
|
601 |
newOutput = EPEWiredAudioAccessory;
|
|
602 |
break;
|
|
603 |
case CTelephonyAudioRouting::EBTAudioAccessory:
|
|
604 |
newOutput = EPEBTAudioAccessory;
|
|
605 |
break;
|
|
606 |
case CTelephonyAudioRouting::ETTY:
|
|
607 |
newOutput = EPETTY;
|
|
608 |
break;
|
|
609 |
default:
|
|
610 |
break;
|
|
611 |
}
|
|
612 |
|
|
613 |
return newOutput;
|
|
614 |
}
|
|
615 |
|
|
616 |
// -----------------------------------------------------------------------------
|
|
617 |
// CPEAudioData::ConvertToTAR
|
|
618 |
// -----------------------------------------------------------------------------
|
|
619 |
//
|
|
620 |
CTelephonyAudioRouting::TAudioOutput CPEAudioData::ConvertToTAR(
|
|
621 |
TPEAudioOutput aOutput)
|
|
622 |
{
|
|
623 |
TEFLOGSTRING2( KTAMESINT, "AUD CPEAudioData::ConvertToTAR, aOutput %d", aOutput );
|
|
624 |
|
|
625 |
CTelephonyAudioRouting::TAudioOutput newOutput(
|
|
626 |
CTelephonyAudioRouting::ENotActive);
|
|
627 |
|
|
628 |
switch (aOutput)
|
|
629 |
{
|
|
630 |
case EPENotActive:
|
|
631 |
newOutput = CTelephonyAudioRouting::ENotActive;
|
|
632 |
break;
|
|
633 |
case EPEHandset:
|
|
634 |
newOutput = CTelephonyAudioRouting::EHandset;
|
|
635 |
break;
|
|
636 |
case EPELoudspeaker:
|
|
637 |
newOutput = CTelephonyAudioRouting::ELoudspeaker;
|
|
638 |
break;
|
|
639 |
case EPEWiredAudioAccessory:
|
|
640 |
newOutput = CTelephonyAudioRouting::EWiredAudioAccessory;
|
|
641 |
break;
|
|
642 |
case EPEBTAudioAccessory:
|
|
643 |
newOutput = CTelephonyAudioRouting::EBTAudioAccessory;
|
|
644 |
break;
|
|
645 |
case EPETTY:
|
|
646 |
newOutput = CTelephonyAudioRouting::ETTY;
|
|
647 |
break;
|
|
648 |
default:
|
|
649 |
break;
|
|
650 |
}
|
|
651 |
return newOutput;
|
|
652 |
}
|
|
653 |
|
|
654 |
// -----------------------------------------------------------------------------
|
|
655 |
// CPEAudioData::DoHandleVolumeChange
|
|
656 |
// -----------------------------------------------------------------------------
|
|
657 |
//
|
|
658 |
void CPEAudioData::DoHandleVolumeChange(TInt aVolume, TBool aSendMsg)
|
|
659 |
{
|
|
660 |
iPhoneModel.DataStore()->SetAudioVolume(aVolume);
|
|
661 |
|
|
662 |
if (aSendMsg)
|
|
663 |
{
|
|
664 |
SendMessage(MEngineMonitor::EPEMessageAudioVolumeChanged);
|
|
665 |
}
|
|
666 |
}
|
|
667 |
|
|
668 |
// -----------------------------------------------------------------------------
|
|
669 |
// CPEAudioData::EffectsEvent
|
|
670 |
// -----------------------------------------------------------------------------
|
|
671 |
//
|
|
672 |
void CPEAudioData::EffectsEvent(const TMSEffect& tmseffect,
|
|
673 |
TMSSignalEvent event)
|
|
674 |
{
|
|
675 |
TMSEffectType effecttype;
|
|
676 |
const_cast<TMSEffect&>(tmseffect).GetType(effecttype);
|
|
677 |
|
|
678 |
if (effecttype == TMS_EFFECT_GLOBAL_VOL &&
|
|
679 |
event.type == TMS_EVENT_EFFECT_VOL_CHANGED)
|
|
680 |
{
|
|
681 |
TMSVolumeEventChangeData* vd;
|
|
682 |
vd = static_cast<TMSVolumeEventChangeData*>(event.event_data);
|
|
683 |
|
|
684 |
// If volume change event has been triggered by routing change, we
|
|
685 |
// do not want to send EPEMessageAudioVolumeChanged message.
|
|
686 |
if (!vd->output_changed)
|
|
687 |
{
|
|
688 |
DoHandleVolumeChange(iAudioEffect->Volume(), ETrue);
|
|
689 |
}
|
|
690 |
else
|
|
691 |
{
|
|
692 |
DoHandleVolumeChange(iAudioEffect->Volume(), EFalse);
|
|
693 |
}
|
|
694 |
}
|
|
695 |
}
|
|
696 |
|
|
697 |
// End of File
|