os/boardsupport/haitest/bspsvs/suite/bsp/sound/src/t_soundactivecallback.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/boardsupport/haitest/bspsvs/suite/bsp/sound/src/t_soundactivecallback.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,102 @@
     1.4 +/*
     1.5 +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). 
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description:
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +/**
    1.22 +@test
    1.23 +@internalComponent
    1.24 +
    1.25 +This contains CT_SoundActiveCallback
    1.26 +*/
    1.27 +
    1.28 +//	User includes
    1.29 +#include "t_soundactivecallback.h"
    1.30 +
    1.31 +/**
    1.32 + * Two phase constructor
    1.33 + */
    1.34 +CT_SoundActiveCallback* CT_SoundActiveCallback::NewL(CDataWrapperBase& aCallback, TInt aPriority)
    1.35 +	{
    1.36 +	CT_SoundActiveCallback*	ret = NewLC(aCallback, aPriority);
    1.37 +	CleanupStack::Pop(ret);
    1.38 +	return ret;	
    1.39 +	}
    1.40 +
    1.41 +/**
    1.42 + * Two phase constructor
    1.43 + */
    1.44 +CT_SoundActiveCallback* CT_SoundActiveCallback::NewLC(CDataWrapperBase& aCallback, TInt aPriority)
    1.45 +	{
    1.46 +	CT_SoundActiveCallback*	ret = new (ELeave) CT_SoundActiveCallback(aCallback, aPriority);
    1.47 +	CleanupStack::PushL(ret);
    1.48 +	ret->ConstructL();
    1.49 +	return ret;	
    1.50 +	}
    1.51 +
    1.52 +/**
    1.53 + * Protected constructor. First phase construction
    1.54 + */
    1.55 +CT_SoundActiveCallback::CT_SoundActiveCallback(CDataWrapperBase& aCallback, TInt aPriority)
    1.56 +:	CActiveCallbackBase(aCallback, aPriority),
    1.57 +	iDataPosition(0),
    1.58 +    iSoundData(NULL),
    1.59 +    iSection(NULL),
    1.60 +    iBufferBlock(NULL, NULL, NULL)
    1.61 +	{
    1.62 +	}
    1.63 +
    1.64 +/**
    1.65 + * Public destructor
    1.66 + */
    1.67 +CT_SoundActiveCallback::~CT_SoundActiveCallback()
    1.68 +	{
    1.69 +	if (iSoundData)
    1.70 +		{
    1.71 +		iSoundData->Close();
    1.72 +		delete iSoundData;
    1.73 +		iSoundData = NULL;
    1.74 +		}
    1.75 +	}
    1.76 +
    1.77 +/**
    1.78 + * Set section
    1.79 + * 
    1.80 + * @param aSection 			section name to set
    1.81 + *
    1.82 + * @return					void
    1.83 + *
    1.84 + * @leave					no
    1.85 + */
    1.86 +void CT_SoundActiveCallback::SetSection(const TDesC& aSection)
    1.87 +	{
    1.88 +	this->iSection=const_cast<TDesC*>(&aSection);
    1.89 +	}
    1.90 +
    1.91 +/**
    1.92 + * Create sound data buffer
    1.93 + * 
    1.94 + * @param aLength 			Length of the buffer to be created
    1.95 + *
    1.96 + * @return					void
    1.97 + *
    1.98 + * @leave					System wide error
    1.99 + */
   1.100 +void CT_SoundActiveCallback::CreateSoundDataBufferL(TInt aLength)
   1.101 +	{
   1.102 +	iSoundData = new(ELeave) TSoundUtil::RAudioBuffer();
   1.103 +	User::LeaveIfError(iSoundData->Create(aLength));
   1.104 +	}
   1.105 +