audiostubs/devsoundextensions_stubs/audioeffectscistubs/sourceorientationcistub/src/SourceOrientationCIStub.cpp
changeset 39 65e91466a14b
parent 31 931072794a66
child 40 b7e5ed8c1342
equal deleted inserted replaced
31:931072794a66 39:65e91466a14b
     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: Audio Stubs -  Implementation of the bassboost effect Custom Interface class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifdef _DEBUG
       
    20 #include <e32svr.h> // Needed for RDebug Prints
       
    21 #endif
       
    22 
       
    23 #include "SourceOrientationCI.h"
       
    24 #include <sounddevice.h>
       
    25 
       
    26 // -----------------------------------------------------------------------------
       
    27 // CSourceOrientation::NewL
       
    28 // Static function for creating an instance of the CSourceOrientationCI object.
       
    29 // -----------------------------------------------------------------------------
       
    30 //
       
    31 
       
    32 EXPORT_C CSourceOrientationCI* CSourceOrientationCI::NewL(
       
    33 	CMMFDevSound& aDevSound )
       
    34 	{
       
    35 	CSourceOrientationCI* self = new(ELeave) CSourceOrientationCI(aDevSound);
       
    36 	return self;
       
    37 	}
       
    38 
       
    39 CSourceOrientationCI::CSourceOrientationCI(
       
    40 	CMMFDevSound& aDevSound )
       
    41 	:	iDevSound(&aDevSound)
       
    42 	{
       
    43 	iOrientationData.iHeading = 10;
       
    44 	iOrientationData.iPitch = 10;
       
    45 	iOrientationData.iRoll = 10;
       
    46 	iOrientationData.iFrontX = 10;
       
    47 	iOrientationData.iFrontY = 10;
       
    48 	iOrientationData.iFrontZ = 10;
       
    49 	iOrientationData.iAboveX = 10;
       
    50 	iOrientationData.iAboveY = 10;
       
    51 	iOrientationData.iAboveZ = 10;
       
    52 	}
       
    53 
       
    54 // -----------------------------------------------------------------------------
       
    55 // CSourceOrientation::NewL
       
    56 // Static function for creating an instance of the CSourceOrientationCI object.
       
    57 // -----------------------------------------------------------------------------
       
    58 //
       
    59 
       
    60 EXPORT_C CSourceOrientationCI* CSourceOrientationCI::NewL()
       
    61 	{
       
    62 	CSourceOrientationCI* self = new(ELeave) CSourceOrientationCI();
       
    63 	return self;
       
    64 	}
       
    65 
       
    66 CSourceOrientationCI::CSourceOrientationCI()
       
    67 	{
       
    68 	iOrientationData.iHeading = 10;
       
    69 	iOrientationData.iPitch = 10;
       
    70 	iOrientationData.iRoll = 10;
       
    71 	iOrientationData.iFrontX = 10;
       
    72 	iOrientationData.iFrontY = 10;
       
    73 	iOrientationData.iFrontZ = 10;
       
    74 	iOrientationData.iAboveX = 10;
       
    75 	iOrientationData.iAboveY = 10;
       
    76 	iOrientationData.iAboveZ = 10;
       
    77 	}
       
    78 
       
    79 // Destructor
       
    80 
       
    81 CSourceOrientationCI::~CSourceOrientationCI()
       
    82 	{
       
    83 #ifdef _DEBUG
       
    84     RDebug::Print(_L("CSourceOrientationCI::~CSourceOrientationCI"));
       
    85 #endif
       
    86 	}
       
    87 
       
    88 // -----------------------------------------------------------------------------
       
    89 // CSourceOrientationCI::ApplyL
       
    90 //
       
    91 // Applies the bassboost settings.
       
    92 // Adaptation must check each settings and take appropriate actions since
       
    93 // this method might be called after several settings have been made.
       
    94 // -----------------------------------------------------------------------------
       
    95 //
       
    96 void CSourceOrientationCI::ApplyL()
       
    97 	{
       
    98 #ifdef _DEBUG
       
    99     RDebug::Print(_L("CSourceOrientationCI::ApplyL"));
       
   100 #endif
       
   101 
       
   102 	if ( !HaveUpdateRights() )
       
   103 		{
       
   104 		User::Leave(KErrAccessDenied);
       
   105 		}
       
   106 
       
   107 	if ( IsEnabled() )
       
   108 		{
       
   109 		}
       
   110 
       
   111 	// The effect change event is simulated by changing the bassboost and
       
   112 	// sending the observer a message indicating bassboost has changed.
       
   113 	// This is done for testing only.
       
   114 
       
   115 	// The intention of this callback is to notify the observer when the bassboost
       
   116 	// object changes spontaneously. ie the user did not change the settings but
       
   117 	// event somewhere in the system causes the bassboost object to change state.
       
   118 
       
   119 	if (iObservers.Count() > 0)
       
   120 		{
       
   121 		iObservers[0]->EffectChanged(this, (TUint8)MSourceOrientationObserver::KSpecificEffectBase);
       
   122 		}
       
   123 	}
       
   124 
       
   125 
       
   126 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
   127 
       
   128 
       
   129 
       
   130 // End of File