author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 18 Aug 2010 09:49:03 +0300 | |
changeset 41 | 3a6b55c6390c |
parent 28 | 075425b8d9a4 |
child 57 | 21be958eb3ce |
permissions | -rw-r--r-- |
24 | 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: |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
// User includes |
|
19 |
#include "cradioenginelogger.h" |
|
20 |
#include "cradioaudiorouter.h" |
|
21 |
#include "mradioaudioroutingobserver.h" |
|
22 |
#include "cradioroutableaudio.h" |
|
23 |
#include "radioengineutils.h" |
|
24 |
||
25 |
||
26 |
const TInt KVisualRadioInitialRoutableAudioArraySize( 2 ); |
|
27 |
||
28 |
// --------------------------------------------------------------------------- |
|
29 |
// |
|
30 |
// --------------------------------------------------------------------------- |
|
31 |
// |
|
32 |
CRadioAudioRouter::CRadioAudioRouter( MRadioAudioRoutingObserver& aAudioRoutingObserver ) |
|
33 |
: iAudioRoutingObserver( aAudioRoutingObserver ) |
|
34 |
{ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
35 |
LEVEL3( LOG_METHOD_AUTO ); |
24 | 36 |
} |
37 |
||
38 |
// --------------------------------------------------------------------------- |
|
39 |
// |
|
40 |
// --------------------------------------------------------------------------- |
|
41 |
// |
|
42 |
EXPORT_C CRadioAudioRouter* CRadioAudioRouter::NewL( MRadioAudioRoutingObserver& aAudioRoutingObserver ) |
|
43 |
{ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
44 |
LEVEL3( LOG_METHOD_AUTO ); |
24 | 45 |
CRadioAudioRouter* self = new( ELeave ) CRadioAudioRouter( aAudioRoutingObserver ); |
46 |
CleanupStack::PushL( self ); |
|
47 |
self->ConstructL(); |
|
48 |
CleanupStack::Pop( self ); |
|
49 |
return self; |
|
50 |
} |
|
51 |
||
52 |
// --------------------------------------------------------------------------- |
|
53 |
// |
|
54 |
// --------------------------------------------------------------------------- |
|
55 |
// |
|
56 |
EXPORT_C CRadioAudioRouter::~CRadioAudioRouter() |
|
57 |
{ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
58 |
LEVEL3( LOG_METHOD_AUTO ); |
24 | 59 |
iRoutableAudios.Close(); |
60 |
RadioEngineUtils::Release(); |
|
61 |
} |
|
62 |
||
63 |
// --------------------------------------------------------------------------- |
|
64 |
// |
|
65 |
// --------------------------------------------------------------------------- |
|
66 |
// |
|
67 |
void CRadioAudioRouter::ConstructL() |
|
68 |
{ |
|
69 |
RadioEngineUtils::InitializeL(); |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
70 |
LEVEL3( LOG_METHOD_AUTO ); |
24 | 71 |
iRoutableAudios = RArray<CRadioRoutableAudio*>( KVisualRadioInitialRoutableAudioArraySize ); |
72 |
} |
|
73 |
||
74 |
// --------------------------------------------------------------------------- |
|
75 |
// Sets audio route |
|
76 |
// --------------------------------------------------------------------------- |
|
77 |
// |
|
78 |
EXPORT_C void CRadioAudioRouter::SetAudioRouteL( RadioEngine::TRadioAudioRoute aAudioRoute ) |
|
79 |
{ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
80 |
LEVEL3( LOG_METHOD_AUTO ); |
24 | 81 |
|
41
3a6b55c6390c
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
82 |
for ( TInt i = 0; i < iRoutableAudios.Count(); ++i ) |
24 | 83 |
{ |
84 |
iRoutableAudios[i]->SetAudioRouteL( aAudioRoute ); |
|
85 |
} |
|
86 |
iAudioRoutingObserver.AudioRouteChangedL( aAudioRoute ); |
|
87 |
} |
|
88 |
||
89 |
// --------------------------------------------------------------------------- |
|
90 |
// |
|
91 |
// --------------------------------------------------------------------------- |
|
92 |
// |
|
93 |
EXPORT_C void CRadioAudioRouter::RegisterRoutableAudio( CRadioRoutableAudio* aRoutableAudio ) |
|
94 |
{ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
95 |
LEVEL3( LOG_METHOD_AUTO ); |
24 | 96 |
iRoutableAudios.Append( aRoutableAudio ); |
97 |
} |
|
98 |
||
99 |
// --------------------------------------------------------------------------- |
|
100 |
// |
|
101 |
// --------------------------------------------------------------------------- |
|
102 |
// |
|
103 |
EXPORT_C void CRadioAudioRouter::UnRegisterRoutableAudio( CRadioRoutableAudio* aRoutableAudio ) |
|
104 |
{ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
105 |
LEVEL3( LOG_METHOD_AUTO ); |
24 | 106 |
|
107 |
TInt objectIndex = iRoutableAudios.Find( aRoutableAudio ); |
|
108 |
||
109 |
__ASSERT_DEBUG( objectIndex != KErrNotFound, User::Panic( _L("VisualRadio" ), KErrAbort ) ); |
|
110 |
||
111 |
if ( objectIndex != KErrNotFound ) |
|
112 |
{ |
|
113 |
iRoutableAudios.Remove( objectIndex ); |
|
114 |
} |
|
115 |
} |
|
116 |