haitest/bspsvs/suite/bsp/sound/src/t_soundactivecallback.cpp
changeset 0 cec860690d41
equal deleted inserted replaced
-1:000000000000 0:cec860690d41
       
     1 /*
       
     2 * Copyright (c) 2005-2009 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 @test
       
    20 @internalComponent
       
    21 
       
    22 This contains CT_SoundActiveCallback
       
    23 */
       
    24 
       
    25 //	User includes
       
    26 #include "t_soundactivecallback.h"
       
    27 
       
    28 /**
       
    29  * Two phase constructor
       
    30  */
       
    31 CT_SoundActiveCallback* CT_SoundActiveCallback::NewL(CDataWrapperBase& aCallback, TInt aPriority)
       
    32 	{
       
    33 	CT_SoundActiveCallback*	ret = NewLC(aCallback, aPriority);
       
    34 	CleanupStack::Pop(ret);
       
    35 	return ret;	
       
    36 	}
       
    37 
       
    38 /**
       
    39  * Two phase constructor
       
    40  */
       
    41 CT_SoundActiveCallback* CT_SoundActiveCallback::NewLC(CDataWrapperBase& aCallback, TInt aPriority)
       
    42 	{
       
    43 	CT_SoundActiveCallback*	ret = new (ELeave) CT_SoundActiveCallback(aCallback, aPriority);
       
    44 	CleanupStack::PushL(ret);
       
    45 	ret->ConstructL();
       
    46 	return ret;	
       
    47 	}
       
    48 
       
    49 /**
       
    50  * Protected constructor. First phase construction
       
    51  */
       
    52 CT_SoundActiveCallback::CT_SoundActiveCallback(CDataWrapperBase& aCallback, TInt aPriority)
       
    53 :	CActiveCallbackBase(aCallback, aPriority),
       
    54 	iDataPosition(0),
       
    55     iSoundData(NULL),
       
    56     iSection(NULL),
       
    57     iBufferBlock(NULL, NULL, NULL)
       
    58 	{
       
    59 	}
       
    60 
       
    61 /**
       
    62  * Public destructor
       
    63  */
       
    64 CT_SoundActiveCallback::~CT_SoundActiveCallback()
       
    65 	{
       
    66 	if (iSoundData)
       
    67 		{
       
    68 		iSoundData->Close();
       
    69 		delete iSoundData;
       
    70 		iSoundData = NULL;
       
    71 		}
       
    72 	}
       
    73 
       
    74 /**
       
    75  * Set section
       
    76  * 
       
    77  * @param aSection 			section name to set
       
    78  *
       
    79  * @return					void
       
    80  *
       
    81  * @leave					no
       
    82  */
       
    83 void CT_SoundActiveCallback::SetSection(const TDesC& aSection)
       
    84 	{
       
    85 	this->iSection=const_cast<TDesC*>(&aSection);
       
    86 	}
       
    87 
       
    88 /**
       
    89  * Create sound data buffer
       
    90  * 
       
    91  * @param aLength 			Length of the buffer to be created
       
    92  *
       
    93  * @return					void
       
    94  *
       
    95  * @leave					System wide error
       
    96  */
       
    97 void CT_SoundActiveCallback::CreateSoundDataBufferL(TInt aLength)
       
    98 	{
       
    99 	iSoundData = new(ELeave) TSoundUtil::RAudioBuffer();
       
   100 	User::LeaveIfError(iSoundData->Create(aLength));
       
   101 	}
       
   102