|
1 /* |
|
2 * Copyright (c) 2005-2007 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: Manipulates the virtual location of an object. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <e32math.h> |
|
22 #include <jdebug.h> |
|
23 #include "cammslocationcontrol.h" |
|
24 |
|
25 #ifdef _DEBUG |
|
26 // CONSTANTS |
|
27 const TInt KAMMSMinRadius = 0; |
|
28 #endif // _DEBUG |
|
29 |
|
30 // ============================ MEMBER FUNCTIONS =============================== |
|
31 |
|
32 // Destructor |
|
33 CAMMSLocationControl::~CAMMSLocationControl() |
|
34 { |
|
35 DEBUG("AMMS::CAMMSLocationControl::~CAMMSLocationControl"); |
|
36 } |
|
37 |
|
38 // ----------------------------------------------------------------------------- |
|
39 // CAMMSLocationControl::SetLocationCartesianL |
|
40 // Moves the object to the new location. |
|
41 // ----------------------------------------------------------------------------- |
|
42 void CAMMSLocationControl::SetLocationCartesianL( |
|
43 TInt& aX, |
|
44 TInt& aY, |
|
45 TInt& aZ) |
|
46 { |
|
47 // Sets the cartesian coordinates for the listener/source location. |
|
48 |
|
49 DEBUG_INT3("AMMS::CAMMSLocationControl::SetLocationCartesianL: %d, %d, %d", |
|
50 aX, aY, aZ); |
|
51 |
|
52 iLocationEffect->SetLocationCartesianL( |
|
53 (TInt32&)aX, (TInt32&)aY, (TInt32&)aZ); |
|
54 |
|
55 // Apply updated settings to Effect API. |
|
56 iLocationEffect->ApplyL(); |
|
57 } |
|
58 |
|
59 // ----------------------------------------------------------------------------- |
|
60 // CAMMSLocationControl::LocationCartesian |
|
61 // Gets the coordinates of the current location. |
|
62 // ----------------------------------------------------------------------------- |
|
63 void CAMMSLocationControl::LocationCartesian( |
|
64 TInt& aX, TInt& aY, TInt& aZ) |
|
65 { |
|
66 // Gets the cartesian coordinates for the location of the listener position. |
|
67 // The coordinates of the positions are in millimeters. |
|
68 |
|
69 iLocationEffect->LocationCartesian( |
|
70 (TInt32&)aX, (TInt32&)aY, (TInt32&)aZ); |
|
71 } |
|
72 |
|
73 |
|
74 // ----------------------------------------------------------------------------- |
|
75 // CAMMSLocationControl::SetLocationSphericalL |
|
76 // Moves the object to the new location. |
|
77 // ----------------------------------------------------------------------------- |
|
78 void CAMMSLocationControl::SetLocationSphericalL( |
|
79 TInt& aAzimuth, |
|
80 TInt& aElevation, |
|
81 TInt& aRadius) |
|
82 { |
|
83 // Check in debug build that aRadius is within valid range. |
|
84 __ASSERT_DEBUG(aRadius >= KAMMSMinRadius, User::Invariant()); |
|
85 |
|
86 // Sets the spherical coordinates for the location of the listener position. |
|
87 // The parameters are thousandths of radians |
|
88 // |
|
89 // NOTE: Effect API uses thousandths of radians for aAzimuth and aElevation, |
|
90 // but JSR234 uses degrees. |
|
91 |
|
92 DEBUG_INT3("AMMS::CAMMSLocationControl::SetLocationSphericalL: %d, %d, %d", |
|
93 aAzimuth, aElevation, aRadius); |
|
94 |
|
95 TInt32 convertedAzimuth = (TInt32)(aAzimuth * |
|
96 KDegToRad * 1000); // CSI: 47 Effect API uses thousands of radians # |
|
97 |
|
98 TInt32 convertedElevation = (TInt32)(aElevation * |
|
99 KDegToRad * 1000); // CSI: 47 Effect API uses thousands of radians # |
|
100 |
|
101 DEBUG_INT2("AMMS::CAMMSLocationControl::SetLocationSphericalL: %d, %d", |
|
102 convertedAzimuth, convertedElevation); |
|
103 |
|
104 iLocationEffect->SetLocationSphericalL( |
|
105 convertedAzimuth, convertedElevation, (TInt32&)aRadius); |
|
106 |
|
107 // Apply updated settings to Effect API. |
|
108 iLocationEffect->ApplyL(); |
|
109 } |
|
110 |
|
111 // ----------------------------------------------------------------------------- |
|
112 // CAMMSLocationControl::CAMMSLocationControl |
|
113 // C++ constructor can NOT contain any code, that |
|
114 // might leave. |
|
115 // ----------------------------------------------------------------------------- |
|
116 CAMMSLocationControl::CAMMSLocationControl(CMMAPlayer* aPlayer) |
|
117 : CAMMSControl(aPlayer) |
|
118 { |
|
119 } |
|
120 |
|
121 // End of File |