os/mm/devsoundextensions/effectspresets/EnvironmentalReverbUtility/src/TempEnvironmentalReverb.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200 (2014-06-10)
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     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:   Implementation of the audio EnvironmentalReverb proxy class
    15 *
    16 */
    17 
    18 
    19 
    20 
    21 // INCLUDE FILES
    22 
    23 #ifdef _DEBUG
    24 #include <e32svr.h>
    25 #endif
    26 
    27 #include "TempEnvironmentalReverb.h"
    28 
    29 // ============================ MEMBER FUNCTIONS ===============================
    30 
    31 // -----------------------------------------------------------------------------
    32 // CTempEnvironmentalReverb::CTempEnvironmentalReverb
    33 // C++ default constructor can NOT contain any code, that
    34 // might leave.
    35 // -----------------------------------------------------------------------------
    36 //
    37 CTempEnvironmentalReverb::CTempEnvironmentalReverb()
    38     {
    39     }
    40 
    41 // Destructor
    42 CTempEnvironmentalReverb::~CTempEnvironmentalReverb()
    43     {
    44 	}
    45 
    46 // -----------------------------------------------------------------------------
    47 // CTempEnvironmentalReverb::NewL
    48 // Static function for creating an instance of the Audio EnvironmentalReverb object.
    49 // -----------------------------------------------------------------------------
    50 //
    51 EXPORT_C CTempEnvironmentalReverb* CTempEnvironmentalReverb::NewL(CEnvironmentalReverb* aEnvironmentalReverb)
    52     {
    53 #ifdef _DEBUG
    54 		    RDebug::Print(_L("CTempEnvironmentalReverb::NewL"));
    55 #endif
    56 
    57     CTempEnvironmentalReverb* self = new (ELeave) CTempEnvironmentalReverb();
    58     CleanupStack::PushL( self );
    59 	self->ConstructL(aEnvironmentalReverb);
    60 	CleanupStack::Pop(self);
    61     return self;
    62 	}
    63 
    64 // -----------------------------------------------------------------------------
    65 // CTempEnvironmentalReverb::ConstructL
    66 // -----------------------------------------------------------------------------
    67 //
    68 void CTempEnvironmentalReverb::ConstructL(CEnvironmentalReverb* aEnvironmentalReverb)
    69     {
    70 #ifdef _DEBUG
    71     RDebug::Print(_L("CTempEnvironmentalReverb::ConstructL"));
    72 #endif
    73 
    74 	iEnvironmentalReverb = aEnvironmentalReverb;
    75 	}
    76 
    77 
    78 // -----------------------------------------------------------------------------
    79 // CTempEnvironmentalReverb::ApplyL
    80 // Apply the Audio EnvironmentalReverb settings.
    81 // -----------------------------------------------------------------------------
    82 //
    83 EXPORT_C void CTempEnvironmentalReverb::ApplyL()
    84 	{
    85 #ifdef _DEBUG
    86     RDebug::Print(_L("CTempEnvironmentalReverb::Apply"));
    87 #endif
    88     if (DecayHFRatio() != iEnvironmentalReverb->DecayHFRatio())
    89       iEnvironmentalReverb->SetDecayHFRatioL (DecayHFRatio());
    90     
    91     if (DecayTime() != iEnvironmentalReverb->DecayTime())
    92       iEnvironmentalReverb->SetDecayTimeL (DecayTime());
    93     
    94     if (Density() != iEnvironmentalReverb->Density())
    95       iEnvironmentalReverb->SetDensityL ( Density());
    96     
    97     if (Diffusion() != iEnvironmentalReverb->Diffusion())
    98       iEnvironmentalReverb->SetDiffusionL (Diffusion());
    99     
   100     if (ReflectionsLevel() != iEnvironmentalReverb->ReflectionsLevel())
   101       iEnvironmentalReverb->SetReflectionsLevelL (ReflectionsLevel());
   102     
   103     if (ReflectionsDelay() != iEnvironmentalReverb->ReflectionsDelay())
   104       iEnvironmentalReverb->SetReflectionsDelayL (ReflectionsDelay());
   105     
   106     if (ReverbDelay() != iEnvironmentalReverb->ReverbDelay())
   107       iEnvironmentalReverb->SetReverbDelayL (ReverbDelay());
   108     
   109     if (ReverbLevel() != iEnvironmentalReverb->ReverbLevel())
   110       iEnvironmentalReverb->SetReverbLevelL (ReverbLevel());
   111     
   112     if (RoomHFLevel() != iEnvironmentalReverb->RoomHFLevel())
   113       iEnvironmentalReverb->SetRoomHFLevelL (RoomHFLevel());
   114     
   115     if (RoomLevel() != iEnvironmentalReverb->RoomLevel())
   116       iEnvironmentalReverb->SetRoomLevelL (RoomLevel());
   117  
   118  
   119     if(iEnvironmentalReverb)
   120 	  iEnvironmentalReverb->EnableL();
   121 	    
   122 	}
   123 
   124 
   125 
   126 // -----------------------------------------------------------------------------
   127 // CTempEnvironmentalReverb::EnableL
   128 // Enable the Audio EnvironmentalReverb settings.
   129 // -----------------------------------------------------------------------------
   130 //
   131 EXPORT_C void CTempEnvironmentalReverb::EnableL()
   132    {
   133    #ifdef _DEBUG
   134    	RDebug::Print(_L("CTempEnvironmentalReverb::EnableL"));
   135    	#endif
   136    	
   137    	iEnabled = ETrue;
   138     ApplyL();  
   139    }
   140 
   141 // -----------------------------------------------------------------------------
   142 // CTempEnvironmentalReverb::DisableL
   143 // Disable the Audio EnvironmentalReverb settings.
   144 // -----------------------------------------------------------------------------
   145 //
   146 EXPORT_C void CTempEnvironmentalReverb::DisableL()
   147    {
   148    #ifdef _DEBUG   
   149    	 RDebug::Print(_L("CTempEnvironmentalReverb::DisableL"));
   150    #endif
   151    	 
   152    	iEnabled = EFalse;   	 
   153 	if(iEnvironmentalReverb)
   154 	  iEnvironmentalReverb->DisableL();	    
   155    }
   156 
   157 // -----------------------------------------------------------------------------
   158 // CTempEnvironmentalReverb::IsEnableL
   159 // Return enable flag.
   160 // -----------------------------------------------------------------------------
   161 //
   162 EXPORT_C TBool CTempEnvironmentalReverb::IsEnabled() const
   163    {
   164    #ifdef _DEBUG 
   165    	 RDebug::Print(_L("CTempEnvironmentalReverb::IsEnabled"));
   166    #endif
   167 
   168     TBool ifEnabled = EFalse;
   169     if(iEnvironmentalReverb)
   170 	   ifEnabled = iEnvironmentalReverb->IsEnabled();	    
   171     
   172     
   173     return ifEnabled;
   174    }
   175 
   176 
   177 
   178 // -----------------------------------------------------------------------------
   179 // CTempEnvironmentalReverb::IsEnforced
   180 // Return enForce flag
   181 // -----------------------------------------------------------------------------
   182 //
   183 EXPORT_C TBool CTempEnvironmentalReverb::IsEnforced() const
   184    {
   185    #ifdef _DEBUG 
   186    RDebug::Print(_L("CTempEnvironmentalReverb::IsEnforced"));
   187    #endif
   188 
   189     TBool ifEnforced = EFalse;   
   190     if(iEnvironmentalReverb)
   191 	  ifEnforced = iEnvironmentalReverb->IsEnforced();	    	
   192     
   193     return ifEnforced;
   194    
   195    }
   196 
   197 
   198 // -----------------------------------------------------------------------------
   199 // CTempEnvironmentalReverb::EnforceL
   200 // Enforce the effect
   201 // -----------------------------------------------------------------------------
   202 //
   203 EXPORT_C void CTempEnvironmentalReverb::EnforceL( TBool aEnforced )
   204    {
   205    #ifdef _DEBUG 
   206    RDebug::Print(_L("CTempEnvironmentalReverb::EnforceL"));
   207    #endif    
   208 
   209    iEnforced = aEnforced;
   210    
   211    if(iEnvironmentalReverb)
   212 	  iEnvironmentalReverb->EnforceL(aEnforced);	   	
   213    }
   214 
   215 
   216 
   217 // -----------------------------------------------------------------------------
   218 // CTempEnvironmentalReverb::HaveUpdateRights
   219 // Return enForce flag
   220 // -----------------------------------------------------------------------------
   221 //
   222 EXPORT_C TBool CTempEnvironmentalReverb::HaveUpdateRights() const
   223    {
   224    #ifdef _DEBUG 
   225    RDebug::Print(_L("CTempEnvironmentalReverb::HaveUpdateRights"));
   226    #endif
   227     
   228     TBool ifHaveUpdateRights = EFalse;   
   229     if(iEnvironmentalReverb)
   230 	  ifHaveUpdateRights = iEnvironmentalReverb->HaveUpdateRights();	    	
   231     
   232     return ifHaveUpdateRights;
   233 	
   234    }
   235 
   236 
   237 
   238 // ========================== OTHER EXPORTED FUNCTIONS =========================
   239 
   240 // End of File
   241