sl@0: // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #include sl@0: #include "bufferframesconfigtestdevice.h" sl@0: #include "cidefine.h" sl@0: sl@0: /*****************************************************************************/ sl@0: // Implementation sl@0: sl@0: CMMFHwDevice* CBufferFramesConfigTestDevice::NewL() sl@0: { sl@0: CBufferFramesConfigTestDevice* self = new(ELeave) CBufferFramesConfigTestDevice(); sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: CBufferFramesConfigTestDevice::~CBufferFramesConfigTestDevice() sl@0: { sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: CBufferFramesConfigTestDevice::CBufferFramesConfigTestDevice() sl@0: { sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: void CBufferFramesConfigTestDevice::ConstructL() sl@0: { sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TInt CBufferFramesConfigTestDevice::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/) sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TInt CBufferFramesConfigTestDevice::Stop() sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TInt CBufferFramesConfigTestDevice::Pause() sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TInt CBufferFramesConfigTestDevice::Init(THwDeviceInitParams& /*aDevInfo*/) sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TAny* CBufferFramesConfigTestDevice::CustomInterface(TUid aInterfaceId) sl@0: { sl@0: MMMFBufferFramesConfig* interface = NULL; sl@0: sl@0: // DevSound initialisation requires something to be returned for both of sl@0: // these two uids: KMmfPlaySettingsCustomInterface, KMmfRecordSettingsCustomInterface sl@0: if ((aInterfaceId == KUidBufferFramesConfig) || // This interface sl@0: (aInterfaceId.iUid == KMmfPlaySettingsCustomInterface) || sl@0: (aInterfaceId.iUid == KMmfRecordSettingsCustomInterface)) sl@0: { sl@0: interface = this; sl@0: } sl@0: sl@0: return interface; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TInt CBufferFramesConfigTestDevice::ThisHwBufferFilled(CMMFBuffer& /*aFillBufferPtr*/) sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TInt CBufferFramesConfigTestDevice::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/) sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TInt CBufferFramesConfigTestDevice::SetConfig(TTaskConfig& /*aConfig*/) sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TInt CBufferFramesConfigTestDevice::StopAndDeleteCodec() sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TInt CBufferFramesConfigTestDevice::DeleteCodec() sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: CMMFSwCodec& CBufferFramesConfigTestDevice::Codec() sl@0: { sl@0: return *iCodec; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TInt CBufferFramesConfigTestDevice::MmbfcSetNumberOfFramesPerInputBuffer(TInt aFrameCount, TInt aSamplesPerFrame) sl@0: { sl@0: TRAPD(err, DoWriteToFileL(aFrameCount, aSamplesPerFrame)); sl@0: return err; sl@0: } sl@0: sl@0: TInt CBufferFramesConfigTestDevice::MmbfcSetNumberOfFramesPerOutputBuffer(TInt aFrameCount, TInt aSamplesPerFrame) sl@0: { sl@0: TRAPD(err, DoWriteToFileL(aFrameCount, aSamplesPerFrame)); sl@0: return err; sl@0: } sl@0: sl@0: void CBufferFramesConfigTestDevice::DoWriteToFileL(TInt aFrameCount, TInt aSamplesPerFrame) sl@0: { sl@0: RFs fs; sl@0: CleanupClosePushL(fs); sl@0: User::LeaveIfError(fs.Connect()); sl@0: sl@0: RFile file; sl@0: CleanupClosePushL(file); sl@0: sl@0: // File doesn't yet exist sl@0: // It is the responsibility of the calling test function to delete the file after use sl@0: User::LeaveIfError(file.Create(fs, KCITestFileName, EFileWrite)); sl@0: TBuf8 outputBuf; sl@0: outputBuf.Num(aFrameCount); sl@0: outputBuf.Append(' '); sl@0: outputBuf.AppendNum(aSamplesPerFrame); sl@0: User::LeaveIfError(file.Write(outputBuf)); sl@0: CleanupStack::PopAndDestroy(2); // fs, file sl@0: } sl@0: sl@0: