|
1 /* |
|
2 * Copyright (c) 2002-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: JNI file for DistanceAttenuationControl |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <jutils.h> |
|
20 |
|
21 #include "com_nokia_amms_control_audio3d_DistanceAttenuationControl.h" |
|
22 #include <cmmaeventsource.h> |
|
23 #include "cammsdistanceattenuationcontrolgroup.h" |
|
24 |
|
25 /** |
|
26 * wrapper for CAMMSDistanceAttenuationControlGroup::MuteAfterMax() |
|
27 */ |
|
28 static TBool MuteAfterMax(CAMMSDistanceAttenuationControlGroup* aControl) |
|
29 { |
|
30 return aControl->MuteAfterMax(); |
|
31 } |
|
32 |
|
33 /** |
|
34 * wrapper for CAMMSDistanceAttenuationControlGroup::MinDistance() |
|
35 */ |
|
36 static TInt32 MinDistance(CAMMSDistanceAttenuationControlGroup* aControl) |
|
37 { |
|
38 return aControl->MinDistance(); |
|
39 } |
|
40 |
|
41 /** |
|
42 * wrapper for CAMMSDistanceAttenuationControlGroup::MaxDistance() |
|
43 */ |
|
44 static TInt32 MaxDistance(CAMMSDistanceAttenuationControlGroup* aControl) |
|
45 { |
|
46 return aControl->MaxDistance(); |
|
47 } |
|
48 |
|
49 /** |
|
50 * wrapper for CAMMSDistanceAttenuationControlGroup::RolloffFactor() |
|
51 */ |
|
52 static TUint32 RolloffFactor(CAMMSDistanceAttenuationControlGroup* aControl) |
|
53 { |
|
54 return aControl->RolloffFactor(); |
|
55 } |
|
56 |
|
57 /** |
|
58 * wrapper for CAMMSDistanceAttenuationControlGroup::SetParametersL() |
|
59 */ |
|
60 static void SetParametersL( |
|
61 CAMMSDistanceAttenuationControlGroup* aControl, |
|
62 TInt aMinDistance, |
|
63 TInt aMaxDistance, |
|
64 TBool aMuteAfterMax, |
|
65 TInt aRolloffFactor) |
|
66 { |
|
67 aControl->SetParametersL( |
|
68 aMinDistance, |
|
69 aMaxDistance, |
|
70 aMuteAfterMax, |
|
71 aRolloffFactor); |
|
72 } |
|
73 |
|
74 /* |
|
75 * Class: com_nokia_amms_control_audio3d_DistanceAttenuationControl |
|
76 * Method: _getMuteAfterMax |
|
77 * Signature: (II)Z |
|
78 */ |
|
79 JNIEXPORT jboolean JNICALL |
|
80 Java_com_nokia_amms_control_audio3d_DistanceAttenuationControl__1getMuteAfterMax( |
|
81 JNIEnv*, |
|
82 jclass, |
|
83 jint aEventSource, |
|
84 jint aDistControl) |
|
85 { |
|
86 CMMAEventSource* eventSource = |
|
87 JavaUnhand< CMMAEventSource >(aEventSource); |
|
88 |
|
89 CAMMSDistanceAttenuationControlGroup* distControl = |
|
90 static_cast<CAMMSDistanceAttenuationControlGroup*>( |
|
91 JavaUnhand< CAMMSControlGroup >(aDistControl)); |
|
92 |
|
93 return (jboolean) eventSource->Execute(MuteAfterMax, distControl); |
|
94 } |
|
95 |
|
96 /* |
|
97 * Class: com_nokia_amms_control_audio3d_DistanceAttenuationControl |
|
98 * Method: _getMinDistance |
|
99 * Signature: (II)I |
|
100 */ |
|
101 JNIEXPORT jint JNICALL |
|
102 Java_com_nokia_amms_control_audio3d_DistanceAttenuationControl__1getMinDistance( |
|
103 JNIEnv*, |
|
104 jclass, |
|
105 jint aEventSource, |
|
106 jint aDistControl) |
|
107 { |
|
108 CMMAEventSource* eventSource = |
|
109 JavaUnhand< CMMAEventSource >(aEventSource); |
|
110 |
|
111 CAMMSDistanceAttenuationControlGroup* distControl = |
|
112 static_cast<CAMMSDistanceAttenuationControlGroup*>( |
|
113 JavaUnhand< CAMMSControlGroup >(aDistControl)); |
|
114 |
|
115 return (jint) eventSource->Execute(MinDistance, distControl); |
|
116 } |
|
117 |
|
118 /* |
|
119 * Class: com_nokia_amms_control_audio3d_DistanceAttenuationControl |
|
120 * Method: _getMaxDistance |
|
121 * Signature: (II)I |
|
122 */ |
|
123 JNIEXPORT jint JNICALL |
|
124 Java_com_nokia_amms_control_audio3d_DistanceAttenuationControl__1getMaxDistance( |
|
125 JNIEnv*, |
|
126 jclass, |
|
127 jint aEventSource, |
|
128 jint aDistControl) |
|
129 { |
|
130 CMMAEventSource* eventSource = |
|
131 JavaUnhand< CMMAEventSource >(aEventSource); |
|
132 |
|
133 CAMMSDistanceAttenuationControlGroup* distControl = |
|
134 static_cast<CAMMSDistanceAttenuationControlGroup*>( |
|
135 JavaUnhand< CAMMSControlGroup >(aDistControl)); |
|
136 |
|
137 return (jint) eventSource->Execute(MaxDistance, distControl); |
|
138 } |
|
139 |
|
140 /* |
|
141 * Class: com_nokia_amms_control_audio3d_DistanceAttenuationControl |
|
142 * Method: _getRolloffFactor |
|
143 * Signature: (II)I |
|
144 */ |
|
145 JNIEXPORT jint JNICALL |
|
146 Java_com_nokia_amms_control_audio3d_DistanceAttenuationControl__1getRolloffFactor( |
|
147 JNIEnv*, |
|
148 jclass, |
|
149 jint aEventSource, |
|
150 jint aDistControl) |
|
151 { |
|
152 CMMAEventSource* eventSource = |
|
153 JavaUnhand< CMMAEventSource >(aEventSource); |
|
154 |
|
155 CAMMSDistanceAttenuationControlGroup* distControl = |
|
156 static_cast<CAMMSDistanceAttenuationControlGroup*>( |
|
157 JavaUnhand< CAMMSControlGroup >(aDistControl)); |
|
158 |
|
159 return (jint) eventSource->Execute(RolloffFactor, distControl); |
|
160 } |
|
161 |
|
162 /* |
|
163 * Class: com_nokia_amms_control_audio3d_DistanceAttenuationControl |
|
164 * Method: _setParameters |
|
165 * Signature: (IIIIZI)I |
|
166 */ |
|
167 JNIEXPORT jint JNICALL |
|
168 Java_com_nokia_amms_control_audio3d_DistanceAttenuationControl__1setParameters( |
|
169 JNIEnv*, |
|
170 jclass, |
|
171 jint aEventSource, |
|
172 jint aDistControl, |
|
173 jint aMinDistance, |
|
174 jint aMaxDistance, |
|
175 jboolean aMuteAfterMax, |
|
176 jint aRolloffFactor) |
|
177 { |
|
178 CMMAEventSource* eventSource = |
|
179 JavaUnhand< CMMAEventSource >(aEventSource); |
|
180 |
|
181 CAMMSDistanceAttenuationControlGroup* distControl = |
|
182 static_cast<CAMMSDistanceAttenuationControlGroup*>( |
|
183 JavaUnhand< CAMMSControlGroup >(aDistControl)); |
|
184 |
|
185 TInt error; |
|
186 error = eventSource->ExecuteTrap( |
|
187 &SetParametersL, |
|
188 distControl, |
|
189 (TInt) aMinDistance, |
|
190 (TInt) aMaxDistance, |
|
191 (TBool) aMuteAfterMax, |
|
192 (TInt) aRolloffFactor); |
|
193 |
|
194 return error; |
|
195 } |
|
196 |
|
197 // End of File |