javauis/amms_akn/jni/src/reverbcontrol.cpp
changeset 21 2a9601315dfc
equal deleted inserted replaced
18:e8e63152f320 21:2a9601315dfc
       
     1 /*
       
     2 * Copyright (c) 2002 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 
       
    19 #include <jutils.h>
       
    20 
       
    21 #include "com_nokia_amms_control_audioeffect_ReverbControl.h"
       
    22 #include <cmmaeventsource.h>
       
    23 #include "cammsreverbcontrolgroup.h"
       
    24 
       
    25 /**
       
    26  * wrapper for CAMMSReverbControlGroup::SetReverbLevelL()
       
    27  */
       
    28 static void SetReverbLevelL(
       
    29     CAMMSReverbControlGroup* aControl,
       
    30     TInt *aLevel)
       
    31 {
       
    32     aControl->SetReverbLevelL(*aLevel);
       
    33     *aLevel = aControl->ReverbLevel();
       
    34 }
       
    35 
       
    36 /**
       
    37  * wrapper for CAMMSReverbControlGroup::SetReverbLevelL()
       
    38  */
       
    39 static void SetReverbTimeL(
       
    40     CAMMSReverbControlGroup* aControl,
       
    41     TInt aTime)
       
    42 {
       
    43     aControl->SetReverbTimeL(aTime);
       
    44 }
       
    45 
       
    46 /*
       
    47  * Class:     com_nokia_amms_control_audioeffect_ReverbControl
       
    48  * Method:    _getReverbLevel
       
    49  * Signature: (II)I
       
    50  */
       
    51 JNIEXPORT jint JNICALL Java_com_nokia_amms_control_audioeffect_ReverbControl__1getReverbLevel(
       
    52     JNIEnv*,
       
    53     jclass,
       
    54     jint aEventSource,
       
    55     jint aControl)
       
    56 {
       
    57     CMMAEventSource* eventSource =
       
    58         JavaUnhand< CMMAEventSource >(aEventSource);
       
    59 
       
    60     CAMMSReverbControlGroup* control = static_cast< CAMMSReverbControlGroup* >(
       
    61                                            JavaUnhand< CAMMSControlGroup >(aControl));
       
    62 
       
    63     return control->ReverbLevel();
       
    64 }
       
    65 
       
    66 /*
       
    67  * Class:     com_nokia_amms_control_audioeffect_ReverbControl
       
    68  * Method:    _getReverbTime
       
    69  * Signature: (II)I
       
    70  */
       
    71 JNIEXPORT jint JNICALL Java_com_nokia_amms_control_audioeffect_ReverbControl__1getReverbTime(
       
    72     JNIEnv*, jclass, jint aEventSource, jint aControl)
       
    73 {
       
    74     CMMAEventSource* eventSource =
       
    75         JavaUnhand< CMMAEventSource >(aEventSource);
       
    76 
       
    77     CAMMSReverbControlGroup* control = static_cast< CAMMSReverbControlGroup* >(
       
    78                                            JavaUnhand< CAMMSControlGroup >(aControl));
       
    79 
       
    80     return control->ReverbTime();
       
    81 }
       
    82 
       
    83 /*
       
    84  * Class:     com_nokia_amms_control_audioeffect_ReverbControl
       
    85  * Method:    _setReverbTime
       
    86  * Signature: (III)I
       
    87  */
       
    88 JNIEXPORT jint JNICALL Java_com_nokia_amms_control_audioeffect_ReverbControl__1setReverbTime(
       
    89     JNIEnv*,
       
    90     jclass,
       
    91     jint aEventSource,
       
    92     jint aControl,
       
    93     jint aTime)
       
    94 {
       
    95     CMMAEventSource* eventSource =
       
    96         JavaUnhand< CMMAEventSource >(aEventSource);
       
    97 
       
    98     CAMMSReverbControlGroup* control = static_cast< CAMMSReverbControlGroup* >(
       
    99                                            JavaUnhand< CAMMSControlGroup >(aControl));
       
   100 
       
   101     TInt error;
       
   102     error = eventSource->ExecuteTrap(SetReverbTimeL, control, (TInt) aTime);
       
   103     return error;
       
   104 }
       
   105 
       
   106 /*
       
   107  * Class:     com_nokia_amms_control_audioeffect_ReverbControl
       
   108  * Method:    _setReverbLevel
       
   109  * Signature: (III)I
       
   110  */
       
   111 JNIEXPORT jint JNICALL Java_com_nokia_amms_control_audioeffect_ReverbControl__1setReverbLevel(
       
   112     JNIEnv* aJniEnv,
       
   113     jclass,
       
   114     jint aEventSource,
       
   115     jint aControl,
       
   116     jint aLevel,
       
   117     jintArray aError)
       
   118 {
       
   119     CMMAEventSource* eventSource =
       
   120         JavaUnhand< CMMAEventSource >(aEventSource);
       
   121 
       
   122     CAMMSReverbControlGroup* control = static_cast< CAMMSReverbControlGroup* >(
       
   123                                            JavaUnhand< CAMMSControlGroup >(aControl));
       
   124 
       
   125     TInt error;
       
   126     TInt level = aLevel;
       
   127 
       
   128     error = eventSource->ExecuteTrap(
       
   129                 SetReverbLevelL,
       
   130                 control,
       
   131                 (TInt *) &level);
       
   132 
       
   133     jint javaError[ 1 ] = { error };
       
   134     aJniEnv->SetIntArrayRegion(aError, 0, 1, javaError);
       
   135 
       
   136     return level;
       
   137 }
       
   138 
       
   139 
       
   140 //  End of File