javauis/amms_akn/mmacontrol/src/cammsdopplercontrol.cpp
branchRCL_3
changeset 19 04becd199f91
equal deleted inserted replaced
16:f5050f1da672 19:04becd199f91
       
     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 settings of an effect called Doppler.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include <e32math.h>
       
    22 #include <jdebug.h>
       
    23 #include "cammsdopplercontrol.h"
       
    24 
       
    25 
       
    26 // ============================ MEMBER FUNCTIONS ===============================
       
    27 
       
    28 // Destructor
       
    29 CAMMSDopplerControl::~CAMMSDopplerControl()
       
    30 {
       
    31     DEBUG("AMMS::CAMMSDopplerControl::~CAMMSDopplerControl");
       
    32 }
       
    33 
       
    34 // -----------------------------------------------------------------------------
       
    35 // CAMMSDopplerControl::SetEnabled
       
    36 // Specifies if this Doppler effect is active or ignored.
       
    37 // -----------------------------------------------------------------------------
       
    38 //
       
    39 void CAMMSDopplerControl::SetEnabledL(TBool aDopplerEnabled)
       
    40 {
       
    41     if (aDopplerEnabled)
       
    42     {
       
    43         DEBUG("AMMS::CAMMSDopplerControl::SetEnabledL(true)");
       
    44         iDopplerEffect->EnableL();
       
    45     }
       
    46     else
       
    47     {
       
    48         DEBUG("AMMS::CAMMSDopplerControl::SetEnabledL(false)");
       
    49         iDopplerEffect->DisableL();
       
    50     }
       
    51 }
       
    52 
       
    53 
       
    54 // -----------------------------------------------------------------------------
       
    55 // CAMMSDopplerControl::Enabled
       
    56 // Returns whether this Doppler effect is currently active.
       
    57 // -----------------------------------------------------------------------------
       
    58 //
       
    59 TBool CAMMSDopplerControl::Enabled()
       
    60 {
       
    61     return iDopplerEffect->IsEnabled();
       
    62 }
       
    63 
       
    64 // -----------------------------------------------------------------------------
       
    65 // CAMMSDopplerControl::SetVelocityCartesianL
       
    66 // Sets the velocity, used in calculations for the Doppler effect.
       
    67 // -----------------------------------------------------------------------------
       
    68 //
       
    69 void CAMMSDopplerControl::SetVelocityCartesianL(
       
    70     TInt aX,
       
    71     TInt aY,
       
    72     TInt aZ)
       
    73 {
       
    74     DEBUG_INT3("AMMS::CAMMSDopplerControl::SetVelocityCartesianL: X=%d, Y=%d, Z=%d",
       
    75                aX, aY, aZ);
       
    76 
       
    77     iDopplerEffect->SetCartesianVelocityL(aX, aY, aZ);
       
    78 
       
    79     // Apply updated settings to Effect API.
       
    80     iDopplerEffect->ApplyL();
       
    81 }
       
    82 
       
    83 // -----------------------------------------------------------------------------
       
    84 // CAMMSDopplerControl::VelocityCartesian
       
    85 // Returns the current velocity, used in calculations for the Doppler effect.
       
    86 // -----------------------------------------------------------------------------
       
    87 //
       
    88 void CAMMSDopplerControl::VelocityCartesian(
       
    89     TInt& aX, TInt& aY, TInt& aZ)
       
    90 {
       
    91     // Get the velocity's cartesian settings
       
    92     // aX, aY and aZ are velocities in format mm/s
       
    93 
       
    94     iDopplerEffect->CartesianVelocity(
       
    95         (TInt32&)aX, (TInt32&)aY, (TInt32&)aZ);
       
    96 }
       
    97 
       
    98 // -----------------------------------------------------------------------------
       
    99 // CAMMSDopplerControl::SetVelocitySphericalL
       
   100 // Sets the velocity, used in calculations for the Doppler effect.
       
   101 // -----------------------------------------------------------------------------
       
   102 //
       
   103 void CAMMSDopplerControl::SetVelocitySphericalL(
       
   104     TInt aAzimuth,
       
   105     TInt aElevation,
       
   106     TInt aRadius)
       
   107 {
       
   108     // Parameters are thousandths of radians
       
   109 
       
   110     DEBUG_INT3("AMMS::CAMMSDopplerControl::SetVelocitySphericalL %d, %d, %d",
       
   111                aAzimuth, aElevation, aRadius);
       
   112 
       
   113     TInt32 convertedAzimuth = (TInt32)(aAzimuth * KDegToRad *
       
   114                                        1000);   // CSI: 47 Effect API uses thousands of radians #
       
   115 
       
   116     TInt32 convertedElevation = (TInt32)(aElevation * KDegToRad *
       
   117                                          1000);   // CSI: 47 Effect API uses thousands of radians #
       
   118 
       
   119     DEBUG_INT2("AMMS::CAMMSDopplerControl::SetVelocitySphericalL %d, %d",
       
   120                convertedAzimuth, convertedElevation);
       
   121 
       
   122     iDopplerEffect->SetSphericalVelocityL(
       
   123         convertedAzimuth, convertedElevation, aRadius);
       
   124 
       
   125     // Apply updated settings to Effect API.
       
   126     iDopplerEffect->ApplyL();
       
   127 }
       
   128 
       
   129 // -----------------------------------------------------------------------------
       
   130 // CAMMSDopplerControl::CAMMSDopplerControl
       
   131 // C++ default constructor can NOT contain any code, that
       
   132 // might leave.
       
   133 // -----------------------------------------------------------------------------
       
   134 CAMMSDopplerControl::CAMMSDopplerControl(CMMAPlayer* aPlayer):
       
   135         CAMMSControl(aPlayer)
       
   136 {
       
   137 }
       
   138 
       
   139 
       
   140 //  End of File