|
1 /* |
|
2 * Copyright (c) 2004 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: Audio Stubs - Implementation of the Source Doppler Effect Custom Interface class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifdef _DEBUG |
|
20 #include <e32svr.h> // Needed for RDebug Prints |
|
21 #endif |
|
22 |
|
23 #include "SourceDopplerCI.h" |
|
24 #include <sounddevice.h> |
|
25 |
|
26 // ----------------------------------------------------------------------------- |
|
27 // CSourceDoppler::NewL |
|
28 // Static function for creating an instance of the CSourceDopplerCI object. |
|
29 // ----------------------------------------------------------------------------- |
|
30 // |
|
31 |
|
32 EXPORT_C CSourceDopplerCI* CSourceDopplerCI::NewL( |
|
33 CMMFDevSound& aDevSound ) |
|
34 { |
|
35 CSourceDopplerCI* self = new(ELeave) CSourceDopplerCI(aDevSound); |
|
36 return self; |
|
37 } |
|
38 |
|
39 CSourceDopplerCI::CSourceDopplerCI( |
|
40 CMMFDevSound& aDevSound ) |
|
41 : iDevSound(&aDevSound) |
|
42 { |
|
43 iDopplerData.iVelocityX = 10; |
|
44 iDopplerData.iVelocityY = 10; |
|
45 iDopplerData.iVelocityZ = 10; |
|
46 iDopplerData.iAzimuth = 20; |
|
47 iDopplerData.iElevation = 20; |
|
48 iDopplerData.iRadius = 20; |
|
49 iDopplerData.iFactor = 5; |
|
50 iDopplerData.iMaxFactor = 10; |
|
51 } |
|
52 |
|
53 // ----------------------------------------------------------------------------- |
|
54 // CSourceDoppler::NewL |
|
55 // Static function for creating an instance of the CSourceDopplerCI object. |
|
56 // ----------------------------------------------------------------------------- |
|
57 // |
|
58 |
|
59 EXPORT_C CSourceDopplerCI* CSourceDopplerCI::NewL() |
|
60 { |
|
61 CSourceDopplerCI* self = new(ELeave) CSourceDopplerCI(); |
|
62 return self; |
|
63 } |
|
64 |
|
65 CSourceDopplerCI::CSourceDopplerCI() |
|
66 { |
|
67 iDopplerData.iVelocityX = 10; |
|
68 iDopplerData.iVelocityY = 10; |
|
69 iDopplerData.iVelocityZ = 10; |
|
70 iDopplerData.iAzimuth = 20; |
|
71 iDopplerData.iElevation = 20; |
|
72 iDopplerData.iRadius = 20; |
|
73 iDopplerData.iFactor = 5; |
|
74 iDopplerData.iMaxFactor = 10; |
|
75 } |
|
76 |
|
77 // Destructor |
|
78 |
|
79 CSourceDopplerCI::~CSourceDopplerCI() |
|
80 { |
|
81 #ifdef _DEBUG |
|
82 RDebug::Print(_L("CSourceDopplerCI::~CSourceDopplerCI")); |
|
83 #endif |
|
84 } |
|
85 |
|
86 // ----------------------------------------------------------------------------- |
|
87 // CSourceDopplerCI::ApplyL |
|
88 // |
|
89 // Applies the SourceDoppler settings. |
|
90 // Adaptation must check each settings and take appropriate actions since |
|
91 // this method might be called after several settings have been made. |
|
92 // ----------------------------------------------------------------------------- |
|
93 // |
|
94 void CSourceDopplerCI::ApplyL() |
|
95 { |
|
96 #ifdef _DEBUG |
|
97 RDebug::Print(_L("CSourceDopplerCI::ApplyL")); |
|
98 #endif |
|
99 |
|
100 if ( !HaveUpdateRights() ) |
|
101 { |
|
102 User::Leave(KErrAccessDenied); |
|
103 } |
|
104 |
|
105 if (iObservers.Count() > 0) |
|
106 { |
|
107 if(iDopplerData.iEnabled) |
|
108 { |
|
109 iEnabled = iDopplerData.iEnabled; |
|
110 iObservers[0]->EffectChanged(this, (TUint8)MAudioEffectObserver::KEnabled); |
|
111 } |
|
112 else |
|
113 { |
|
114 iEnabled = iDopplerData.iEnabled; |
|
115 iObservers[0]->EffectChanged(this, (TUint8)MAudioEffectObserver::KDisabled); |
|
116 } |
|
117 |
|
118 } |
|
119 |
|
120 } |
|
121 |
|
122 |
|
123 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
124 |
|
125 |
|
126 |
|
127 // End of File |